Hi there,
 
I'm trying to deploy a web-service using Microsoft .NET, and using Apache Soap to make a soap request to the web-service. Here comes the questions. When a client makes a request, server can understand the request and process it. But client can't understand the soap message that server responds. Below are the error message:
 
Caught SOAPException (SOAP-ENV:Client): No Deserializer found to deserialize a
'http://tempuri.org/:result' using encoding style 'http://schemas.xmlsoap.org/s
oap/encoding/'.
 
I've seen many people ask this question before, and I know it is the interoperability problem between each SOAP implementations. But I still can't solve this problem. Below are my client program:
=================
client programe
=================
import java.io.*;
import java.util.*;
import java.net.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.encoding.*;
import org.apache.soap.encoding.soapenc.*;
import org.apache.soap.rpc.*;

public class test1
{
   public test1()
   {
      try
      {
        
        
         URL rurl = new URL("http://localhost:2020/math/WebSrv_Math.asmx");
                  
         Call call = new Call ();
         call.setTargetObjectURI ("http://tempuri.org/");
     
         call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
     
         SOAPMappingRegistry smr = new SOAPMappingRegistry();
         StringDeserializer sd = new StringDeserializer();
    
         smr.mapTypes(Constants.NS_URI_SOAP_ENC,new QName("","Result"),null,null,sd);
         call.setSOAPMappingRegistry(smr);
        
         Vector params = new Vector ();
         params.addElement (new Parameter("ns1:num1", int.class, new Integer(4),null));
         params.addElement (new Parameter("ns1:num2", int.class, new Integer(7),null));
                       
         call.setParams (params);      
      
         Response resp;
 
         try
         {
            call.setMethodName ("Add");
            resp = call.invoke (/* router URL */ rurl, /* actionURI */"http://tempuri.org/Add"  );
         }
         catch (SOAPException se)
         {
            System.err.println("Caught 1 SOAPException (" +
            se.getFaultCode() + "): " +
            se.getMessage());
            return;
         }

         if (resp.generatedFault ())
         {
            Fault fault = resp.getFault ();
            System.out.println ("Ouch, the call failed: ");
            System.out.println ("  Fault Code   = " + fault.getFaultCode ()); 
            System.out.println ("  Fault String = " + fault.getFaultString ());
         }
         else
         {
            Parameter result = resp.getReturnValue ();
            String value=(String)result.getValue();
         }
         // Check the response.
      }catch (Exception ae) {}
   }
   public static void main(String args[])
   {
      test1 t=new test1();
   }
}
And below are the soap message that the web service responds:
===========
responds
===========
Cache-Control: private, max-age=0
Content-Type: text/xml
Content-Length: 389
 
<?xml version="1.0"?>
  <soap:Body>
    <AddResult xmlns="http://tempuri.org/">
      <result>11</result>
    </AddResult>
  </soap:Body>
</soap:Envelope>
 
Is there any thing wrong with my code?
 
Thanks
Enyu

Reply via email to