Java client and .NET Web service -------------------------------- If you look at your WSDL, you will see that it specifies "literal" encoding. Apache SOAP by default uses "encoded" encoding. Your service is ignoring the parameter that is sent to it because that parameter has an xsi:type attribute. You can suppress this attribute if you use a nightly drop of Apache SOAP, in which case you can specify that it should use "doclit" encoding. See the doclit sample.
VB client and Java Web service ------------------------------ You may want to consider using the SOAP Toolkit. See, e.g., http://www.scottnichol.com/vbclientapachesoap.htm. As for your current code, I do not see why it does not work, and I simply don't have time right now to try it out for myself. Scott Nichol ----- Original Message ----- From: "penguin" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, September 25, 2002 05:07 Subject: InterOp. between Java Client and .NET Web Service and vice versa > 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().toSt ring()); > }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]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>