1

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);

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.