Women in Technology

Hear us Roar



Article:
  Using the Mozilla SOAP API
Subject:   Calling a web service
Date:   2005-05-25 04:05:54
From:   Pushpa.Gorak
Response to: Security issues when using Mozilla 1.3b

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://192.168.1.234: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,{});
alert("params " +params);
}



}catch(e){


alert( e );
}
}


getValue is the name of the method in my web service which takes an argument.
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

Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • Calling a web service
    2007-01-11 06:24:49  hassankth [View]

    If you're using the a Microsfot .Net Webservice i suggest that you use the SOAPMessage to get all the details. Since the returned response is a soap message. You can easily process this xml data with even knowing the exact names of returned elements. Well they are mentioned in wsdl i know.
    Anyway here is the sample techique to do this all.

    var resultParams = wsResponse.message;
    var xmlsr = new XMLSerializer();
    var strmsg = xmlsr.serializeToString(resultParams);
    var parser = new DOMParser();
    var dom = arser.parseFromString(strmsg,"text/xml");

    Now you can use the getElementByTagName method to get the Body tag, and in a loop you can get all the results.

    I hope i'm able to explain.
    Cheers.
  • Calling a web service
    2007-01-11 06:19:52  hassankth [View]

    If you're using the a Microsfot .Net Webservice i suggest that you use the SOAPMessage to get all the details. Since the returned response is a soap message. You can easily process this xml data with even knowing the exact names of returned elements. Well they are mentioned in wsdl i know.
    Anyway here is the sample techique to do this all.

    var resultParams = wsResponse.message;
    var xmlsr = new XMLSerializer();
    var strmsg = xmlsr.serializeToString(resultParams);
    var parser = new DOMParser();
    var dom = arser.parseFromString(strmsg,"text/xml");

    Now you can use the getElementsByTagName method to get the Body tag, and in a loop you can get all the results.

    I hope i'm able to explain.
    Cheers.