Hello,

I am experimenting a bit with calling web services in OpenSocial
widgets. The version of the OpenSocial API is 0.8.

The response of such a web service is a soap message (it is a
classical web service with a WSDL, etc). The soap message is an XML.
Therefore, it is quite logical to attempt to process it as a DOM
object.

I was expecting to achieve the above with the gadgets.io. The content
type gadgets.io.ContentType.DOM is supposed to allow me to get a DOM
tree of the WS response soap message (it is an XML after all). The DOM
should be available in the DATA property of the response object. At
least this is my understanding. However, when I tested several WS in
orkut sandbox the DATA property of the object reprsenting the response
is empty. The TEXT property returns a correct XML, but I cannot get
the DOM tree.

Your help will be highly appreciated.

Here is a sample code (do not mind the WS used - it is free):

===================

var spStr = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no
\"?><SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/
soap/envelope/\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\";
xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\"; xmlns:tns=
\"http://euro2008.dataaccess.eu\"; xmlns:xsi=\"http://www.w3.org/2001/
XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\";
><SOAP-ENV:Body><tns:AllDefenders xmlns:tns=\"http://
euro2008.dataaccess.eu\"><tns:sCountryName>Canada</tns:sCountryName></
tns:AllDefenders></SOAP-ENV:Body></SOAP-ENV:Envelope>";

params = {};
params[gadgets.io.RequestParameters.CONTENT_TYPE] =
gadgets.io.ContentType.DOM;
params[gadgets.io.RequestParameters.AUTHORIZATION] =
gadgets.io.AuthorizationType.NONE;
params[gadgets.io.RequestParameters.METHOD] =
gadgets.io.MethodType.POST;
params[gadgets.io.RequestParameters.HEADERS] = {
   "SOAPAction": "AllDefenders",
   "Content-Type": "text/xml; charset=utf-8"
};
params[gadgets.io.RequestParameters.POST_DATA]= spStr;
gadgets.io.makeRequest("http://euro2008.dataaccess.eu/
footballpoolwebservice.wso", function(obj) {
          alert("obj.text: "+obj.text);
          alert("obj.data: "+obj.data);
        }, params);


==========

The XML returned from the WS is as follows (available in obj.text):

<?xml version="1.0" encoding="utf-8"?> <soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";> <soap:Body>
<m:AllDefendersResponse xmlns:m="http://euro2008.dataaccess.eu";>
<m:AllDefendersResult> <m:string>Dario Knezevic</m:string>
<m:string>Dario Simic</m:string> <m:string>Hrvoje Vejic</m:string>
<m:string>Josip Simunic</m:string> <m:string>Robert Kovac</m:string>
<m:string>Vedran Corluka</m:string> </m:AllDefendersResult> </
m:AllDefendersResponse> </soap:Body> </soap:Envelope>


--

You received this message because you are subscribed to the Google Groups 
"OpenSocial Application Development" group.
To post to this group, send email to opensocial-...@googlegroups.com.
To unsubscribe from this group, send email to 
opensocial-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/opensocial-api?hl=en.


Reply via email to