0
Answer

Consume an Axis2 java-Web-Service with C#

r c

r c

14y
7.5k
1

Hello there,
I have a big problem and I can't find any solution in google. I've created web service with Axis2/Java
and have deployed on a local host. I'm trying to call this web service with C# but I get TimeOutException. With Java Client works without problems.
What am I doing wrong?
What I did:
I use Visual C# 2010 Express.
I've add a web reference and the web service was found and the client was generated automatically.
I try to call the service like that:
 
 

 
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
WS_1_Test
{
class Class1
{
static void Main()
{
WS_1_Test.SimpleService.
SimpleServiceClient client = new SimpleService.SimpleServiceClient();
WS_1_Test.SimpleService.
concatRequest cr = new SimpleService.concatRequest();
cr.s1 =
"789";
cr.s2 =
"xyz";
WS_1_Test.SimpleService.
concatRequest1 cr1 = new SimpleService.concatRequest1(cr);
client.Open();
WS_1_Test.SimpleService.
concatResponse resp = client.concat(cr1);
client.Close();
}
}
}

 
The WSDL-file looks lie that:
<?
xml version="1.0" encoding="utf-8"?>
<
wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ttdev.com/ss" name="SimpleService" targetNamespace="http://ttdev.com/ss" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<
wsdl:types>
<
xsd:schema targetNamespace="http://ttdev.com/ss">
<
xsd:element name="concatRequest">
<
xsd:complexType>
<
xsd:sequence>
<
xsd:element name="s1" type="xsd:string" />
<
xsd:element name="s2" type="xsd:string" />
</
xsd:sequence>
</
xsd:complexType>
</
xsd:element>
<
xsd:element name="concatResponse" type="xsd:string" />
</
xsd:schema>
</
wsdl:types>
<
wsdl:message name="concatResponse">
<
wsdl:part name="parameters" element="tns:concatResponse" />
</
wsdl:message>
<
wsdl:message name="concatRequest">
<
wsdl:part name="parameters" element="tns:concatRequest" />
</
wsdl:message>
<
wsdl:portType name="SimpleService">
<
wsdl:operation name="concat">
<
wsdl:input message="tns:concatRequest" />
<
wsdl:output message="tns:concatResponse" />
</
wsdl:operation>
</
wsdl:portType>
<
wsdl:binding name="SimpleServiceSOAP" type="tns:SimpleService">
<
soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<
wsdl:operation name="concat">
<
soap:operation soapAction="http://ttdev.com/ss/concat" />
<
wsdl:input>
<
soap:body use="literal" />
</
wsdl:input>
<
wsdl:output>
<
soap:body use="literal" />
</
wsdl:output>
</
wsdl:operation>
</
wsdl:binding>
<
wsdl:service name="SimpleService">
<
wsdl:port name="SimpleServiceSOAP" binding="tns:SimpleServiceSOAP">
<
soap:address location="http://53.59.178.28:8080/axis2/services/SimpleService/" />
</
wsdl:port>
</
wsdl:service>
</
wsdl:definitions>