If you control the code for the .NET service and want it to interoperate
best with Apache SOAP, you need to use the SoapRpcService attribute on
the class. By default, a .NET WebService class uses document/literal
encoding. This is great for interoperation with other WSDL-based
implementations, but makes interoperation difficult (or impossible) for
SOAP implementations, like Apache SOAP, that are not WSDL-based.
The current build of Apache SOAP includes enough facilities for faking
document/literal that it can be used to interop with most .NET services,
but I still recommend using SoapRpcService for any .NET services you
write.
Scott Nichol
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Thursday, October 24, 2002 4:33 PM
Subject: Re: SOAP Client code using VB/VC
> I am trying to build a simple SOAP Java client consuming a VB.NET Web
> service. The Web service performs three simple operations. It is
working
> fine.
>
> <WebMethod()> Public Function Hello(ByVal name As String) As
String
> Hello = "Hello, " + name
> End Function
> <WebMethod()> Public Function HelloWorld() As String
> HelloWorld = "Hello World!"
> End Function
> <WebMethod()> Public Function addNumbers(ByVal NumberOne As
Double, ByVal NumberTwo As Double) As Double
> addNumbers = NumberOne + NumberTwo
> End Function
>
> But, on the Java client side, the first operation is ok in returning
> "Hello World!". The other two operation testing is not ok, returning
value
> is not correct.
>
> The following is the source for AddNumbersClient:
> class AddNumbersClient
> {
>
> public static void main(String[] args) throws Exception
> {
>
> URL url = new URL
>
("http://130.140.64.242/AddNumbersWebService/AddNumberService.asmx?op=ad
dNumbers");
>
> SOAPMappingRegistry smr = new SOAPMappingRegistry ();
> DoubleDeserializer sd = new DoubleDeserializer ();
> smr.mapTypes (Constants.NS_URI_SOAP_ENC,
> new QName ("http://tempuri.org",
"addNumbersResult"),
> null, null, sd);
>
> // create the transport and set parameters
> SOAPHTTPConnection st = new SOAPHTTPConnection();
>
>
> // build the call.
> Call call = new Call ();
> call.setSOAPTransport(st);
> call.setSOAPMappingRegistry (smr);
>
> call.setTargetObjectURI ("http://tempuri.org");
> call.setMethodName("addNumbers");
> call.setEncodingStyleURI
> ("http://schemas.xmlsoap.org/soap/encoding/");
>
> Vector params = new Vector();
> params.addElement(new Parameter("NumberOne",
Double.class,
> "10", Constants.NS_URI_SOAP_ENC));
> params.addElement(new Parameter("NumberTwo",
Double.class,
> "25", Constants.NS_URI_SOAP_ENC));
> call.setParams(params);
>
> Response resp = null;
> try
> {
> resp = call.invoke (url, "http://tempuri.org/addNumbers");
> }
> catch (SOAPException e)
> {
> System.err.println("Caught SOAPException (" +
> e.getFaultCode () + "): " +
> e.getMessage ());
> return;
> }
>
> if (resp == null)
> {
> System.out.println("Response was null");
> }
>
> // check response
> if (resp != null && !resp.generatedFault())
> {
> Parameter ret = resp.getReturnValue();
> Object value = ret.getValue();
>
> System.out.println ("Answer--> " + value);
> }
> else {
> Fault fault = resp.getFault ();
> System.err.println ("Generated fault: ");
> System.out.println (" Fault Code = " + fault.getFaultCode());
> System.out.println (" Fault String = " +
fault.getFaultString());
> }
> }
> }
>
> My guess is the encoding setting is not working on the parameter part.
>
> Can anyone help me? Thanks in advance,
>
> Jingkun
--
To unsubscribe, e-mail: <mailto:soap-dev-unsubscribe@;xml.apache.org>
For additional commands, e-mail: <mailto:soap-dev-help@;xml.apache.org>