For example, an soapFault look likes this with the custom
<s:Body> <s:Fault> <faultcode>s:Client</faultcode> <faultstring xml:lang="en-US">Operation parameter is invalid.</faultstring> <detail> <ServerCustomizedError> <ErrorMessage>Operation parameter is invalid.</ErrorMessage> <Id>56a145c6-a7f3-4069-94a4-6ec945d95613</Id> <ParameterName>input</ParameterName> <ValidationDetails> <Message>Why is this wrong?</Message> <Target>wrong value</Target> <Key>wrong data</Key> </ValidationDetails> </ServerCustomizedError> </detail> </s:Fault> </s:Body>
The corresponding client side java code to parse the above Soap Fault will look like:
Iteratorit = soapFaultClientException.getSoapFault().getFaultDetail().getDetailEntries(); while (it.hasNext()) { Source errSource = it.next().getSource(); @SuppressWarnings("unchecked") JAXBElement errJaxb = (JAXBElement ) springWebServiceTemplate.getUnmarshaller().unmarshal(errSource); ServerCustomizedError err = errJaxb.getValue(); .... }