0
votes

I have created simple axis 2 web service using the command line.

Code

public class HelloAxis{
    public String sayHello(String name){
        return "Hello " + name;
    }
}

services.xml

<service name="HelloAxis"><description> Hello Axis2 web service </description>
    <messageReceivers>
       <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>                  
       <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> 
    </messageReceivers>
    <parameter name="ServiceClass">HelloAxis</parameter>
</service>

I created the aar file using jar -cvf HelloAxis.aar *

Then deploy it in the Axis2 server.

When I check the wsdl through the browser, parameter name is args0.

<xs:element name="sayHello">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="args0" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>

Why is that? It should be use name as name

But when I generate the aar file using eclipse plugin it use the correct name.

1

1 Answers

2
votes

To rename the parameters of your service use the @WebParam(name="") in front of each input variable to the service.

Therefore just replace your method signature

(String name)

with:

(@WebParam(name = "name") String name)