Web Service method in AXIS2 receives null arguments. Why?
I am new to java web services. While trying out a basic web service operation, I got stuck. I have been following this article as a reference. The service class is pretty simple and looks like this:
public class MyService {
public MyService() {
}
public Boolean Configure(String param, String val){
System.out.println("First arg: " + param + " Second arg:" + val); //Added by me.
return true;
}
public Boolean StartMe(){
return true;
}
public Boolean StopMe(){
return true;
}
public String getStatus(){
return "No status available!";
}
}
I have created the service using Eclipse (Bottom up Java bean Web Service) as mentioned on that article. To test my service I used Eclipse Web Service Explorer.
Now here comes the issue. When I set param values in the service explorer and hit go I see null values getting printed in the console (First arg: null Second arg:null). I have tried to solve this for many hours but still no luck. But there is no problem with other three methods. They are giving responses and I can see it in the service explorer. The WSDL that have been generated is this:
<wsdl:definitions targetNamespace="http://service.myapp.com">
<wsdl:documentation>
Please Type your service description here
</wsdl:documentation>
<wsdl:types>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://service.myapp.com">
<xs:element name="Configure">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="param" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="val" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ConfigureResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="StartMeResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="StopMeResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getStatusResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types><wsdl:message name="StartMeRequest"/>开发者_JAVA百科;
<wsdl:message name="StartMeResponse">
<wsdl:part name="parameters" element="ns:StartMeResponse"/>
</wsdl:message>
<wsdl:message name="ConfigureRequest">
<wsdl:part name="parameters" element="ns:Configure"/>
</wsdl:message>
<wsdl:message name="ConfigureResponse">
<wsdl:part name="parameters" element="ns:ConfigureResponse"/>
</wsdl:message><wsdl:message name="getStatusRequest"/>
<wsdl:message name="getStatusResponse">
<wsdl:part name="parameters" element="ns:getStatusResponse"/>
</wsdl:message><wsdl:message name="StopMeRequest"/>
<wsdl:message name="StopMeResponse">
<wsdl:part name="parameters" element="ns:StopMeResponse"/>
</wsdl:message>
<wsdl:portType name="MyServicePortType">
<wsdl:operation name="StartMe">
<wsdl:input message="ns:StartMeRequest" wsaw:Action="urn:StartMe"/><wsdl:output message="ns:StartMeResponse" wsaw:Action="urn:StartMeResponse"/>
</wsdl:operation>
<wsdl:operation name="Configure">
<wsdl:input message="ns:ConfigureRequest" wsaw:Action="urn:Configure"/><wsdl:output message="ns:ConfigureResponse" wsaw:Action="urn:ConfigureResponse"/>
</wsdl:operation>
<wsdl:operation name="getStatus">
<wsdl:input message="ns:getStatusRequest" wsaw:Action="urn:getStatus"/><wsdl:output message="ns:getStatusResponse" wsaw:Action="urn:getStatusResponse"/>
</wsdl:operation>
<wsdl:operation name="StopMe">
<wsdl:input message="ns:StopMeRequest" wsaw:Action="urn:StopMe"/><wsdl:output message="ns:StopMeResponse" wsaw:Action="urn:StopMeResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MyServiceSoap11Binding" type="ns:MyServicePortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="StartMe">
<soap:operation soapAction="urn:StartMe" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Configure">
<soap:operation soapAction="urn:Configure" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getStatus">
<soap:operation soapAction="urn:getStatus" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="StopMe">
<soap:operation soapAction="urn:StopMe" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="MyServiceSoap12Binding" type="ns:MyServicePortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="StartMe">
<soap12:operation soapAction="urn:StartMe" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Configure">
<soap12:operation soapAction="urn:Configure" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getStatus">
<soap12:operation soapAction="urn:getStatus" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="StopMe">
<soap12:operation soapAction="urn:StopMe" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="MyServiceHttpBinding" type="ns:MyServicePortType">
<http:binding verb="POST"/>
<wsdl:operation name="StartMe">
<http:operation location="MyService/StartMe"/>
<wsdl:input>
<mime:content type="text/xml" part="StartMe"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="StartMe"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Configure">
<http:operation location="MyService/Configure"/>
<wsdl:input>
<mime:content type="text/xml" part="Configure"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="Configure"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getStatus">
<http:operation location="MyService/getStatus"/>
<wsdl:input>
<mime:content type="text/xml" part="getStatus"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="getStatus"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="StopMe">
<http:operation location="MyService/StopMe"/>
<wsdl:input>
<mime:content type="text/xml" part="StopMe"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="StopMe"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MyService">
<wsdl:port name="MyServiceHttpSoap11Endpoint" binding="ns:MyServiceSoap11Binding">
<soap:address location="http://110.227.162.237:8080/WebServicePrototype/services/MyService.MyServiceHttpSoap11Endpoint/"/>
</wsdl:port>
<wsdl:port name="MyServiceHttpSoap12Endpoint" binding="ns:MyServiceSoap12Binding">
<soap12:address location="http://110.227.162.237:8080/WebServicePrototype/services/MyService.MyServiceHttpSoap12Endpoint/"/>
</wsdl:port>
<wsdl:port name="MyServiceHttpEndpoint" binding="ns:MyServiceHttpBinding">
<http:address location="http://110.227.162.237:8080/WebServicePrototype/services/MyService.MyServiceHttpEndpoint/"/>
</wsdl:port>
</wsdl:service>
I'm using : a) Eclipse: Ganymede/Galileo b) Tomcat 6.0 c) AXIS2 1.4.1
Please help me out or let me know whether I'm missing some basic fundamentals. Any help is much appreciated.
精彩评论