Hi all, Please take a look and help me solving 2 problems below: First: between Java Client and .NET Web Service
- .NET Service Code: namespace SoapExample { public class SimpleService:System.Web.Services.WebService { public SimpleService(){ } protected override void Dispose(bool disposing){ } [System.Web.Services.WebMethod] public string echo(string str){ return "Received: " + str; } } } if I run this service from web browser (http://localhost/SoapExample/Service1.asmx?op=echo), evrything is OK. It means that I received: <?xml version="1.0" encoding="utf-8" ?> <string xmlns="http://tempuri.org/">Received: myStringHere</string> But if i use Java Client Code: public static void main(String[] args) throws Exception{ try{ URL url = new URL("http://localhost/SoapExample/Service1.asmx"); String name = "MyStringHere"; SOAPMappingRegistry smc = new SOAPMappingRegistry(); StringDeserializer sd = new StringDeserializer(); smc.mapTypes(Constants.NS_URI_SOAP_ENC, new QName("http://tempuri.org/","echoResult"),String.class,null,null,sd); SOAPHTTPConnection st = new SOAPHTTPConnection(); Call myCall = new Call(); myCall.setSOAPTransport(st); myCall.setSOAPMappingRegistry(smc); myCall.setTargetObjectURI("http://tempuri.org/"); myCall.setMethodName("echo"); myCall.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC); Vector params = new Vector(); params.addElement(new Parameter("str",String.class,name,Constants.NS_URI_SOAP_ENC)); myCall.setParams(params); Response resp = null; try{ resp = myCall.invoke(url,"http://tempuri.org/echo"); }catch(SOAPException sex){ System.err.println("Caught SoapException: ("+ sex.getFaultCode()+" ): " + sex.getMessage() ); System.exit(-1); } if((!resp.generatedFault()) && (resp != null)){ System.out.println(resp.getBodyPart(resp.getPartCount()-1).getContent().toString()); }else{ Fault fault = resp.getFault(); System.err.println("Generate Fault: "); System.err.println(" Code : " + fault.getFaultCode()); System.err.println(" String: " + fault.getFaultString()); } }catch(Exception e){ e.printStackTrace(); } } I received this strange result: <?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>Received: </echoResult> </echoResponse> </soap:Body> </soap:Envelope> I expected to reveive "Received: MyStringHere", but the "str" value disappeared. So my question is: WHERE was the "str" value ()? Why did it happend ? Second: In other hand, i do a contrary example, use Apache SOAP Web Service with VB Client code: Class test.SoapExample public class SoapExample { public SoapExample() { } public String echo(String str){ return str; } } test.vbs: myWebService ="http://localhost:8080/soap/servlet/rpcrouter" myMethod = "http://tempuri.org/echo" s = "" s = s & "<?xml version=""1.0"" encoding=""utf-8""?>" & vbCrLf s = s & "<SOAP-ENV:Envelope " s = s & " xmlns:xsi=""http://www.w3c.org/2001/XMLSchema-instance""" s = s & " xmlns:xsd=""http://www.w3c.org/2001/XMLSchema""" s = s & " xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/"">" & vbCrLf s = s & "<SOAP-ENV:Header>" & vbCrLf s = s & "</SOAP-ENV:Header>" & vbCrLf s = s & "<SOAP-ENV:Body>" & vbCrLf s = s & " <echo xmlns=""http://tempuri.org/"" SOAP-ENV:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/"">" & vbCrLf s = s & " <str xsi:type=""xsd:string"">MyStringHere</str>" & vbCrLf s = s & " </echo>" & vbCrLf s = s & " </SOAP-ENV:Body>" & vbCrLf s = s & "</SOAP-ENV:Envelope>" & vbCrLf MsgBox(s) set requestHTTP = CreateObject("Microsoft.XMLHTTP") requestHTTP.open "POST", myWebService, False requestHTTP.setrequestheader "Content-Type", "text/xml;charset=utf-8" requestHTTP.setrequestheader "SOAPAction", myMethod requestHTTP.Send s set responseDoc = requestHTTP.responseXML MsgBox(responseDoc.xml) set requestHTTP = nothing and after deploying the service: i have this info in http://localhost:8080/soap/admin/index.html 'http://tempuri.org' Service Deployment Descriptor Property Details: ID: http://tempuri.org Scope: Application Provider Type: java Provider Class: test.SoapExample Use Static Class: false Methods: echo Type Mappings: Default Mapping Registry Class: But i get the error when i run test.vbs <?xml version="1.0"> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3c.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3c.org/2001/XMLSchema"> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Client</faultcode> <faultstring>No Deserializer found to deserialize a "http://tempuri.org:str" using encoding style "http://schemas.xmlsoap.org/soap/encoding/".</faultstring> <faultactor>/soapo/servlet/rpcrouter</faultactor> </SOAP-ENV:Fault> </SOAP-ENV:Body> How could i solve this problem ? Please help me. Thanks in advance. P/s: if i use java client interacting with Apache Soap Web service, and use test.vbs interacting with .NET Web service, everything is OK. __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>