Skip to content
Advertisement

Is it possible to send a pretty printed SOAP request with apache cxf?

I’m using the apache cxf library as our SOAP client to transmit SOAP requests to a specific endpoint. Unfortunately it seems that this endpoint do have some trouble to correctly parse the data if it comes in one line (which is pretty much the standard). I’ve written a simple Test-Client which sends RAW Strings to that endpoint and with that I was able to find out that the requests could be processed if the SOAP-Message is pretty printed. If I send the very same request in one line the server respond with a HTTP/1.1 500 Internal Server Error.

I’ve already submitted a bug report but I’m afraid that the receiving company will ask me to transmit my data pretty printed.

Is that possible with apache cxf?

Advertisement

Answer

I’ve found another question which helped me to find a solution for my needs.

Going from that post I was able to adopt the following code which can do what I need

JavaScript

and adding an object from this class to the client with client.getOutInterceptors().add(new PrettyPrintingOutInterceptor());

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