getElementByTagsName is a function of the document object, which is present
in the browser. So, it only works in the browser.

On Mon, May 21, 2012 at 11:13 PM, Kasun Indrasiri <[email protected]> wrote:

> This may help..
> https://developer.mozilla.org/En/E4X/Processing_XML_with_E4X
>
> On Mon, May 21, 2012 at 11:05 PM, Sajith Kariyawasam <[email protected]>wrote:
>
>> Hi,
>>
>> I was trying to invoke a web service inside a javascript file, and deploy
>> it in Mashup Server.
>>
>> SOAP response of the web service is defined as follows,
>>
>>
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
>> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
>>   <soap:Body>
>>     <GetQuoteResponse xmlns="http://www.webserviceX.NET/";>
>>       <GetQuoteResult>string</GetQuoteResult>
>>     </GetQuoteResponse>
>>   </soap:Body>
>> </soap:Envelope>
>>
>>
>> A sample response value is as follows ,
>>
>> <string xmlns="http://www.webserviceX.NET/";>
>> <StockQuotes><Stock><Symbol>GOOG</Symbol><Last>613.43</Last><Date>5/21/2012</Date><Time>1:00pm</Time><Change>+13.03</Change><Open>601.00</Open><High>615.694</High><Low>600.00</Low><Volume>2006668</Volume><MktCap>200.0B</MktCap><PreviousClose>600.40</PreviousClose><PercentageChange>+2.17%</PercentageChange><AnnRange>473.02
>> - 670.25</AnnRange><Earns>32.998</Earns><P-E>18.20</P-E><Name>Google
>> Inc.</Name></Stock></StockQuotes>
>> </string>
>>
>>
>> My requirement is to extract couple of elements from the response (say,
>> Symbol and Change) and print the values.
>>
>>
>> In my .js file I tried a code like this,
>>
>> *var service = new WSRequest();*
>> *...*
>> *...*
>> *
>> var response = service.responseXML;
>> *
>> *
>> var stock = response.getElementsByTagName('Stock');
>>
>>
>> *
>>
>> But I'm getting an exception saying *"**ERROR -  TypeError: Cannot find
>> function getElementsByTagName in object ... "*
>>
>> so, $subject please?
>>
>>
>> Thanks,
>> --
>>
>> *Sajith Kariyawasam*
>> *Senior Software Engineer; WSO2, Inc.; http://wso2.com*
>>
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Kasun Indrasiri
> Associate Technical Lead
> WSO2, Inc.; http://wso2.com
> lean.enterprise.middleware
>
> cell: +94 71 536 4128
> Blog : http://kasunpanorama.blogspot.com/
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Regards,

Tharindu

blog: http://mackiemathew.com/
M: +94777759908
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to