consuming java web service

R

Rafa Llarena

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
 
R

Rafa Llarena

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
 
R

Rafa Llarena

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
 
B

Brock Allen

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.
 
R

Rafa Llarena

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

Rafa Llarena
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top