Tag Archives: Web service

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 […]

Using .NET v2.0 generated WSDLs with JAX-WS: How to resolve “A class/interface with the same name “XXXX” is already in use. Use a class customization to resolve this conflict”?


I’ve noticed an issue in WSDLs generated by .NET 2.0 apps: some of the element(s) and their corresponding complextype definitions have same name. If you happen to generate JAX-WS portable artifacts (see below) from one such WSDL for your project (during technology migration etc. and you don’t want the consumers who use this WSDL to […]

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 […]

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 […]

Contract-first Web Services: What are the different ways to define XML data contract?


I was glancing through Spring Web Services v2.0 framework reference tutorial today, and found an interesting piece of information that I’m gonna share with you all here: While writing contract-first web services i.e. developing web services that start with the XML Schema/WSDL contract first followed by the Java code second, there are four different ways […]

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 […]

Apache CXF: Adding a custom interceptor to an interceptor chain


According to CXF docs, Interceptors are the fundamental processing unit inside CXF. When a service is invoked, an InterceptorChain is created and invoked. Each interceptor gets a chance to do what they want with the message. This can include reading it, transforming it, processing headers, validating the message, etc. When a CXF client invokes a […]

java.lang.ClassCastException: [ServletName] cannot be cast to javax.servlet.Servlet: How to resolve?


When I was using tomcat-maven-plugin to test an app I worked on in embedded tomcat , it was erroring out with the following message: INFO: Marking servlet TestWebServiceServlet as unavailable Jun 17, 2011 4:01:48 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /cxf threw load() exception java.lang.ClassCastException: test.ws.TestWebServiceServlet cannot be cast to javax.servlet.Servlet at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1104) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981) at […]

WSDLToJava Error: Rpc/encoded wsdls are not supported with CXF


RPC/encoded is a vestige from before SOAP objects were defined with XML Schema. It’s not widely supported anymore. You will need to generate the stubs using Apache Axis 1.0, which is from the same era. java org.apache.axis.wsdl.WSDL2Java http://someurl?WSDL You will need the following jars or equivalents in the -cp classpath param: axis-1.4.jar commons-logging-1.1.ja commons-discovery-0.2.jar jaxrpc-1.1.jar saaj-1.1.jar wsdl4j-1.4.jar activation-1.1.jar […]

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 […]