Hello,
I am trying to integrate an external web service(represented by WSDL) in a SCA
component within the Tuscany platform (Version 1.3.1). The web services is
specified as reference in the component composite, as well as annotated in
implementation code(see below). The example that I implemented was similar to
the xml-bigbank example in the tuscany 1.3.1 version. With the examples (see
code below), I got different results. But I want to use a transplant solution
provided by the tuscany framework, where I don't have to use generated stub
code(e.g. from axis2 wsdl2java) in the implementation(client) code.
As a first step I developed a external test webservice operated on axis2
server(outside the tuscany framework).
To use this web service in the tuscany platform, I declared this interface,
which represents external web service(inside tuscany framework):
@Remotable
public interface TestService{
Result foo(Request r);
}
with Result and Request as normal POJO classes.
The binding in client.composite:
<reference name="testService">
<binding.ws
wsdlElement="http://targetnamespace/#wsdl.port(TestService/TestServiceSoap)" />
</reference>
the corresponding wsdl
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions targetNamespace="http://targetnamespace/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:import namespace="http://targetnamespace/"
location="http://localhost/testservice?wsdl" />
</wsdl:definitions>
the TestClient (implementation of remotable interface):
@Reference
protected TestService testService;
...
Request r = new Request();
Result rs = testService.foo(r);
and everything works fine (no axis,axis2, etc. stuff in client code) ;-)
Now I tried to integrate a foreign external webservice
(URI: http://www.webservicex.net/WeatherForecast.asmx?wsdl):
The interface:
@Remotable
public interface WeatherService {
GetWeatherByPlaceNameResult GetWeatherByPlaceName(String placeName)
throws java.rmi.RemoteException;
}
and again with GetWeatherByPlaceNameResult as POJO class.
The binding
<reference name="weather">
<binding.ws
wsdlElement="http://www.webservicex.net#wsdl.port(WeatherForecast/WeatherForecastSoap)"
/>
</reference>
the corresponding wsdl
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions targetNamespace="http://www.webservicex.net"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:import namespace="http://www.webservicex.net"
location="http://www.webservicex.net/WeatherForecast.asmx?wsdl" />
</wsdl:definitions>
and the TestClient:
@Reference
protected WeatherService weather;
...
GetWeatherByPlaceNameResult result = weather.GetWeatherByPlaceName("New
York");
System.out.println(result.getPlaceName());
but this time the POJO is always empty !
If I changed the interface WeatherService to
@Remotable
public interface WeatherService {
OMElement GetWeatherByPlaceName(String placeName) throws
java.rmi.RemoteException;
}
I got the data but this is not transparent anymore!
Any ideas why the GetWeatherByPlaceNameResult object is always empty ?
Mit freundlichem Gruß / Kind regards
Martin Thoma