Calling a web service from JS function

pushpa

Beta member
Messages
1
i'm developing an application based on XUL.in the JS file i write a function to invoke a web service,i'm able to call the web service but when i call the getParameters function on the returned object to retrieve the returned SOAPParameters it throws an exception: Component returned failure code:0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsISOAPMessage.getParameters] nsresult:0x80070057 (NS_ERROR_ILLEGAL_VALUE)

my js function which calls the web service is as follows:
var soapVersion = 0;
var transportURI = "http://localhost:8080/ogsa/services/progtutorial/core/first/HelloService";
function getValueOf( )
{
var method = "getValue";
var name="Hello";
var headers = new Array( );
var params = new Array(new SOAPParameter(name,"name"));
var object="http://www.globus.org/namespaces/2004/02/progtutorial/HelloService";
var call = Components.classes["@mozilla.org/xmlextras/soap/call;1"].createInstance();
var r;
try{

if (call instanceof Components.interfaces.nsISOAPCall){
call.transportURI = transportURI;
call.encode(0,method,object,headers.length,headers,params.length,params);
r=call.invoke();
}

if(r.fault)
alert("Error "+r.fault.faultString);
else{
var response = new Array();
response = r.getParameters(false,new Array());
alert("params " +params);
}


}catch(e){

alert( e );
}
}

getValue is the name of the method in my web service which takes one argument and returns a string .
Is object the targetNamespace which is in the wsdl file? if no, what should be the object.
i have given the object as the targetNamespace which is in my wsdl file.
can anyone please tell me what is wrong with the code

Thanx & Regards,
Pushpa
 
Back
Top Bottom