Discussions

XML & Web services: Patterns for implementing web services over legacy services?

  1. So I have been tasked to join the web service band wagon to implement a WS-* web service interface to pre WS-* web service. The current service takes an XML POST request processes (business logic) the XML document and returns a response to the client. You could say the service is almost RESTFul as it doesn't really follow the REST tenets. I have been reading around and have pretty much decided that I will use Metro to implement contract first, doc-lit, wrapping/unwrapping and all that fancy stuff. My concern is how to implement the transformation to the legacy service and what patterns to use. At a very high level or simplest use of Metro, it takes the incoming message and transforms it to the JAVA equivalent (POJOs). Technically what I want to do, does not require JAXB to transform the message to JAVA classes, but rather to transform the incoming message to the legacy message. This way I can probably save some processing time. 1- Does anyone know if I can tell metro not to execute the JAXB portion and to pass the message to SMOOKS or some other XML to XML API? 2- A web service method in Metro is annotated with the @WebMethod. At that point the JAXB transform has already happened. So executing the business logic there wouldn't be right. Are there other ways to achieve this? Thanks
  2. For those who may be interested. The solution in Metro is to create a web service in PAYLOAD mode. This give you access directly to the XML data without the envelope, which is perfect. And the added benefit you can use any API that implements XML transform such as Smooks. @ServiceMode(value=Service.Mode.PAYLOAD) @WebServiceProvider() public class MyService implements Provider { public Source invoke(Source source) { //Parse XML here...} }