java client accessing to .NET WebService - interop problem in SOAP message


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: java client accessing to .NET WebService - interop problem in SOAP message

  1. #1
    tyris Guest

    java client accessing to .NET WebService - interop problem in SOAP message


    i read all SOAP documentation... in fact my question is more about interoperability...
    I generated XML with the tool Castor (xml2java2xml data binding). when i
    hard code a SOAP message with the enveloppe and just add my XML in the body
    it works fine, i even sent complex types like datasets.

    the problem is that when i generate the SOAP (with the code below) the SOAP
    message isn't like what is expecting .NET, (i read many documentation about
    xsd and co it's not the problem), i followed each recomandations found on
    SOAP doc, mailing list archives and so on, but the problem is not solved
    : i get this error :
    Caught SOAPException (SOAP-ENV:Client): No Deserializer found to deserialize
    a 'http://tempuri.org/:BonjourResult' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.


    i tryed to change the encoding, but it's even worse, or in some cases there
    is no error but the .NET webservice doesn't understand my string and can't
    return it... my java to java webservices have always worked fine... but i
    was wondering if there is maybe a solution to generate a SOAP message that
    could be understandable by .NET
    I guess that the solution could be in the marshaller, i read many do about
    it, but i'm not able to make it works !


    ======================
    here is the code that works : hard code
    StringBuffer payload =
    new StringBuffer("<?xml version=\'1.0\' encoding=\'UTF-8\'?>");
    payload.append(
    "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
    xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">");
    payload.append("<soap:Body>");
    payload.append("<WS_UpdateProfileAgency xmlns=\"http://tempuri.org/\">");
    payload.append("<dsComp>");
    .......
    URL endpoint = new URL(server + "/PCS_Integration/SynchronizeProfiles.asmx");
    URLConnection con = endpoint.openConnection();
    con.setDoInput(true);
    con.setDoOutput(true);
    con.setUseCaches(false);
    con.setAllowUserInteraction(false);
    con.setRequestProperty("Content-Length", Integer.toString(request.length));
    con.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
    con.setRequestProperty(
    "SOAPAction","\"http://tempuri.org/WS_UpdateProfileAgency\"");
    OutputStream out = con.getOutputStream();
    out.write(request);
    .......





    ======================
    here is the SOAP message generation that doesn't work but should ;-)

    SOAPMappingRegistry smr = new SOAPMappingRegistry ();
    StringDeserializer sd = new StringDeserializer ();
    smr.mapTypes(Constants.NS_URI_SOAP_ENC ,new QName("http://tempuri.org/","BonjourResult"),null,null,sd);

    SOAPHTTPConnection st = new SOAPHTTPConnection();

    Call call = new Call ();
    call.setSOAPTransport(st);
    call.setSOAPMappingRegistry (smr);

    call.setTargetObjectURI ("http://tempuri.org/");
    call.setMethodName("Bonjour");
    call.setEncodingStyleURI (Constants.NS_URI_SOAP_ENC);


    Vector params = new Vector();
    Parameter pTheByte = new Parameter("strName", String.class, "elise", null);
    params.addElement(pTheByte);
    call.setParams(params)
    Response resp = null;
    try {
    resp = call.invoke (url, "http://tempuri.org/Bonjour");
    .......




  2. #2
    Narinder Makin Guest

    Re: java client accessing to .NET WebService - interop problem in SOAP message


    I am getting a similar error?
    Did you find any solution to it?

    thanks.




    "tyris" <kea@mailcity.com> wrote:
    >
    >i read all SOAP documentation... in fact my question is more about interoperability...
    >I generated XML with the tool Castor (xml2java2xml data binding). when i
    >hard code a SOAP message with the enveloppe and just add my XML in the body
    >it works fine, i even sent complex types like datasets.
    >
    >the problem is that when i generate the SOAP (with the code below) the SOAP
    >message isn't like what is expecting .NET, (i read many documentation about
    >xsd and co it's not the problem), i followed each recomandations found on
    >SOAP doc, mailing list archives and so on, but the problem is not solved
    >: i get this error :
    >Caught SOAPException (SOAP-ENV:Client): No Deserializer found to deserialize
    >a 'http://tempuri.org/:BonjourResult' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.
    >
    >
    >i tryed to change the encoding, but it's even worse, or in some cases there
    >is no error but the .NET webservice doesn't understand my string and can't
    >return it... my java to java webservices have always worked fine... but

    i
    >was wondering if there is maybe a solution to generate a SOAP message that
    >could be understandable by .NET
    >I guess that the solution could be in the marshaller, i read many do about
    >it, but i'm not able to make it works !
    >
    >
    >======================
    >here is the code that works : hard code
    > StringBuffer payload =
    > new StringBuffer("<?xml version=\'1.0\' encoding=\'UTF-8\'?>");
    > payload.append(
    > "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
    >xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">");
    > payload.append("<soap:Body>");
    > payload.append("<WS_UpdateProfileAgency xmlns=\"http://tempuri.org/\">");
    > payload.append("<dsComp>");
    > .......
    > URL endpoint = new URL(server + "/PCS_Integration/SynchronizeProfiles.asmx");
    > URLConnection con = endpoint.openConnection();
    > con.setDoInput(true);
    > con.setDoOutput(true);
    > con.setUseCaches(false);
    > con.setAllowUserInteraction(false);
    > con.setRequestProperty("Content-Length", Integer.toString(request.length));
    > con.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
    > con.setRequestProperty(
    > "SOAPAction","\"http://tempuri.org/WS_UpdateProfileAgency\"");
    > OutputStream out = con.getOutputStream();
    > out.write(request);
    > .......
    >
    >
    >
    >
    >
    >======================
    >here is the SOAP message generation that doesn't work but should ;-)
    >
    > SOAPMappingRegistry smr = new SOAPMappingRegistry ();
    > StringDeserializer sd = new StringDeserializer ();
    > smr.mapTypes(Constants.NS_URI_SOAP_ENC ,new QName("http://tempuri.org/","BonjourResult"),null,null,sd);
    >
    > SOAPHTTPConnection st = new SOAPHTTPConnection();
    >
    > Call call = new Call ();
    > call.setSOAPTransport(st);
    > call.setSOAPMappingRegistry (smr);
    >
    > call.setTargetObjectURI ("http://tempuri.org/");
    > call.setMethodName("Bonjour");
    > call.setEncodingStyleURI (Constants.NS_URI_SOAP_ENC);
    >
    >
    > Vector params = new Vector();
    > Parameter pTheByte = new Parameter("strName", String.class, "elise", null);
    > params.addElement(pTheByte);
    > call.setParams(params)
    > Response resp = null;
    > try {
    > resp = call.invoke (url, "http://tempuri.org/Bonjour");
    > .......
    >
    >
    >



  3. #3
    Stephen Green Guest

    Re: java client accessing to .NET WebService - interop problem in SOAP message


    "tyris" <kea@mailcity.com> wrote:
    >
    >i read all SOAP documentation... in fact my question is more about interoperability...
    >I generated XML with the tool Castor (xml2java2xml data binding). when i
    >hard code a SOAP message with the enveloppe and just add my XML in the body
    >it works fine, i even sent complex types like datasets.
    >
    >the problem is that when i generate the SOAP (with the code below) the SOAP
    >message isn't like what is expecting .NET, (i read many documentation about
    >xsd and co it's not the problem), i followed each recomandations found on
    >SOAP doc, mailing list archives and so on, but the problem is not solved
    >: i get this error :
    >Caught SOAPException (SOAP-ENV:Client): No Deserializer found to deserialize
    >a 'http://tempuri.org/:BonjourResult' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.
    >
    >
    >i tryed to change the encoding, but it's even worse, or in some cases there
    >is no error but the .NET webservice doesn't understand my string and can't
    >return it... my java to java webservices have always worked fine... but

    i
    >was wondering if there is maybe a solution to generate a SOAP message that
    >could be understandable by .NET
    >I guess that the solution could be in the marshaller, i read many do about
    >it, but i'm not able to make it works !
    >
    >
    >======================
    >here is the code that works : hard code
    > StringBuffer payload =
    > new StringBuffer("<?xml version=\'1.0\' encoding=\'UTF-8\'?>");
    > payload.append(
    > "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
    >xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">");
    > payload.append("<soap:Body>");
    > payload.append("<WS_UpdateProfileAgency xmlns=\"http://tempuri.org/\">");
    > payload.append("<dsComp>");
    > .......
    > URL endpoint = new URL(server + "/PCS_Integration/SynchronizeProfiles.asmx");
    > URLConnection con = endpoint.openConnection();
    > con.setDoInput(true);
    > con.setDoOutput(true);
    > con.setUseCaches(false);
    > con.setAllowUserInteraction(false);
    > con.setRequestProperty("Content-Length", Integer.toString(request.length));
    > con.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
    > con.setRequestProperty(
    > "SOAPAction","\"http://tempuri.org/WS_UpdateProfileAgency\"");
    > OutputStream out = con.getOutputStream();
    > out.write(request);
    > .......
    >
    >
    >
    >
    >
    >======================
    >here is the SOAP message generation that doesn't work but should ;-)
    >
    > SOAPMappingRegistry smr = new SOAPMappingRegistry ();
    > StringDeserializer sd = new StringDeserializer ();
    > smr.mapTypes(Constants.NS_URI_SOAP_ENC ,new QName("http://tempuri.org/","BonjourResult"),null,null,sd);
    >
    > SOAPHTTPConnection st = new SOAPHTTPConnection();
    >
    > Call call = new Call ();
    > call.setSOAPTransport(st);
    > call.setSOAPMappingRegistry (smr);
    >
    > call.setTargetObjectURI ("http://tempuri.org/");
    > call.setMethodName("Bonjour");
    > call.setEncodingStyleURI (Constants.NS_URI_SOAP_ENC);
    >
    >
    > Vector params = new Vector();
    > Parameter pTheByte = new Parameter("strName", String.class, "elise", null);
    > params.addElement(pTheByte);
    > call.setParams(params)
    > Response resp = null;
    > try {
    > resp = call.invoke (url, "http://tempuri.org/Bonjour");
    > .......
    >
    >
    >




    At last I've found a site to answer this

    try:
    http://msdn.microsoft.com/library/de...tnetarch11.asp

    I've yet to try the microsoft solution but it's the best help I've seen so
    far


  4. #4
    Join Date
    Mar 2007
    Posts
    1

    Cool java client accessing to .NET WebService - interop problem in SOAP message

    While I haven't used Java to connect to a .NET WebService, I do know that there are two different camps with WebServices and how the data is passed back and forth.

    Microsoft uses Document Literal and Java uses RPC Literal(Or ViceVersa, Guess MS just had to be different ) There is a document on MSDN that talks about how to edit the WSDL and will make the .NET WebService compatible with both JAVA and MS, but I havent used or followed it thusfar. Best of luck.

    Nick

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center