Problem calling a Java web service

F

Fatbob

Hi everyone,

I'm trying to call a Java web serivce from my C# desktop application.
I added a web reference using the WSDL file. When I call a method that
returns a String, everything works fine using the code below...

private void btnGetTemplates_Click(object sender, EventArgs e)
{
owordWS.TestOWordWSBeanService ws = new
owordWS.TestOWordWSBeanService();

GetAllTemplates gt = new GetAllTemplates();

GetAllTemplatesResponse gtresp = ws.GetAllTemplates(gt);

MessageBox.Show(gtresp.@return);
}

However, when I call a method that returns a List, I don't have the
"Response" as in the above code.

Here is a screen shot when I add a reference to my web service...

http://img151.imageshack.us/img151/8497/wsdlinvs2008.png

But as you can see I don't have the "Response" available...

http://img695.imageshack.us/img695/3135/getlistalltemplates.png

I'm wondering if this has something to do with the fact that the
GetListOfAllTemplates returns a List? Can C# call a Java web service
that returns a List?

Here is what the WSDL file looks like...


<definitions name="TestOWordWSBeanService" targetNamespace="http://
oword.muhc.mcgill.ca/">

<types>

<xs:schema targetNamespace="http://oword.muhc.mcgill.ca/"
version="1.0">
<xs:element name="GetAllTemplates" type="tns:GetAllTemplates"/>
<xs:element name="GetAllTemplatesResponse"
type="tns:GetAllTemplatesResponse"/>
<xs:element name="GetListOfAllTemplates"
type="tns:GetListOfAllTemplates"/>
<xs:element name="GetListOfAllTemplatesResponse"
type="tns:GetListOfAllTemplatesResponse"/>
<xs:element name="HelloWorld" type="tns:HelloWorld"/>
<xs:element name="HelloWorldResponse" type="tns:HelloWorldResponse"/>

<xs:complexType name="HelloWorld">

<xs:sequence>
<xs:element minOccurs="0" name="FirstName" type="xs:string"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="HelloWorldResponse">

<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:string"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="GetAllTemplates">
<xs:sequence/>
</xs:complexType>

<xs:complexType name="GetAllTemplatesResponse">

<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:string"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="GetListOfAllTemplates">
<xs:sequence/>
</xs:complexType>

<xs:complexType name="GetListOfAllTemplatesResponse">

<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="return"
type="tns:blush:wordTest"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="owordTest">

<xs:sequence>
<xs:element minOccurs="0" name="contentType" type="xs:string"/>
<xs:element minOccurs="0" name="docTemplateLink" type="xs:string"/>
<xs:element minOccurs="0" name="lastUpdated" type="xs:dateTime"/>
<xs:element minOccurs="0" name="templateName" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>

<message name="TestOWordWS_GetAllTemplatesResponse">
<part element="tns:GetAllTemplatesResponse"
name="GetAllTemplatesResponse"/>
</message>

<message name="TestOWordWS_GetListOfAllTemplatesResponse">
<part element="tns:GetListOfAllTemplatesResponse"
name="GetListOfAllTemplatesResponse"/>
</message>

</message>

<message name="TestOWordWS_HelloWorldResponse">
<part element="tns:HelloWorldResponse" name="HelloWorldResponse"/>
</message>

<message name="TestOWordWS_HelloWorld">
<part element="tns:HelloWorld" name="HelloWorld"/>
</message>

<message name="TestOWordWS_GetAllTemplates">
<part element="tns:GetAllTemplates" name="GetAllTemplates"/>
</message>

<portType name="TestOWordWS">

<operation name="GetAllTemplates" parameterOrder="GetAllTemplates">
<input message="tns:TestOWordWS_GetAllTemplates"/>
<output message="tns:TestOWordWS_GetAllTemplatesResponse"/>
</operation>

<operation name="GetListOfAllTemplates"
parameterOrder="GetListOfAllTemplates">
<input message="tns:TestOWordWS_GetListOfAllTemplates"/>
<output message="tns:TestOWordWS_GetListOfAllTemplatesResponse"/>
</operation>

<operation name="HelloWorld" parameterOrder="HelloWorld">
<input message="tns:TestOWordWS_HelloWorld"/>
<output message="tns:TestOWordWS_HelloWorldResponse"/>
</operation>
</portType>

<binding name="TestOWordWSBinding" type="tns:TestOWordWS">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/
soap/http"/>

<operation name="GetAllTemplates">
<soap:blush:peration soapAction=""/>

<input>
<soap:body use="literal"/>
</input>

<output>
<soap:body use="literal"/>
</output>
</operation>

<operation name="GetListOfAllTemplates">
<soap:blush:peration soapAction=""/>

<input>
<soap:body use="literal"/>
</input>

<output>
<soap:body use="literal"/>
</output>
</operation>

<operation name="HelloWorld">
<soap:blush:peration soapAction=""/>

<input>
<soap:body use="literal"/>
</input>

<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>

<service name="TestOWordWSBeanService">

<port binding="tns:TestOWordWSBinding" name="TestOWordWSBeanPort">
<soap:address location="http://localhost:8080/cis-ws/oword"/>
</port>
</service>
</definitions>

Any suggestions as to how I can call a method that returns a List?
 
A

Arne Vajhøj

I'm trying to call a Java web serivce from my C# desktop application.
I added a web reference using the WSDL file. When I call a method that
returns a String, everything works fine using the code below...

private void btnGetTemplates_Click(object sender, EventArgs e)
{
owordWS.TestOWordWSBeanService ws = new
owordWS.TestOWordWSBeanService();

GetAllTemplates gt = new GetAllTemplates();

GetAllTemplatesResponse gtresp = ws.GetAllTemplates(gt);

MessageBox.Show(gtresp.@return);
}

However, when I call a method that returns a List, I don't have the
"Response" as in the above code.

Here is a screen shot when I add a reference to my web service...

http://img151.imageshack.us/img151/8497/wsdlinvs2008.png

But as you can see I don't have the "Response" available...

http://img695.imageshack.us/img695/3135/getlistalltemplates.png

I'm wondering if this has something to do with the fact that the
GetListOfAllTemplates returns a List? Can C# call a Java web service
that returns a List?

What type does the method in the generated stub return?

If it is a special defined response class or an array or a List<> then
all is fine.

Otherwise you have a problem.

Arne
 

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

Top