Hi,
I'm in process of migrating from axis1.x, I was using Message style services in my application
signatures were like Document method(Document in)
Which I've changed to OMElement method(OMElement in).The code migration went okay, app works fine. I found one issue (for which I needed workaround in my code). Here is the scenario
class ServiceClass
{
//service wrapper
public OMElement operation1(OMElement in){.... }
//real implementation of service
OMElement operation1(){.... }
}
services.xml
---------------------
<service name="myservice">
<description>
my web service
</description>
<parameter name="ServiceClass" locked="false">ServiceClass</parameter>
<operation name="operation1">
<messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
<actionMapping>urn:operation1</actionMapping>
</operation>
</service>
During initialization following exception is thrown
ERROR [org.apache.axis2.deployment.ServiceBuilder] - Error in schema generating Sorry we don't support methods overloading !!!!
java.lang.Exception: Sorry we don't support methods overloading !!!!
at org.apache.ws.java2wsdl.SchemaGenerator.generateSchema(SchemaGenerator.java:143)
at org.apache.axis2.deployment.util.Utils.fillAxisService
(Utils.java:213)
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:149)
at org.apache.axis2.deployment.ServiceGroupBuilder.populateServiceGroup(ServiceGroupBuilder.java:91)
at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:84)
at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:118)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:620)
at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:195)
at org.apache.axis2.deployment.RepositoryListener.update
(RepositoryListener.java:207)
at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:155)
at org.apache.axis2.deployment.DeploymentEngine.loadServices(DeploymentEngine.java:91)
at org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices(WarBasedAxisConfigurator.java:142)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java
:42)
at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:213)
at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:182)
- To workaround this, I had to create a base class and move the real implementation method in base class
class BaseClass
{
//real implementation of service
OMElement operation1(){.... }
}
class ServiceClass extends BaseClass
{
//service wrapper
public OMElement operation1(OMElement in){.... }
}
Looking into the axis source, found that org.apache.ws.java2wsdl.SchemaGenerator.generateSchema method uses getDeclaredMethods() call to find the methods in the service class, and as getDeclaredMethods does not returns methods inherited by a class, the workaround works.
The irony is that, in my case, since I'm not using RPC message receivers, the SchemaGenerator class anyway is not useful, as it does not work for non RPC cases
I'm wondering if not seeing inherited methods is a bug or a feature... but either way, this could be put somewhere in documentation. The message Sorry we don't support methods overloading is a bit misleading as I'm using overloaded (inherited) methods.
-Ajay Upadhyaya
- [axis2] Sorry we don't support methods overloading..... Ajay Upadhyaya
- Re: [axis2] Sorry we don't support methods overload... Deepal Jayasinghe
