On Fri, 2002-10-18 at 18:14, [EMAIL PROTECTED] wrote:
> Hi,
>   I'm trying to invoke a web service from javascript using the mozilla
> implementation (the only one? I don't know). But mozilla don't send the
> SOAPAction header when invoking the service, and therefore axis is not happy. Is
> someone here has encountered the same problem?
> Thanks
> Lionel


I used mozilla soap to breadboard an app.  There were a couple
of glitches along the way.  Some were solvable, some weren't.
But making simple calls to a webservice is doable.  Below
is one of the javascript functions I wrote to call an
axis web service.  I haven't tested this code in a couple of
months so it may not function in the 1.0 or RC environments.

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

function getDataSourceChildNodes(id) {
        if (! parent.sessionId)
                getSessionId();
        // build up array of parameters to call with
        var parameterInArray = new Array();
        var sessionIdParameter = new SOAPParameter(parent.sessionId,
"sessionId");
        var idParameter = new SOAPParameter(id, "dataSourceId");
        parameterInArray[0] = sessionIdParameter;
        parameterInArray[1] = idParameter;
        // prepare soap call
        var soapCall = new SOAPCall();
        soapCall.transportURI = "http://"; + location.hostname +
"/TheDataWeb_Services/servlet/AxisServlet";
        soapCall.actionURI = "getDataSourceChildNodes";
        soapCall.encode(0, "getDataSourceChildNodes", "urn:ferrett", 0, null,
parameterInArray.length, parameterInArray);
        // make the call
        var soapResponse = soapCall.invoke();
        // test for fault
        var soapFault = soapResponse.fault;
        if (soapFault != null) {
                var faultNameSpace = soapFault.faultNamespace;
                var faultCode = soapFault.faultCode;
                var faultSummary = soapFault.faultString;
                var faultActor = soapFault.actorURI;
                alert("getDataSourceChildNodes failed: " + faultSummary);
                return null;
        }
        // get response parameters
        var parameterOutArray = soapResponse.getParameters(false, {});
        if (parameterOutArray.length != 1) {
                alert("wrong number of returned parameters, expected 1, found " +
parameterOutArray.length);
                return null;
        }
        var response = parameterOutArray[0];
        return response.value;
}


Reply via email to