Friday, 8 May 2009

Axis Named Parameters

Axis makes creating web services fairly straight forward, but I came across something a little unexpected recently when programming a new web service. I was writing a very straight forward web service to return an address for a given name and post code. The initial WSDL looked like this (note this is only a snippet to show the relevant part):

As you can see, the service takes three parameters; firstName, lastName and postCode. Once I had completed and finished debugging the web service I deployed it. However, after the final deployment, I noticed that the WSDL had changed:

As you can see, the parameters are no longer named and have been replaced with generic names of in0, in1 and in2. So why did the parameter names change all of a sudden?

After a bit of head scratching and searching I figured it out. Whilst developing the web service I had been compiling the Java code with debugging enabled (-g flag), but once I had finished and was deploying the final version I switched off debugging. Axis uses the debugging symbols in the bytecode to determine the parameter names. Without this, it reverts to the generic parameter names.

I think from now on I will just leave debugging enabled!

No comments:

Post a Comment