Yes, you are correct. On Tue, May 22, 2012 at 11:49 AM, Sajith Kariyawasam <[email protected]>wrote:
> > On Tue, May 22, 2012 at 11:09 AM, Tharindu Mathew <[email protected]>wrote: > >> >> >> On Tue, May 22, 2012 at 11:04 AM, Sajith Kariyawasam <[email protected]>wrote: >> >>> Hi Tharindu/Kasun, >>> >>> Thanks for the responses, >>> >>> On Mon, May 21, 2012 at 11:34 PM, Tharindu Mathew <[email protected]>wrote: >>> >>>> getElementByTagsName is a function of the document object, which is >>>> present in the browser. So, it only works in the browser. >>>> >>>> >>> I'm bit confused here, I was trying to get the responseXML from >>> WSRequest object, as an XML object, and then process it using >>> getElementByTagsName >>> function. so as far as the responseXML is an xml object shouldn't I be able >>> to use getElementByTagsName irrespective of a browser ? >>> >> No not necessarily. The problem here is the function you are mentioning >> is not present in the response object. It is not a function in the base >> object class. It is specific to the document object. >> >> You are using it because you are familiar with using it with the document >> object. The document object is given by the browser for dom manipulation. >> So, that is why it only works in the browser. >> > > No, not with the document object, but with the XMLHttpRequest object . > "responseXML" > is a property of XMLHttpRequest object. > > so, in this case WSRequest is the object similar to XMLHttpRequest > object, and it does have a responseXML property.. > > well i just figured out according to [1], as of now responseXML returns > the same response as responseE4X, but in future releases it will return a > fixed DOM. > > so when the time it returns a DOM, it should be able to get element values > using getElementByTagsName or a similar way .. isn't it? > > [1] http://wso2.org/project/mashup/2.0.2/docs/wsrequesthostobject.html > > >>> >>>> >>>> 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 >>>>> >>>>> >>> yes, this link was helpful.. >>> I tried the following as mentioned in the link .. >>> >>> var response = service.responseE4X..wx::GetQuoteResult.text(); >>> var stock = new XML(response.toXMLString()); >>> print("Symbol : " + stock.Stock.Symbol); >>> >>> It works.. thanks >>> >>> 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 >>>> >>>> >>> >>> >>> -- >>> Regards, >>> * >>> * >>> *Sajith Kariyawasam* >>> *Senior Software Engineer; WSO2, Inc.; http://wso2.com* >>> >>> >> >> >> -- >> Regards, >> >> Tharindu >> >> blog: http://mackiemathew.com/ >> M: +94777759908 >> >> > > > -- > Regards, > * > * > *Sajith Kariyawasam* > *Senior Software Engineer; WSO2, Inc.; http://wso2.com* > > -- Regards, Tharindu blog: http://mackiemathew.com/ M: +94777759908
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
