Skip to content
Advertisement

Unmarshal SOAP response with CDATA in its body using JAXB

I am trying to unmarshal a SOAP respone using JAXB but without success. What I have so far are the model classes generated using an xsd and the following code which should unmarshal the response:

JavaScript

Then I try to access the value of the <AnnahmeErfolgreich> element but instead of being true like in the response the object which unmarshaller gives me has the value for it being false.

What am I missing? Trying to get deeper by calling getFirstChild() again results in an Unexpected node type: com.sun.xml.messaging.saaj.soap.impl.SOAPTextImpl exception.

Below is the response itself:

JavaScript

How can I change the code to get the unmarshaller work as expected? Thank you!

Advertisement

Answer

I had to use an XMLStreamReader as answered here but instead of file I also used an InputStream:

JavaScript

After this the variable bspQuittung had the right values.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement