Using RPC/Encoding on an Apache Camel route

I have been looking at Apache Servicemix for an integration project recently to route messages between services in different network zones and written in different languages together. The CXF project which is used to set up and wire together web services provides many methods of doing this and can either build a service from its WSDL or code first. It does have a significant disadvantage though.

One of the services is a PHP SOAP service which uses the RPC/Encoded method in its WSDL file. CXF does not support this at all. Instead it spits out the error:

rpc encoded wsdls are not supported in jaxws

during the Maven build. A little searching took me to this post on the Tall-Paul blog about the problem which uses the older Apache Axis project but it also got me thinking.

In a previous job, I had to set up web services in PHP for a Java client and we came across this issue with the remote company and for a while the answer eluded me. In that case, I was in the position where we could change the WSDL file (as it was not being auto-generated and had one method). n the current one, I could conceivably solve the problem manually by creating the relevant clients by hand but I would rather not since this will create a maintenance overhead in the long run.

Perhaps this does add some overhead at the beginning of the project because it means that the Camel route will need to be set up for each used method but in the long run it reduces costs because to add a new method all we must do is to add in the new route into the camel-context.xml file, write any processors and then rebuild the route. There are fewer places which would then require debugging.

It also serves as a useful reminder that not every service will be new, shiny, and using latest methods. There are legacy services out there which may cost more to try and upgrade and maintain than it is worth to the business in time and cost. Some of these are in active projects where a decision has been made to no longer fully support a service but to maintain them for backwards compatibility.

There is another way of dealing with this error though. FuseESB (and Apache Servicemix on which this was tested originally) offers a simple HTTP proxy to link endpoints. This is really useful if you do not have to read the message or transform it between the services. This simple way is just to configure a route with the relevant to and from endpoints.The message is transferred across the ESB without processing or complaint. You do not have to configure Axis onto the bus.

(Sidenote: At the time I was looking at SugarCRM which uses PHP NuSOAP and by default uses RPC/Encoding. It can be altered appending &style=document&use=literal after the soap.php?wsdl. Not tested but it ought to allow parsing if building a POJO service which requires the Java classes being built.)