views:

29

answers:

0

I want to unit-test the mapper objects that map/translate web service types generated by wsimport in to my own domain objects. I also want to test error-scenarios, such as SOAP faults and such, and I am thinking it would be best to test the mapper objects on authentic SOAP responses. I do not want to fire requests to the web service itself as this requires access to the web service, and poses round-trip time for each test.

Given this scenario, I am seeking to unmarshal SOAP messages from a particular XML-file containing a SOAP Envelope. I want to unmarshal the SOAP Envelope, and in turn the payload in the body to the corresponding Java types.

I've managed to unmarshal the payload itself by using JAXB unmarshalling, but I have not found a way to allow me to handle SOAP responses with SOAP faults an similar.

Is there an approach that given a SOAP Envelope XML-file would allow me to test my mappers in an easy manner?