Is it possible to parse an XML soap response to a java Object?
I have a class generated by Apache CXF with the structure of the object, and I have the XML soap response from the request.
I want to pass the XML soap response without invoking the service to the java object. It's possible to do this because I see in the java object create by CXF XML annotations:
StringReader sr = new StringReader(output);
Results rs = (Results) JAXBContext.newInstance(Results.class).createUnmarshaller().unmarshal(sr);
In this case I was using Apache CXF 3.10 ,and the answer to my question is, yes it's possible to do it. When you create the client from the command wsdl2java
java classes are generated containing the XML annotation to do that.
The code post in the question working for that, toy can put the WSDL and send a request and take the response and save as a file and pass that to the JAXBContext
.
Or if the owner of the web service give to you a response example you can use that too.