Re: WSDK synchronous proxying (was Re: SOAP problem with array encoding)
Martin Honnen <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | Liberty Development |
| Message-ID | <[email protected]> |
Hiran Chaudhuri wrote:
> I also had a look at the WSDL proxying api, which is much more
> comfortable. However I only saw examples how to use that with
> asynchronous proxies. How can I find out information about the
> methods generated for synchronous proxies? I'm still using
> JavaScript.
The API
<http://www.xulplanet.com/references/objref/WebServiceProxyFactory.html>
shows a parameter isAsync for createProxyAsync.
When I create an asynchronous proxy as follows:
var webServiceProxyListener = {
BabelFishCallback: function (translation) {
alert('typeof translation: ' + (typeof translation) + ';
translation: ' + translation);
}
};
var webServiceProxyFactory = new WebServiceProxyFactory();
webServiceProxyFactory.createProxyAsync(
'http://www.xmethods.net/sd/2001/BabelFishService.wsdl',
'BabelFishPort',
'',
true,
{ onLoad: function (webServiceProxy) {
webServiceProxy.setListener(webServiceProxyListener);
webServiceProxy.BabelFish('en_pt', 'Do you have the key?');
}
}
);
then I get a translation back, however when I try to create a
synchronous proxy as follows:
var webServiceProxyFactory = new WebServiceProxyFactory();
webServiceProxyFactory.createProxyAsync(
'http://www.xmethods.net/sd/2001/BabelFishService.wsdl',
'BabelFishPort',
'',
false,
{ onLoad: function (webServiceProxy) {
var translation = webServiceProxy.BabelFish('en_pt', 'Do you have
the key?');
alert('typeof translation: ' + (typeof translation) + ';
translation: ' + translation);
},
onError: function (error) {
alert('Error: ' + error);
}
}
);
I get an alert showing the return value of the web service method call
(e.g. webServiceProxy.BabelFish(...)) as a string but the string is empty.
--
Martin Honnen
http://JavaScript.FAQTs.com/