Can you explain the circumstances of your application more? All web service stacks already convert SOAP to java objects ... I'm not clear why you want to do it explicitly using JAXB.
Joined: May 11, 2010
I am trying to post an XML to a Rest Webservice. In the REST webservice, i am trying to manipulate the XML and posting it to the ISTM webserive which will create a ticket in BMC Remedy ITSM system. I will get the reponse back from the ITSM system with all the ticket details as specified in the query. As the response from ITSM is a SOAP message, it is difficuilt for the users to understand it. So I am trying to transform it to a XML.
As the response from ITSM is a SOAP message, it is difficuilt for the users to understand it. So I am trying to transform it to a XML.
BUT all SOAP messages are already XML documents so you can use normal Java methods to locate values with XPath, transform with XSLT, etc etc - there is absolutely no need to get involved with JAXB.
Joined: Apr 04, 2009
I feel that since the ITSM web service is a SOAP style WS, the path of least maintenance is to use it as a SOAP style WS.
Its WSDL should be the one and only contract.
By trying to manipulate its SOAP representation, you'll introduce a rather fragile coupling to the SOAP binding instead of the WSDL.
If that service ever changes its SOAP bindings even slightly (which can happen if they change their WS stack), your code will need modifications.
Instead, I feel your REST webservice component should become a proper SOAP WS client to the ITSM webservice (the JAXWS implementation that comes with the JRE should make it a simple enough implementation. Prototype and try out.). Using JAXWS, you'll get back some POJOs from that web service. Then convert those POJOs' fields to your user friendly XML format, using XStream / JAXB / DOM,....