Reputation: 471
I am using apache axis 1.2 and i tried to implement method overloading in java webservices this is the sample code.
//Here i took method1 with two parameters
public String method1(String s1,String s2)
{
SampleLogger.error("In method1(1)");
return "method1(1)";
}
//Here i took method1 with three parameters
public String method1(String s1,String s2,String s3) throws RemoteException
{
SampleLogger.error("In method1(2)");
return "method1(2)";
}
//Here i took method1 with four parameters
public String method1(String s1,String s2,String s3,String s4) throws RemoteException
{
SampleLogger.error("In method1(3)");
return "method1(3)";
}
When i tried to create these methods as webservice methods, i am getting error IWAB0398E Error in generating WSDL from Java: Attempted to write duplicate
schema element : {http://service.codon.com}method1
AxisFault
faultCode: {http://xml.apache.org/axis/}Server.generalException
faultSubcode:
faultString: Attempted to write duplicate schema element :
Upvotes: 1
Views: 1778
Reputation: 41
Still, you could expose your methods with a unique name with the
@WebMethod(operationName=......)
annotation, though this is not real overloading.
Upvotes: 1