File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Parameter order reversed when using Mule and Axis for a web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Parameter order reversed when using Mule and Axis for a web service" Watch "Parameter order reversed when using Mule and Axis for a web service" New topic
Author

Parameter order reversed when using Mule and Axis for a web service

James Adams
Ranch Hand

Joined: Sep 12, 2003
Posts: 188
I have a POJO which is deployed as a web service using Mule and Axis. It has a single method with three parameters, a String and two ints, i.e.


When I call it I use a URI like this:

http://localhost:8080/services/MyPojo/MyPojo?method=getItems¶m0=ABC¶m1=7¶m2=9

When I do this I get a NumberFormatException since the string parameter value 'ABC' gets assigned to the third int parameter. The call will only work if I reverse the order to the parameters on the URI, like this:

http://localhost:8080/services/MyPojo/MyPojo?method=getItems¶m0=9¶m1=7¶m2=ABC

It will also work if all three parameters are numeric, but the point is that param2 should map to the third/int parameter of the method, and param0 to the first/String parameter, and not the other way around.

I'm not sure if it's Mule or Axis which is making this parameter reversal happen. If anyone can give me a clue as to why this is happening I'll certainly appreciate the help. Thanks in advance.

--James
James Adams
Ranch Hand

Joined: Sep 12, 2003
Posts: 188
One other thing -- the parameter order in the WSDL shows the correct order:

http://localhost:8080/services/MyPojo/MyPojo?wsdl

...
<wsdl:message name="getItemsRequest">
<wsdl:part name="in0" type="xsd:string"/>
<wsdl:part name="in1" type="xsd:int"/>
<wsdl:part name="in2" type="xsd:int"/>
</wsdl:message>
...

[ September 27, 2007: Message edited by: James Adams ]
[ September 27, 2007: Message edited by: James Adams ]
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Well - now things are getting confusing ...

A WSDL describes a SOAP web service.
The SOAP envelope is always delivered with an HTTP POST.

Yet, you are having problems with an HTTP GET invocation.
That has nothing to do with SOAP - so the WSDL has no bearing on it.
James Adams
Ranch Hand

Joined: Sep 12, 2003
Posts: 188
Thanks for the insight Peer (yes, I am very new to SOAP web services).

Maybe I should not be testing this web service using my browser and instead I should write a small client which sends the web service request via a POST method? I'll do this and see if anything changes.

--James
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Originally posted by James Adams:
instead I should write a small client which sends the web service request via a POST method?


Probably a good idea. I mentioned as much in this topic.

Axis can be used to generate client stubs that make that easier for you (Axis 1.x example). On the other hand you could use an SAAJ client.
James Adams
Ranch Hand

Joined: Sep 12, 2003
Posts: 188
Now that I'm testing by making a SOAP web service call from a client I no longer see the parameter order reversal, so apparently this had something to do with HTTP GET and maybe also with Mule and its servlet connector. Sorry I've no real solution to post, other than the advice to not try testing anything other than trivial SOAP web services using a GET method from the browser.

--James
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parameter order reversed when using Mule and Axis for a web service