Hi all,
 
I am trying a short sample code for Dynamic client as I was getting many errors 
with my previous post configuration context and addressing.
 
I modified my code to ;
 
public void creatClient() {
        try {
            ConfigurationContext configContext = 
ConfigurationContextFactory.createConfigurationContextFromFileSystem("C:/axis2-1.5.4/repository",
 "C:/axis2-1.5.4/conf/axis2.xml");
            Options opts = new Options();            
            ServiceClient dynamicClient = new ServiceClient(configContext, new 
URL("http://localhost:8080/axis2/services/TwoPara?wsdl";), null, null);
 
            OMElement responce = dynamicClient.sendReceive(new 
QName("http://services","getValue";),getPayload ( 
'http://services","getValue";),getPayload' )());;
            
        } catch (MalformedURLException ex) {
            
Logger.getLogger(NewServiceClient.class.getName()).log(Level.SEVERE, null, ex);
        } catch (AxisFault 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";, "xs");
        OMElement method = fac.createOMElement("getValue", omNs);
        OMElement value1 = fac.createOMElement("n1", omNs);
        value1.setText("1000");
        method.addChild(value1);
        OMElement value2 = fac.createOMElement("n2", omNs);
        value2.setText("1000");
        method.addChild(value2);
        return method;
    }
 
However Now I am getting an Addressing Exception as below;
 
INFO: Deploying Web service: version.aar
Exception in thread "main" java.lang.NoSuchMethodError: 
org.apache.axis2.addressing.EndpointReference.isWSAddressingAnonymous()Z
        at 
org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.processToEPR(AddressingOutHandler.java:422)
        at 
org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.writeHeaders(AddressingOutHandler.java:214)
        at 
org.apache.axis2.handlers.addressing.AddressingOutHandler.invoke(AddressingOutHandler.java:135)
        at org.apache.axis2.engine.Phase.invoke(Phase.java:292)
        at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:212)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:377)
        at 
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374)
        at 
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
        at 
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
        at 
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528)
        at axiomtryout.NewServiceClient.creatClient(NewServiceClient.java:35)
        at axiomtryout.Main.main(Main.java:35)
 
My WSDL for test service as below
 
<?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>

Reply via email to