consuming java web service

Discussion in 'ASP .Net Web Services' started by Rafa Llarena, Apr 25, 2005.

  1. Rafa Llarena

    Rafa Llarena Guest

    Hi,

    I'm writting a code in C# which needs to consume a Java-written web service.
    This service was written in a RPC/Literal way, so I've used a tool I found
    (r2d) to transform the RPC/Literal wsdl into a Document/Literal, and from
    this wsdl I've generated the proxy class using wsdl.exe.
    The request works correctly, and the Java service returns the results I
    expect (I inspect the SOAP packet), but I'm not able to get the results out
    of this reponse. This is the reponse I get:

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
    <MethodResponse xmlns="urn:Mywebservices">
    <response xmlns="">
    <result>1</result>
    </response>
    </MethodResponse>
    </soapenv:Body>
    </soapenv:Envelope>

    The web method is called by a method generated by wsdl.exe and his return
    value is a MethodReponse object (MethodReponse class was also generated by
    wsdl.exe), but the object returned by this method is not like the one I've
    received (the one I expect regarding the SOAP reponse with the a "1" in the
    result field).
    It is an uninitialized object.
    Where could the problem be found?
    I hope I've explained myself properly.

    Rafa Llarena
     
    Rafa Llarena, Apr 25, 2005
    #1
    1. Advertising

  2. Rafa Llarena

    Rafa Llarena Guest

    The Java web service has been changed to Document/literal. So know, I just
    generate the proxy class with wsdl.exe and try to call the web method. The
    problem remains the same, so it is not a Document/RPC problem, but a code
    problem. Heres my code:

    {
    javaService js = new javaService();
    testMethod vReq = new testMethod();

    vReq.param1 = 1;

    reponseWS info = null;
    info = js.testMethod(vReq);
    int state = info.result;
    if (state = = 0) return false;
    else return true;
    }

    javaService is the class that represents the web service, testMethod is the
    class that represents the web method and reponseWS is the class that
    represents the web method return value. All this classes are generated by
    wsdl.exe.
    Although I inspect the SOAP reponse, and I can see "result"'s value is 1,
    the content of the "info" object is not the correct one. It's always 0, as
    if it's not even initialized.
    Maybe all this doesn' work the way I'm trying to do it.
    Anyone??

    Rafa Llarena



    "Rafa Llarena" <> escribió en el mensaje
    news:...
    > Hi,
    >
    > I'm writting a code in C# which needs to consume a Java-written web
    > service. This service was written in a RPC/Literal way, so I've used a
    > tool I found (r2d) to transform the RPC/Literal wsdl into a
    > Document/Literal, and from this wsdl I've generated the proxy class using
    > wsdl.exe.
    > The request works correctly, and the Java service returns the results I
    > expect (I inspect the SOAP packet), but I'm not able to get the results
    > out of this reponse. This is the reponse I get:
    >
    > <?xml version="1.0" encoding="UTF-8"?>
    > <soapenv:Envelope
    > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    >
    > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    > <soapenv:Body>
    > <MethodResponse xmlns="urn:Mywebservices">
    > <response xmlns="">
    > <result>1</result>
    > </response>
    > </MethodResponse>
    > </soapenv:Body>
    > </soapenv:Envelope>
    >
    > The web method is called by a method generated by wsdl.exe and his return
    > value is a MethodReponse object (MethodReponse class was also generated by
    > wsdl.exe), but the object returned by this method is not like the one I've
    > received (the one I expect regarding the SOAP reponse with the a "1" in
    > the result field).
    > It is an uninitialized object.
    > Where could the problem be found?
    > I hope I've explained myself properly.
    >
    > Rafa Llarena
    >
     
    Rafa Llarena, Apr 27, 2005
    #2
    1. Advertising

  3. Rafa Llarena

    Rafa Llarena Guest

    I've kept researching and I've arrived to the conclusion that the problem
    maybe in the return value of the web method. It returns a struct, and .NET
    seems to have a problem retrieving this struct. Am I wrong here? Is there
    anything I have to do when the web method's return type is a structure?
    If anyone has a clue, please, answer

    Rafa


    "Rafa Llarena" <> escribió en el mensaje
    news:OjZ%...
    > The Java web service has been changed to Document/literal. So know, I just
    > generate the proxy class with wsdl.exe and try to call the web method. The
    > problem remains the same, so it is not a Document/RPC problem, but a code
    > problem. Heres my code:
    >
    > {
    > javaService js = new javaService();
    > testMethod vReq = new testMethod();
    >
    > vReq.param1 = 1;
    >
    > reponseWS info = null;
    > info = js.testMethod(vReq);
    > int state = info.result;
    > if (state = = 0) return false;
    > else return true;
    > }
    >
    > javaService is the class that represents the web service, testMethod is
    > the class that represents the web method and reponseWS is the class that
    > represents the web method return value. All this classes are generated by
    > wsdl.exe.
    > Although I inspect the SOAP reponse, and I can see "result"'s value is 1,
    > the content of the "info" object is not the correct one. It's always 0, as
    > if it's not even initialized.
    > Maybe all this doesn' work the way I'm trying to do it.
    > Anyone??
    >
    > Rafa Llarena
    >
    >
    >
    > "Rafa Llarena" <> escribió en el mensaje
    > news:...
    >> Hi,
    >>
    >> I'm writting a code in C# which needs to consume a Java-written web
    >> service. This service was written in a RPC/Literal way, so I've used a
    >> tool I found (r2d) to transform the RPC/Literal wsdl into a
    >> Document/Literal, and from this wsdl I've generated the proxy class using
    >> wsdl.exe.
    >> The request works correctly, and the Java service returns the results I
    >> expect (I inspect the SOAP packet), but I'm not able to get the results
    >> out of this reponse. This is the reponse I get:
    >>
    >> <?xml version="1.0" encoding="UTF-8"?>
    >> <soapenv:Envelope
    >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    >>
    >> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    >>
    >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    >> <soapenv:Body>
    >> <MethodResponse xmlns="urn:Mywebservices">
    >> <response xmlns="">
    >> <result>1</result>
    >> </response>
    >> </MethodResponse>
    >> </soapenv:Body>
    >> </soapenv:Envelope>
    >>
    >> The web method is called by a method generated by wsdl.exe and his return
    >> value is a MethodReponse object (MethodReponse class was also generated
    >> by wsdl.exe), but the object returned by this method is not like the one
    >> I've received (the one I expect regarding the SOAP reponse with the a "1"
    >> in the result field).
    >> It is an uninitialized object.
    >> Where could the problem be found?
    >> I hope I've explained myself properly.
    >>
    >> Rafa Llarena
    >>

    >
    >
     
    Rafa Llarena, Apr 28, 2005
    #3
  4. Rafa Llarena

    Brock Allen Guest

    It's possible that the Java WebService is defined using WSDL and XSD that
    the .NET framework can't consume automatically. You might have to work with
    the XML message directly in your client.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > I've kept researching and I've arrived to the conclusion that the
    > problem
    > maybe in the return value of the web method. It returns a struct, and
    > .NET
    > seems to have a problem retrieving this struct. Am I wrong here? Is
    > there
    > anything I have to do when the web method's return type is a
    > structure?
    > If anyone has a clue, please, answer
    > Rafa
    >
    > "Rafa Llarena" <> escribió en el mensaje
    > news:OjZ%...
    >
    >> The Java web service has been changed to Document/literal. So know, I
    >> just generate the proxy class with wsdl.exe and try to call the web
    >> method. The problem remains the same, so it is not a Document/RPC
    >> problem, but a code problem. Heres my code:
    >>
    >> {
    >> javaService js = new javaService();
    >> testMethod vReq = new testMethod();
    >> vReq.param1 = 1;
    >>
    >> reponseWS info = null;
    >> info = js.testMethod(vReq);
    >> int state = info.result;
    >> if (state = = 0) return false;
    >> else return true;
    >> }
    >> javaService is the class that represents the web service, testMethod
    >> is
    >> the class that represents the web method and reponseWS is the class
    >> that
    >> represents the web method return value. All this classes are
    >> generated by
    >> wsdl.exe.
    >> Although I inspect the SOAP reponse, and I can see "result"'s value
    >> is 1,
    >> the content of the "info" object is not the correct one. It's always
    >> 0, as
    >> if it's not even initialized.
    >> Maybe all this doesn' work the way I'm trying to do it.
    >> Anyone??
    >> Rafa Llarena
    >>
    >> "Rafa Llarena" <> escribió en el mensaje
    >> news:...
    >>
    >>> Hi,
    >>>
    >>> I'm writting a code in C# which needs to consume a Java-written web
    >>> service. This service was written in a RPC/Literal way, so I've used
    >>> a
    >>> tool I found (r2d) to transform the RPC/Literal wsdl into a
    >>> Document/Literal, and from this wsdl I've generated the proxy class
    >>> using
    >>> wsdl.exe.
    >>> The request works correctly, and the Java service returns the
    >>> results I
    >>> expect (I inspect the SOAP packet), but I'm not able to get the
    >>> results
    >>> out of this reponse. This is the reponse I get:
    >>> <?xml version="1.0" encoding="UTF-8"?>
    >>> <soapenv:Envelope
    >>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    >>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    >>>
    >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    >>> <soapenv:Body>
    >>> <MethodResponse xmlns="urn:Mywebservices">
    >>> <response xmlns="">
    >>> <result>1</result>
    >>> </response>
    >>> </MethodResponse>
    >>> </soapenv:Body>
    >>> </soapenv:Envelope>
    >>> The web method is called by a method generated by wsdl.exe and his
    >>> return
    >>> value is a MethodReponse object (MethodReponse class was also
    >>> generated
    >>> by wsdl.exe), but the object returned by this method is not like the
    >>> one
    >>> I've received (the one I expect regarding the SOAP reponse with the
    >>> a "1"
    >>> in the result field).
    >>> It is an uninitialized object.
    >>> Where could the problem be found?
    >>> I hope I've explained myself properly.
    >>> Rafa Llarena
    >>>
     
    Brock Allen, Apr 28, 2005
    #4
  5. Rafa Llarena

    Rafa Llarena Guest

    Thank you very much for your answer.
    Is there any way to find out if that's actually the problem?

    Rafa Llarena

    "Brock Allen" <> escribió en el mensaje
    news:...
    > It's possible that the Java WebService is defined using WSDL and XSD that
    > the .NET framework can't consume automatically. You might have to work
    > with the XML message directly in your client.
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >
    >
    >> I've kept researching and I've arrived to the conclusion that the
    >> problem
    >> maybe in the return value of the web method. It returns a struct, and
    >> .NET
    >> seems to have a problem retrieving this struct. Am I wrong here? Is
    >> there
    >> anything I have to do when the web method's return type is a
    >> structure?
    >> If anyone has a clue, please, answer
    >> Rafa
    >>
    >> "Rafa Llarena" <> escribió en el mensaje
    >> news:OjZ%...
    >>
    >>> The Java web service has been changed to Document/literal. So know, I
    >>> just generate the proxy class with wsdl.exe and try to call the web
    >>> method. The problem remains the same, so it is not a Document/RPC
    >>> problem, but a code problem. Heres my code:
    >>>
    >>> {
    >>> javaService js = new javaService();
    >>> testMethod vReq = new testMethod();
    >>> vReq.param1 = 1;
    >>>
    >>> reponseWS info = null;
    >>> info = js.testMethod(vReq);
    >>> int state = info.result;
    >>> if (state = = 0) return false;
    >>> else return true;
    >>> }
    >>> javaService is the class that represents the web service, testMethod
    >>> is
    >>> the class that represents the web method and reponseWS is the class
    >>> that
    >>> represents the web method return value. All this classes are
    >>> generated by
    >>> wsdl.exe.
    >>> Although I inspect the SOAP reponse, and I can see "result"'s value
    >>> is 1,
    >>> the content of the "info" object is not the correct one. It's always
    >>> 0, as
    >>> if it's not even initialized.
    >>> Maybe all this doesn' work the way I'm trying to do it.
    >>> Anyone??
    >>> Rafa Llarena
    >>>
    >>> "Rafa Llarena" <> escribió en el mensaje
    >>> news:...
    >>>
    >>>> Hi,
    >>>>
    >>>> I'm writting a code in C# which needs to consume a Java-written web
    >>>> service. This service was written in a RPC/Literal way, so I've used
    >>>> a
    >>>> tool I found (r2d) to transform the RPC/Literal wsdl into a
    >>>> Document/Literal, and from this wsdl I've generated the proxy class
    >>>> using
    >>>> wsdl.exe.
    >>>> The request works correctly, and the Java service returns the
    >>>> results I
    >>>> expect (I inspect the SOAP packet), but I'm not able to get the
    >>>> results
    >>>> out of this reponse. This is the reponse I get:
    >>>> <?xml version="1.0" encoding="UTF-8"?>
    >>>> <soapenv:Envelope
    >>>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    >>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    >>>>
    >>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    >>>> <soapenv:Body>
    >>>> <MethodResponse xmlns="urn:Mywebservices">
    >>>> <response xmlns="">
    >>>> <result>1</result>
    >>>> </response>
    >>>> </MethodResponse>
    >>>> </soapenv:Body>
    >>>> </soapenv:Envelope>
    >>>> The web method is called by a method generated by wsdl.exe and his
    >>>> return
    >>>> value is a MethodReponse object (MethodReponse class was also
    >>>> generated
    >>>> by wsdl.exe), but the object returned by this method is not like the
    >>>> one
    >>>> I've received (the one I expect regarding the SOAP reponse with the
    >>>> a "1"
    >>>> in the result field).
    >>>> It is an uninitialized object.
    >>>> Where could the problem be found?
    >>>> I hope I've explained myself properly.
    >>>> Rafa Llarena
    >>>>

    >
    >
    >
     
    Rafa Llarena, Apr 29, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. umhlali
    Replies:
    0
    Views:
    2,063
    umhlali
    May 27, 2004
  2. DNB
    Replies:
    1
    Views:
    272
  3. dgleeson422111

    Consuming local web service - ok, remote web service -problem?

    dgleeson422111, Jan 26, 2010, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    930
    dgleeson422111
    Jan 26, 2010
  4. Curt K
    Replies:
    3
    Views:
    485
    John Saunders [MVP]
    Jun 15, 2007
  5. DNB
    Replies:
    1
    Views:
    324
    John Saunders [MVP]
    Jan 20, 2008
Loading...

Share This Page