You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
Here is a simple way to access web service clients from Seam.
Here is what the configuration looks like:
<jaxws:client-factory name="sampleServiceClient" serviceQName="{http://service.jaxws.taylor.net/}SampleService" serviceEndpointInterface="net.taylor.sample.service.SampleService" endpointAddress="@sample.service.endpoint@"/>
Here is the injection of the client:
@In private SampleService sampleServiceClient;
Here is the factory code. Note the use of @Unwrap.
@Scope(ScopeType.APPLICATION) @Install(value = false, precedence = Install.FRAMEWORK) @AutoCreate @BypassInterceptors public class ClientFactory { private Object client; private String serviceQName; private String wsdlLocation; private Class<?> serviceEndpointInterface; private String endpointAddress; // setters/getters @Create public void create() throws Exception { Service service = Service.create(new URL(getWsdlLocation()), QName .valueOf(getServiceQName())); client = service.getPort(getServiceEndpointInterface()); Map<String, Object> requestContext = ((BindingProvider) client) .getRequestContext(); requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpointAddress()); } @Unwrap public Object getClient() { return client; } }
Here is the full code: ClientFactory.java