Tuesday, November 30, 2010

JAX-WS service using Spring 3.0


This is a work in progress blog entry. I have come up with these two approaches of deploying a JAX-WS web service using Spring 3.0. First one on a JEE container second on NON-JEE container like tomact or jdk1.6 http server. If you are aware of any other approach please leave a comment.
As a next step i will update the performance stats and the marshalling/unmarshalling cost of the calls.

jax-ws - JEE container


web.xml


spring - app context xml

No entires required


In this case the end point has to extend SpringBeanAutowiringSupport


public class SayHelloServiceEndpoint extends SpringBeanAutowiringSupport {

@Autowired

private SayHelloService SayHelloService;

@WebMethod

public String sayHello() {

return SayHelloService.sayHello();

}

}


Service endpoint -

http://localhost:8080/jaxwsspring/SayHelloService

WSDL -

http://localhost:8080/jaxwsspring/SayHelloService?wsdl


jax-ws - jdk 1.6 bundled in your web app


End Point class

@Service("SayHelloServiceEndpoint")

@WebService(serviceName="SayHelloService")

public class SayHelloServiceEndpoint {

@Autowired

private SayHelloService SayHelloService;

@WebMethod

public String sayHello() {

return SayHelloService.sayHello();

}

}


spring app context


web.xml

no specific entires required

Service URL -

http://localhost:9999/SayHelloService

WSDL -

http://localhost:9999/SayHelloService?wsdl

1 comment:

Unknown said...

Thanks man, this advice got my service working when every anything else out there on the web did not help