Steve

Steve

  • NA
  • 6
  • 0

Problem calling a Java web service

Dec 22 2010 10:06 AM
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. I have a simple Java web serivce (simple for the moment), with one method that has one string parameter and returns a string (your basic Hello World test). However I get the following error in VS2008...

The best overloaded method match for 'OWord.localhost.TestOWordWSBeanService.HelloWorld(OWord.localhost.HelloWorld)' has some invalid arguments

Here is my C# code...

 private void btnTestWS_Click(object sender, EventArgs e)
{
localhost.TestOWordWSBeanService test = new OWord.localhost.TestOWordWSBeanService();
String testing;

// testing = localhost.HelloWorld("Steve");
testing = test.HelloWorld("Steve");
}

Here is my WSDL file...

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

<types>

<xs:schema targetNamespace="http://oword.muhc.mcgill.ca/" version="1.0">
<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="Result" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>

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

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

<portType name="TestOWordWS">

<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="HelloWorld">
<soap:operation 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>

What am I doing wrong here?


Answers (2)