You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by NICHOLLS T Ext OCISI <tn...@francetelecom.com> on 2004/02/10 10:30:30 UTC

How do I handle overloaded methods?

Hi Guys,

I have a web service with two methods with the same name and with the same number of parameters but with different parameter types. When running my client which uses Java proxy/stubs generated with wsdl2java (I used the ANT task) I get the exception:

org.xml.sax.SAXException: Bad types (class com.mypackage.MyClass -> class java.lang.String)

My methods both take one parameter. One takes the type com.mypackage.MyClass as parameter and the other takes java.lang.String.

Apparently the generated proxy/stubs do not distinguish between my two methods since they have the same name. How can I specify which of the methods I want to use?

Thanks in advance.

Regards,
Thomas Nicholls

Re: How do I handle overloaded methods?

Posted by Tom Oinn <tm...@ebi.ac.uk>.
Hi Thomas,

This is probably not the most helpful answer, but I strongly suggest 
changing your service. Method overloading is not supported in the latest 
WSDL specifications, any support that axis may or may not have for it is 
completely non standard and will likely just cause you problems.

If you really want to do this then you'll probably have to construct the 
Call object yourself, there are ways to specify the argument types of 
the desired target operation I believe, the API is your friend for this one.

Cheers,

Tom