getValue needs to be declared public method in service*stub.java e.g.
Yes, it is a public method
<!-- can you verify the operation name from your wsdl -->
<wsdl:operation name="CommitOperation">
<!-- are reflected into the operation_name -->
<!-- and the parameter as declared by wsdl:input -->
<wsdl:input message="wsat:Commit"/>
<!-- is reflected as the parameter to the method -->
Yes I can, it is correct, please find the below WSDL for getValue
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:axis2="http://services/" xmlns:ns1="http://org.apache.axis2/xsd"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:ns0="http://services/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
targetNamespace="http://services/">
<wsdl:documentation>TwoPara</wsdl:documentation>
<wsdl:types>
<xs:schema xmlns:ns="http://services/xsd"
attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://services/xsd">
<xs:element name="getValue">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="n1" type="xs:int"/>
<xs:element minOccurs="0" name="n2" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getValueResponse">
<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="getValueRequest">
<wsdl:part name="parameters" element="ns0:getValue"/>
</wsdl:message>
<wsdl:message name="getValueResponse">
<wsdl:part name="parameters" element="ns0:getValueResponse"/>
</wsdl:message>
<wsdl:portType name="TwoParaPortType">
<wsdl:operation name="getValue">
<wsdl:input message="axis2:getValueRequest"
wsaw:Action="urn:getValue"/>
<wsdl:output message="axis2:getValueResponse"
wsaw:Action="urn:getValueResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TwoParaSOAP11Binding" type="axis2:TwoParaPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
<wsdl:operation name="getValue">
<soap:operation soapAction="urn:getValue" 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="TwoParaSOAP12Binding" type="axis2:TwoParaPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
<wsdl:operation name="getValue">
<soap12:operation soapAction="urn:getValue" 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="TwoParaHttpBinding" type="axis2:TwoParaPortType">
<http:binding verb="POST"/>
<wsdl:operation name="getValue">
<http:operation location="TwoPara/getValue"/>
<wsdl:input>
<mime:content type="text/xml" part="getValue"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="getValue"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TwoPara">
<wsdl:port name="TwoParaSOAP11port_http"
binding="axis2:TwoParaSOAP11Binding">
<soap:address
location="http://localhost:8080/axis2/services/TwoPara.TwoParaSOAP11port_http/"/
( 'http://localhost:8080/axis2/services/TwoPara.TwoParaSOAP11port_http/"/' )>
</wsdl:port>
<wsdl:port name="TwoParaSOAP12port_http"
binding="axis2:TwoParaSOAP12Binding">
<soap12:address
location="http://localhost:8080/axis2/services/TwoPara.TwoParaSOAP12port_http/"/
( 'http://localhost:8080/axis2/services/TwoPara.TwoParaSOAP12port_http/"/' )>
</wsdl:port>
<wsdl:port name="TwoParaHttpport" binding="axis2:TwoParaHttpBinding">
<http:address
location="http://localhost:8080/axis2/services/TwoPara.TwoParaHttpport/"/ (
'http://localhost:8080/axis2/services/TwoPara.TwoParaHttpport/"/' )>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
And my code for invoking the operation is as below;
public void creatClient() {
try {
ServiceClient sc = new ServiceClient();
sc.engageModule("addressing");
Options opts = new Options();
opts.setTo(new
EndpointReference("http://localhost:6060/axis2/services/TwoPara"));
opts.setAction("getValue");
opts.setManageSession(true);
sc.setOptions(opts);
OMElement responce = sc.sendReceive(new
QName("getValue"),getPayload());
} catch (Exception ex) {
Logger.getLogger(NewServiceClient.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static OMElement getPayload() {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://services/xsd",
"getValue");
OMElement method = fac.createOMElement("getValue", omNs);
OMElement value1 = fac.createOMElement("n1", omNs);
value1.addChild(fac.createOMText(value1, "1000"));
method.addChild(value1);
OMElement value2 = fac.createOMElement("n2", omNs);
value2.addChild(fac.createOMText(value2, "1000"));
method.addChild(value2);
return method;
}
>>> Martin Gainty <[email protected]> 9/05/2011 11:57 AM >>>
<!-- can you verify the operation name from your wsdl -->
<wsdl:operation name="CommitOperation">
<!-- are reflected into the operation_name -->
<!-- and the parameter as declared by wsdl:input -->
<wsdl:input message="wsat:Commit"/>
<!-- is reflected as the parameter to the method -->