Hello all,
I have spent the last several hours scouring the mailing list archives for an answer to this problem, but haven't had any luck. It does not appear that my Apache-SOAP client is successfully sending its parameters with the method call. The method call is successfully invoked, and (using the xsi:type code that has been mentioned in this list) have been able to successfully get the return value. I have even tried the hack that was mentioned at one point about prepending "ns1:" to the input parameter to fool .NET into thinking that the parameter was namespace qualified, but it didn't seem to work. Has anyone else experienced this problem? Any solutions out there? Am I doing something stupid? I had high hopes for real-life interoperablity, but I'm not having much luck so far... (Please note before you respond that this is not the "Apache wants an xsi:type attribute" problem.) I am using Apache SOAP 2.2 and Visual Studio .NET Beta 2. My service, at this point, is basically just a string echo, prepending "Here is your message:" to the beginning of it. (This makes it obvious when the service simply isn't returing anything.) The message going out looks like this (As returned by TcpTunnelGui): POST /TestService2/Service1.asmx HTTP/1.0 Host: localhost Content-Type: text/xml; charset=utf-8 Content-Length: 433 SOAPAction: "http://tempuri.org/echo" <?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <SOAP-ENV:Body> <ns1:echo xmlns:ns1="urn:Service1" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <arg xsi:type="xsd:string">Foo!</arg> </ns1:echo> </SOAP-ENV:Body> </SOAP-ENV:Envelope> But the return data isn't picking anything up from the 'arg' parameter: HTTP/1.1 200 OK Server: Microsoft-IIS/5.0 Date: Thu, 15 Nov 2001 07:20:02 GMT Cache-Control: private, max-age=0 Content-Type: text/xml; charset=utf-8 Content-Length: 415 <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <echoResponse xmlns="http://tempuri.org/"> <echoResult>Here is your message: </echoResult> </echoResponse> </soap:Body> </soap:Envelope> The C# code, for what its worth, just does this: [WebMethod] public string echo (string arg) { return("Here is your message: " + arg); } And, here is the relevant Apache-SOAP client code: URL url = new URL("http://localhost:8000/TestService2/Service1.asmx"); SOAPMappingRegistry smr = new SOAPMappingRegistry(); StringDeserializer sd = new StringDeserializer(); Call call = new Call(); smr.mapTypes(Constants.NS_URI_SOAP_ENC, new QName("http://tempuri.org/", "echoResult", null, null, sd); call.setSOAPMappingRegistry(smr); call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC); call.setTargetObjectURI("urn:Service1"); call.setMethodName("echo"); Vector params = new Vector(); params.addElement(new Parameter("arg", String.class, new String("Foo!"), null)); call.setParams(params); Response resp = call.invoke(url, "http://tempuri.org/echo"); if (resp.generatedFault()) { Fault fault = resp.getFault(); System.out.println("Ack! There was a fault: " + fault.getFaultCode() + " - " + fault.getFaultString()); return; } Parameter ret = resp.getReturnValue(); Object value = ret.getValue(); System.out.println(value); Thanks in advance.... Ryan Adams
