Raymond beat me to it but since I already wrote most of this up, here are the
steps that I've used in the past (these are the same things used by the sample
that Raymond is referring to):
1.) Get the WSDL for the service you want to access
2.) Run wsimport on the WSDL
3.) Add an attribute (for the reference) to your component of the service
interface type that was generated via wsimport and use the Reference
annotation. So something like:
import org.osoa.sca.annotations.Reference;
import com.ext.FooService;
public class SomeComponent implements SomeService {
@Reference
protected FooService fooService;
...
}
4.) Add the reference info to the component in your .composite file:
<component name="SomeComponent">
<implementation.java class="bar.SomeComponent" />
<reference name="fooService">
<binding.ws
wsdlElement="http://ext.com#wsdl.port(SvcName/PortName)"
uri="http://somehost/FooService" />
</reference>
</component>
So, when your composite app loads up, the runtime will take care of populating
the reference with a valid WS client pointing to the endpoint specified in your
.composite file. If you leave off the uri attribute, I believe whatever
endpoint was specified in the original WSDL will be used.
-----Original Message-----
From: Raymond Feng [mailto:[email protected]]
Sent: Friday, October 16, 2009 08:41
To: user
Subject: Re: reference to jax-ws external web service (calling it)
Please take a look at the sample at [1]. It uses "wsimport" to generate java
interfaces from a WSDL, and use it to talk to external weather WS using
Tuscany SCA.
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
targetNamespace="http://weather" name="WeatherForecast">
<component name="WeatherForecastService">
<implementation.java class="weather.WeatherForecastImpl" />
<reference name="weatherForecast">
<binding.ws
wsdlElement="http://www.webservicex.net#wsdl.port(WeatherForecast/WeatherForecastSoap)"
/>
</reference>
</component>
</composite>
Please note binding.ws is used.
[1]
https://svn.apache.org/repos/asf/tuscany/branches/sca-java-1.x/samples/zipcode-jaxws/
Thanks,
Raymond
--------------------------------------------------
From: <[email protected]>
Sent: Friday, October 16, 2009 7:42 AM
To: "user" <[email protected]>
Subject: reference to jax-ws external web service (calling it)
> Hi,
>
> i used tuscany but i have not found the right directions how to call an
> external web service.. first of all, my question is:
>
> can an external webservices implemented in JAX-WS be used as components in
> a SCA architecture (or this is right only for bpel process and SCA pure
> java classes)?
>
> if it's so, how can pass a jax-ws reference in a SCA java class and call
> it? i see the document:
> http://www.osoa.org/display/Main/JAX-WS+Services+Integration
> but the jaxws.implementation doesn't work
> (tuscany give me:
>
> GRAVE: XMLSchema validation error occured in: Calculator.composite ,line =
> 63, column = 9, Message = cvc-complex-type.2.4.a: Invalid content was
> found starting with element 'implementation.jaxws'
>
> Somebody told me that in 2008 this implementation didin't existed yet:
>
> http://mail-archives.apache.org/mod_mbox/tuscany-user/200801.mbox/%[email protected]%3e
>
> today?? there is something in tuscany that works?????
>
> 2)An idea could be: i can use the java artifact get by the wsimport
> utility (from wsdl to java code interfaces) and invoke my jax-ws web
> services into a pure java SCA class?
>
>
> thank you very much!
>
> Roby
>