O
O
Ostap2017-01-09 10:49:18
SOAP
Ostap, 2017-01-09 10:49:18

How to override soap error messages?

Is it possible in SOAP to override the error message SOAP-ERROR: Encoding: Violation of encoding rules ? I get this error when incorrect data is passed to a field with the long type.
The task is that the service must respond to absolutely any non-valid request with errors defined by the customer.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Frozen Coder, 2017-01-09
@frozen_coder

You can override. Describe your error type in xsd. For example, this type will simply contain a string field with an error message. Further work on the server. It's not clear what you are using.
I'm using jaxb and Spring - inherit from SoapFaultMappingExceptionResolver and implement customizeFault method. It catches exceptions that are fired at your endpoints. In this method, by exception from the ObjectFactory, I create the required JAXBElement, which is then marshalled by the marshaller. Then an error message with custom messages will be sent. For a validation error, you can make not one line with an explanation, but a list at once - to describe all the incorrect fields.
Read more in English:
janvanbesien.blogspot.ru/2008/03/soap-faults-with-...
memorynotfound.com/spring-ws-add-detail-soapfault-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question