You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by penguin <ph...@yahoo.com> on 2002/09/25 11:07:59 UTC

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().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:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: InterOp. between Java Client and .NET Web Service and vice versa

Posted by Scott Nichol <sn...@scottnichol.com>.
The doclit example is hard-coded to a particular public service URL.  If
that service is down, or if you need to go through a proxy, the sample
will fail as written.  Hopefully, the proxy problem will be taken care
of shortly.

The method call

    call.setDocLitSerialization(true);

specifies literal serialization.  It is not a smart implementation: it
simply suppresses generation of xsi:type and encodingStyle attributes.
It does not actually read WSDL, and it will not generate xsi:type where
it is required, e.g. where the WSDL specifies xsi:anyType.  Regardless,
it provides interop for at least 90% of the document/literal services
I've seen.

As was mentioned in a separate posting, using RPC encoding in your .NET
services improves interoperability across the many SOAP implementations
that exist.

Scott Nichol

----- Original Message -----
From: "penguin" <ph...@yahoo.com>
To: <so...@xml.apache.org>
Sent: Thursday, September 26, 2002 6:04 AM
Subject: Re: InterOp. between Java Client and .NET Web Service and vice
versa


> Thanks so much for yours helping.
> The VB Client works well :-)
> And about Java Client Code> I realized that the doclit
> example is as same as my Java Client Code, except the
> line:
> call.setDocLitSerialization(true);
> What is it used for ?
>
> P/s: I cannot run the doclit example, it tells that:
> "Caught SOAPException (SOAP-ENV:Client): Error opening
> socket: java.net.ConnectException: Operation timed
> out: connect" :-(
>
> __________________________________________________
> Do you Yahoo!?
> New DSL Internet Access from SBC & Yahoo!
> http://sbc.yahoo.com
>
> --
> To unsubscribe, e-mail:
<ma...@xml.apache.org>
> For additional commands, e-mail:
<ma...@xml.apache.org>
>
>


Re: InterOp. between Java Client and .NET Web Service and vice versa

Posted by Scott Nichol <sn...@scottnichol.com>.
The doclit example is hard-coded to a particular public service URL.  If
that service is down, or if you need to go through a proxy, the sample
will fail as written.  Hopefully, the proxy problem will be taken care
of shortly.

The method call

    call.setDocLitSerialization(true);

specifies literal serialization.  It is not a smart implementation: it
simply suppresses generation of xsi:type and encodingStyle attributes.
It does not actually read WSDL, and it will not generate xsi:type where
it is required, e.g. where the WSDL specifies xsi:anyType.  Regardless,
it provides interop for at least 90% of the document/literal services
I've seen.

As was mentioned in a separate posting, using RPC encoding in your .NET
services improves interoperability across the many SOAP implementations
that exist.

Scott Nichol

----- Original Message -----
From: "penguin" <ph...@yahoo.com>
To: <so...@xml.apache.org>
Sent: Thursday, September 26, 2002 6:04 AM
Subject: Re: InterOp. between Java Client and .NET Web Service and vice
versa


> Thanks so much for yours helping.
> The VB Client works well :-)
> And about Java Client Code> I realized that the doclit
> example is as same as my Java Client Code, except the
> line:
> call.setDocLitSerialization(true);
> What is it used for ?
>
> P/s: I cannot run the doclit example, it tells that:
> "Caught SOAPException (SOAP-ENV:Client): Error opening
> socket: java.net.ConnectException: Operation timed
> out: connect" :-(
>
> __________________________________________________
> Do you Yahoo!?
> New DSL Internet Access from SBC & Yahoo!
> http://sbc.yahoo.com
>
> --
> To unsubscribe, e-mail:
<ma...@xml.apache.org>
> For additional commands, e-mail:
<ma...@xml.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: InterOp. between Java Client and .NET Web Service and vice versa

Posted by penguin <ph...@yahoo.com>.
Thanks so much for yours helping.
The VB Client works well :-)
And about Java Client Code> I realized that the doclit
example is as same as my Java Client Code, except the
line:
call.setDocLitSerialization(true);
What is it used for ?

P/s: I cannot run the doclit example, it tells that:
"Caught SOAPException (SOAP-ENV:Client): Error opening
socket: java.net.ConnectException: Operation timed
out: connect" :-(

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: InterOp. between Java Client and .NET Web Service and vice versa

Posted by penguin <ph...@yahoo.com>.
Thanks so much for yours helping.
The VB Client works well :-)
And about Java Client Code> I realized that the doclit
example is as same as my Java Client Code, except the
line:
call.setDocLitSerialization(true);
What is it used for ?

P/s: I cannot run the doclit example, it tells that:
"Caught SOAPException (SOAP-ENV:Client): Error opening
socket: java.net.ConnectException: Operation timed
out: connect" :-(

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

Re: InterOp. between Java Client and .NET Web Service and vice versa

Posted by Scott Nichol <sn...@scottnichol.com>.
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" <ph...@yahoo.com>
To: <so...@xml.apache.org>
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:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
>


Re: InterOp. between Java Client and .NET Web Service and vice versa

Posted by Scott Nichol <sn...@scottnichol.com>.
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" <ph...@yahoo.com>
To: <so...@xml.apache.org>
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:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


RE: InterOp. between Java Client and .NET Web Service and vice versa

Posted by Jean-Louis Vila <jl...@cosmosbay.com>.
Hi,

First :
	Java client -> .NET

	In .NET, your WS is wrote in document Style
	Your Java client usr RPC style !!!
	So if you use same SOAP style invocation, all will work fine.

	To see if the SOAP message is ok, you can use the wonderful
	tool : TCPMon or TCPTunnel.

Second :
	VBS client -> Java

	put this attribute on <body> element.
   		SOAP-ENV:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/"
And try again,

Jean-Louis

-----Message d'origine-----
De : penguin [mailto:philaile@yahoo.com]
Envoye : mercredi 25 septembre 2002 11:08
A : soap-user@xml.apache.org
Objet : 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:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


RE: InterOp. between Java Client and .NET Web Service and vice versa

Posted by Jean-Louis Vila <jl...@cosmosbay.com>.
Hi,

First :
	Java client -> .NET

	In .NET, your WS is wrote in document Style
	Your Java client usr RPC style !!!
	So if you use same SOAP style invocation, all will work fine.

	To see if the SOAP message is ok, you can use the wonderful
	tool : TCPMon or TCPTunnel.

Second :
	VBS client -> Java

	put this attribute on <body> element.
   		SOAP-ENV:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/"
And try again,

Jean-Louis

-----Message d'origine-----
De : penguin [mailto:philaile@yahoo.com]
Envoye : mercredi 25 septembre 2002 11:08
A : soap-user@xml.apache.org
Objet : 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:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>