Exporting standalone web services using JAX-WS:-
The built-in JAX-WS provider that comes with Oracle’s JDK 1.6 supports exposure
of web services using the built-in HTTP server that’s included in JDK 1.6 as
well. Spring’s SimpleJaxWsServiceExporter detects all @WebService annotated
beans in the Spring application context, exporting them through the default JAX-WS
server (the JDK 1.6 HTTP server).
The endpoint instances are defined and managed as Spring beans themselves; they will be registered with the JAX-WS engine but their lifecycle will be up to the Spring application context.
<bean class="org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter">
<property name="helloWorld" value="http://localhost:8080/"/>
</bean>
<bean id="dataServiceEndpoint" class="r4r.in.DataServiceEndpoint">
...
</bean>
...
The DataServiceEndpoint may derive from Spring’s SpringBeanAutowiringSupport but doesn’t have to since the endpoint is a fully Spring-managed bean here. This means that the endpoint implementation may look like as follows, without any superclass declared - and Spring’s @Autowired configuration annotation still being distinguished:
@WebService(serviceName="DataService")
public classDataServiceEndpoint {
@Autowired
private DataService service;
@WebMethod
public void insertData(Data d) {
service.insertData(d);
}
@WebMethod
public List<Data> getDat(String name) {
return service.getDat(name);
}}