Tag Archives: SOAP

Apache CXF with Spring: How to add HTTP headers to a SOAP request using a custom CXF interceptor?

Let’s assume that we want to make a SOAP call to a service at http://localhost:8080/samplewebservices/echoserviceinterface, and it requires that we add an API / Access token as a HTTP header, we can do it this way: Assumptions Endpoint: http://localhost:8080/samplewebservices/echoserviceinterface Service Interface: singz.ws.test.interface.EchoService ACCESS_TOKEN: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 (HTTP Header) Spring Application Context Configuration Custom Interceptor to add HTTP […]

Different SOAP encoding styles – RPC, RPC-literal, and document-literal

SOAP uses XML to marshal data that is transported to a software application.  Since SOAP’s introduction, three SOAP encoding styles have become popular and are reliably implemented across software vendors and technology providers: SOAP Remote Procedure Call (RPC) encoding, also known as Section 5 encoding, which is defined by the SOAP 1.1 specification SOAP Remote Procedure Call Literal […]

Apache CXF: How to add custom SOAP message headers to a web service request?

SOAP headers can be added to a Web service request in different ways, if you use Apache CXF. They way I prefer is the one I’ve mentioned here – as it doesn’t require changes to wsdl or method signatures and it’s much faster as it doesn’t break streaming and the memory overhead is less. The […]

Apache CXF-based Java Web Services: How to log/print the payload XML of incoming SOAP request using LoggingInInterceptor?

I’ve had a requirement to print the exact SOAP XML of incoming requests to one of our web services written using Apache CXF Framework and here’s what I did. For doing this quickly, I’m taking the code from https://singztechmusings.wordpress.com/2010/12/10/java-web-services-soap-over-ssl-cxf-framework/ for CalculationServerIfc that basically does addition/subtraction based on web service requests. Here’s it: and I’m assuming […]

Web Services Specifications/Standards – A handy poster for Web Services’ Architects/Developers

Just came across a pdf document that summarizes the web services’ specifications/standards neatly as a poster. It was an interesting read. Often we go through vague theory, which we hardly remember over time. But this one, I’m sure, you’ll remember for a long time. This PDF document can be downloaded from here – innoQ_WS-Standards_Poster_2007-02.pdf. Wikipedia […]

Apache CXF: How message processing happens and what’s the role of interceptor?

When a Apache CXF developed consumer invokes a remote service the following message processing sequence is started: 1. The Apache CXF runtime creates an outbound interceptor chain to process the request. 2. If the invocation starts a two-way message exchange, the runtime creates an inbound interceptor chain and a fault processing interceptor chain. 3. The […]

Resolving SOAPFaultException caused by com.ctc.wstx.exc.WstxUnexpectedCharException

If you’re using any of these for Web Services – Axis2, CXF etc. – that internally makes use of Woodstox XML processor (wstx), and getting an exception like this during webservice calls, the problem is that the wstx tokenizer/parser encountered unexpected (but not necessarily invalid per se) character; character that is not legal in current […]