All Versions
Fisheye 4.2 DocumentationFisheye 4.1 Documentation
Fisheye 4.0 Documentation
More...
A SOAP RPC plugin module descriptor looks like this:
<rpc-soap key="my.foo.service" path="/foo" class="com.yoydyne.rpc.FooServiceImpl"/>
The descriptor is simple, because much of the configuration is defined by JAX-WS annotations on the implementing class.
The descriptor above defines a SOAP endpoint at http://<your server>/<your context>/service/foo. The WSDL for the service is available at http://<your server>/<your context>/service/foo?wsdl
The Java implementation looks like this:
@WebService(endpointInterface = "com.yoydyne.rpc.FooService", name = "Foo", serviceName = "Foo")
@SOAPBinding(style = Style.RPC, use = Use.LITERAL)
public class FooServiceImpl implements FooService, SecuredRpcService {
@Autowired
private TxTemplate txTemplate;
public ReviewData createReview(String token, ReviewData review) {
return reviewService.createReview(review);
}
public String doSomething(String token, String arg) {
return txTemplate.execute(new TxCallback<String>() {
public String doInTransaction(TransactionStatus status) {
return "Logged in as " + txTemplate.getEffectivePrincipal();
}
});
}
public WebServiceContext getContext() {
return context;
}
@Resource
public void setContext(WebServiceContext context) {
this.context = context;
}
}
Note the following points from the code above:
auth SOAP endpoint. Your implementation ignores this parameter – it is processed by a Spring interceptor. If no valid token is provided, the current user will be the anonymous user.TxTemplate is automatically injected into the instance by Spring. This could also have been achieved by defining a method public void setTxTemplate(TxTemplate txTemplate) {...} rather than using the @Autowired annotation.@Resource annotation on setContext.