Hi Danushka,
Can you please execute following code and check whether the outgoing
message has proper headers. I tested this locally and hope this will help
you. Please note that I have set the header XML as a string value[1].
/Ruchira
<%
function invokeGetVersion() {
var log = new Log();
var ws = require('ws');
var version = new ws.WSRequest();
var options = new Array();
options.useSOAP = 1.2;
options.useWSA = 1.0;
options.action = "urn:getVersion";
options["SOAPHeaders"] = ['<MyHeader1 xmlns="http://example.com
">headerValue</MyHeader1>'];
var payload = <Enlighten xmlns="http://clearforest.com/
"><licenseID>string</licenseID></Enlighten>;
var result;
try {
version.open(options, "http://localhost:8080/", false);
version.send(payload);
result = version.responseE4X;
} catch (e) {
log.error(e.toString());
return e.toString();
}
return result;
}
invokeGetVersion();
%>
[1] https://github.com/wso2/jaggery/issues/103
On Thu, Oct 2, 2014 at 5:15 PM, Danushka Fernando <[email protected]>
wrote:
> Hi Ruchira
> I logged the value of options["SOAPHeaders"] in client side [1]. Still I
> cannot get these headers to server side. Am I doing something wrong here.
>
> [1] TID: [0] [Carbon] [2014-10-02 17:04:39,448] INFO
> {modules/resources/databases/add/add.jag} -
> *stringify(options['SOAPHeaders'])
> : ["<tns:UserName xmlns:tns='http://mutualssl.carbon.wso2.org
> <http://mutualssl.carbon.wso2.org>'>[email protected]
> <[email protected]></tns:UserName>"]*
> {modules/resources/databases/add/add.jag}
>
>
> Thanks & Regards
> Danushka Fernando
> Software Engineer
> WSO2 inc. http://wso2.com/
> Mobile : +94716332729
>
> On Wed, Oct 1, 2014 at 8:00 PM, Danushka Fernando <[email protected]>
> wrote:
>
>> Hi Ruchira
>> Thanks for response. WIll try that.
>>
>> Thanks & Regards
>> Danushka Fernando
>> Software Engineer
>> WSO2 inc. http://wso2.com/
>> Mobile : +94716332729
>>
>> On Wed, Oct 1, 2014 at 7:17 PM, Ruchira Wageesha <[email protected]>
>> wrote:
>>
>>> Hi Danushka,
>>>
>>> It seems there is an issue in the sample code provided under docs. As
>>> mentioned in the description, you need specify it as "SOAPHeaders"
>>> property, not HTTPHeaders property.
>>>
>>> /Ruchira
>>>
>>> On Wed, Oct 1, 2014 at 6:12 PM, Danushka Fernando <[email protected]>
>>> wrote:
>>>
>>>> Hi all
>>>> I was trying to do $subject as mentioned in [1].
>>>> According to [1]
>>>>
>>>>
>>>> - SOAPHeaders - Used to specify custom SOAP headers to be send
>>>> along with the SOAP message. This should be an array of elements. You
>>>> can
>>>> specify a header as an XML object or just as an object in the following
>>>> structure. valueObject could be either a String or an XML object
>>>>
>>>> options["HTTPHeaders"] = [
>>>> <MyHeader1 xmlns="http://example.com">headerValue</MyHeader1>,
>>>> ...
>>>> {qName : new QName("http://example.com", "MyHeader2"), value :
>>>> valueObject},
>>>> ...
>>>> ];
>>>>
>>>>
>>>> So I wrote following code.
>>>>
>>>> var mutualAuthHeader = {qName : new
>>>> QName(MUTUALSSL_HEADER_USERNAME_URL, "UserName", "tns"), value : username};
>>>> httpHeaders.push(mutualAuthHeader);
>>>> options["HTTPHeaders"] = httpHeaders;
>>>>
>>>>
>>>> But when I call the service it fails with following error.
>>>>
>>>> TID: [0] [Carbon] [2014-10-01 18:03:39,059] ERROR
>>>> {org.jaggeryjs.modules.ws.WSRequestHostObject} - Invalid declaration for
>>>> HTTPHeaders property {org.jaggeryjs.modules.ws.WSRequestHostObject}
>>>>
>>>>
>>>> Any ideas? Am I doing something wrong or don't jaggery support this
>>>> feature. We are using the version 0.9.0.ALPHA4_wso2v6.
>>>>
>>>>
>>>> [1] http://jaggeryjs.org/documentation.jag?api=ws
>>>>
>>>> Thanks & Regards
>>>> Danushka Fernando
>>>> Software Engineer
>>>> WSO2 inc. http://wso2.com/
>>>> Mobile : +94716332729
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> *Ruchira Wageesha**Associate Technical Lead*
>>> *WSO2 Inc. - lean . enterprise . middleware | wso2.com
>>> <http://wso2.com>*
>>>
>>> *email: [email protected] <[email protected]>, blog:
>>> ruchirawageesha.blogspot.com <http://ruchirawageesha.blogspot.com>,
>>> mobile: +94 77 5493444 <%2B94%2077%205493444>*
>>>
>>
>>
>
--
*Ruchira Wageesha**Associate Technical Lead*
*WSO2 Inc. - lean . enterprise . middleware | wso2.com <http://wso2.com>*
*email: [email protected] <[email protected]>, blog:
ruchirawageesha.blogspot.com <http://ruchirawageesha.blogspot.com>,
mobile: +94 77 5493444*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev