Hi Maduranga,

>From WSRequest, what you get is an E4X object. When that object is passed
into print() method, it automatically serializes E4X object. That's why you
get a proper XML at the client side.

Since your "result" variable points to an E4X object, whatever you
retrieve, should be done through E4X queries. i.e. In your case, it should
be result..*::cost.text(). If you need, you can even do a namespace
qualified query.

/Ruchira


On Mon, Dec 23, 2013 at 2:15 AM, Maduranga Siriwardena
<[email protected]>wrote:

> This is what is done in the front end.
>
> $.get("server.jag", { action: "createOrder"},
>    function(data){
>         alert(data);
>    });
>         };
>
> server.jag is like bellow.
>
> <%
> 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:checkOrderCost";
> var payload =<ns:checkOrderCost xmlns:ns="http://orderprocessorns
> "><ns:orderId>5</ns:orderId></ns:checkOrderCost>;
>  var result;
>
> try {
> version.open(options,"http://localhost:8080/axis2/services/OrderProcessor";,
> false);
>  version.send(payload);
> result = version.responseE4X;
> } catch (e) {
>  log.error(e.toString());
> return e.toString();
> }
>  return result;
> }
>
> var response = invokeGetVersion();
> print(response);
>
> %>
>
>
> On Mon, Dec 23, 2013 at 11:04 AM, Amila Maha Arachchi <[email protected]>wrote:
>
>> Please post your code segment.
>>
>>
>> On Mon, Dec 23, 2013 at 10:58 AM, Maduranga Siriwardena <
>> [email protected]> wrote:
>>
>>> Hi all,
>>> I'm trying to call a web service using jaggery application as described
>>> in [1].
>>>  As described in the example, if I print the returned value of the
>>> function directly and alerted in the front end, I get the XML response. But
>>> if I assigned the returned value to a variable and print it, I get "{}".
>>>
>>> The response I'm getting from the service is like bellow.
>>>
>>> <ns:checkOrderCostResponse xmlns:ns="http://orderprocessorns
>>> "><ns:cost>1120.0</ns:cost></ns:checkOrderCostResponse>
>>>
>>> So I must be able to get the value of the cost tag by just saying
>>> response_variable.cost
>>> But if I do that I get "null"
>>>
>>> Can someone please help me to understand what is happening here.
>>>
>>> [1] http://jaggeryjs.org/apidocs/ws.jag
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> *Amila Maharachchi*
>> Senior Technical Lead
>> WSO2, Inc.; http://wso2.com
>>
>> Blog: http://maharachchi.blogspot.com
>> Mobile: +94719371446
>>
>>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 

*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

Reply via email to