axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: NoSuchMethodError: org.apache.axis2.addressing.EndpointReference.isWSAddressingAnonymous()Z
Date Mon, 09 May 2011 01:57:52 GMT

getValue needs to be declared public method in service*stub.java e.g.

assuming this wsdl
    <wsdl:portType name="CompletionCoordinatorPortType">
        <wsdl:operation name="CommitOperation">
            <wsdl:input message="wsat:Commit"/>
        </wsdl:operation>
    </wsdl:portType>
<!-- wsdl2java will creates the CommitOperation method as seen here -->

public  org.xmlsoap.schemas.ws._2003._09.wsat.XxxStub.Committed commitOperation(org.xmlsoap.schemas.ws._2003._09.wsat.XxxStub.Commit
commit2) throws java.rmi.RemoteException
{
      org.apache.axis2.context.MessageContext _messageContext = null;
      try{
               org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[1].getName());
              _operationClient.getOptions().setAction("http://xxx");
              _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);     
                                                                       addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&");
              // create a message context
              _messageContext = new org.apache.axis2.context.MessageContext();
              // create SOAP envelope with that payload
              org.apache.axiom.soap.SOAPEnvelope env = null;                             
         
             env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
                                                    commit2,
                                                    optimizeContent(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2003/09/wsat",
                                                    "commitOperation")));
        //adding SOAP soap_headers
         _serviceClient.addHeadersToEnvelope(env);
        // set the message context with that soap envelope
        _messageContext.setEnvelope(env);
        // add the message contxt to the operation client
        _operationClient.addMessageContext(_messageContext);
        //execute the operation client
        _operationClient.execute(true);
 
        org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(
                                           org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
               
        java.lang.Object object = fromOM(
                                             _returnEnv.getBody().getFirstElement() ,
                                             org.xmlsoap.schemas.ws._2003._09.wsat.XxxStub.Committed.class,
                                              getEnvelopeNamespaces(_returnEnv));

                               
                                        return (org.xmlsoap.schemas.ws._2003._09.wsat.XxxStub.Committed)object;
                                   
     }
     catch(org.apache.axis2.AxisFault f)
     {
            org.apache.axiom.om.OMElement faultElt = f.getDetail();
            if (faultElt!=null){
                if (faultExceptionNameMap.containsKey(faultElt.getQName())){
                    //make the fault by reflection
                    try{
                        java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(faultElt.getQName());
                        java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
                        java.lang.Exception ex=
                                (java.lang.Exception) exceptionClass.newInstance();
                        //message class
                        java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(faultElt.getQName());
                        java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
                        java.lang.Object messageObject = fromOM(faultElt,messageClass,null);
                        java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
                                   new java.lang.Class[]{messageClass});
                        m.invoke(ex,new java.lang.Object[]{messageObject});
                        

                        throw new java.rmi.RemoteException(ex.getMessage(), ex);
       }
       catch(java.lang.ClassCastException e)
       {
                       // we cannot intantiate the class - throw the original Axis fault
                        throw f;
       } 
       catch (java.lang.ClassNotFoundException e) 
       {
                        // we cannot intantiate the class - throw the original Axis fault
                        throw f;
       }
       catch (java.lang.NoSuchMethodException e) 
       {
                        // we cannot intantiate the class - throw the original Axis fault
                        throw f;
       } 
       catch (java.lang.reflect.InvocationTargetException e) 
      {
                        // we cannot intantiate the class - throw the original Axis fault
                        throw f;
      }  
      catch (java.lang.IllegalAccessException e) 
      {
                        // we cannot intantiate the class - throw the original Axis fault
                        throw f;
      }   
      catch (java.lang.InstantiationException e) 
      {
                        // we cannot intantiate the class - throw the original Axis fault
                        throw f;
      }
      finally 
      {
                _messageContext.getTransportOut().getSender().cleanup(_messageContext);
       }
}


<!-- 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 -->
?
Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni
et de confidentialité
 Ez az
üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten
wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist
unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet
keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.




Date: Mon, 9 May 2011 10:58:38 +1000
From: mbcooray@groupwise.swin.edu.au
To: java-user@axis.apache.org
Subject: RE: NoSuchMethodError: org.apache.axis2.addressing.EndpointReference.isWSAddressingAnonymous()Z









I Fixed the error : no such method, and did follow the below steps in creating a payload and
invoking the operation,
 
However, I get following error: 
09/05/2011 10:37:17 AM axiomtryout.NewServiceClient creatClient
SEVERE: null
org.apache.axis2.AxisFault: The getValue operation cannot be found.
        at org.apache.axis2.client.ServiceClient.createClient(ServiceClient.java:647)
        at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:537)
        at axiomtryout.NewServiceClient.creatClient(NewServiceClient.java:40)
        at axiomtryout.Main.main(Main.java:35)
 
I used TCP Monitor and I get Following POST
 
<?xml version='1.0' encoding='UTF-8'?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
         <wsa:To>http://localhost:6060/axis2/services/TwoPara</wsa:To>
         <wsa:MessageID>urn:uuid:4BF80F83066F1D03B11304902610754</wsa:MessageID>
         <wsa:Action>getValue</wsa:Action>
      </soapenv:Header>
      <soapenv:Body>
         <getValue:getValue xmlns:getValue="http://services/xsd">
            <getValue:n1>1000</getValue:n1>
            <getValue:n2>1000</getValue:n2>
         </getValue:getValue>
      </soapenv:Body>
   </soapenv:Envelope>0
 
 
The RESPONSE is
 
<?xml version='1.0' encoding='UTF-8'?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
         <wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</wsa:Action>
         <wsa:RelatesTo>urn:uuid:4BF80F83066F1D03B11304902610754</wsa:RelatesTo>
      </soapenv:Header>
      <soapenv:Body>
         <soapenv:Fault>
            <faultcode>soapenv:Server</faultcode>
            <faultstring>unknown</faultstring>
            <detail />
         </soapenv:Fault>
      </soapenv:Body>
   </soapenv:Envelope>
 
Any Idea?
 


>>> Martin Gainty <mgainty@hotmail.com> 6/05/2011 9:23 PM >>>
<!-- wsdl bindings appear incorrect assume this namespace declaration in wsdl:definitions
-->
<wsdl:definitions xmlns:ns="http://complex.tempuri.org"...>

<!--  then wsdl would define service posts for SOAP11point, SOAP12point and HttpEndpoint
-->
    <wsdl:service name="ComplexDataTypes">
        <wsdl:port name="ComplexDataTypesHttpSoap11Endpoint" binding="ns:ComplexDataTypesSoap11Binding">
            <soap:address location="http://localhost:8080/axis2/services/ComplexDataTypes"/>
        </wsdl:port>
        <wsdl:port name="ComplexDataTypesHttpSoap12Endpoint" binding="ns:ComplexDataTypesSoap12Binding">
            <soap12:address location="http://localhost:8080/axis2/services/ComplexDataTypes"/>
        </wsdl:port>
        <wsdl:port name="ComplexDataTypesHttpEndpoint" binding="ns:ComplexDataTypesHttpBinding">
            <http:address location="http://localhost:8080/axis2/services/ComplexDataTypes"/>
        </wsdl:port>
    </wsdl:service>

<!-- the aforementioned ComplexDataTypesSoap11Binding binding is declared as -->
    <wsdl:binding name="ComplexDataTypesSoap11Binding" type="ns:ComplexDataTypesPortType">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <wsdl:operation name="retUri">
            <soap:operation soapAction="urn:retUri" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>

<!-- where the aforementioned retUri Element is declared as complexType here -->
        <xs:schema xmlns:ax25="http://data.complex.tempuri.org/xsd" xmlns:ax26="http://arrays.data.complex.tempuri.org/xsd"
attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://complex.tempuri.org">
            <xs:import namespace="http://data.complex.tempuri.org/xsd"/>
            <xs:import namespace="http://arrays.data.complex.tempuri.org/xsd"/>
            <xs:element name="retUri">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="inUri" nillable="true" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>

//payload is a OMElement which will be received by method getValue identitied as retUri *an
array of strings* as seen here
        OMNamespace omNs = factory.createOMNamespace(
                "http://complex.tempuri.org", "retUri");
//method name
        OMElement method = factory.createOMElement("retUri", omNs);
//value if any 
        OMElement value = factory.createOMElement("Text", omNs);
        value.addChild(factory.createOMText(value, "Test String "));
//add the value to the testUri method
        method.addChild(value);

//the QName consists of the namespace and the aforementioned retUri operation
//the second param is the OMElement payload previously constructed which contains the value
OMElement response = serviceClient.sendReceive(new QName("retUri"), method);

this all works wonderfully a well-formed and validated wsdl and using the wsdl2java utility
wsdl2java -uri *.wsdl 

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten
wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist
unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet
keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.






Date: Fri, 6 May 2011 13:05:44 +1000
From: mbcooray@groupwise.swin.edu.au
To: java-user@axis.apache.org
Subject: NoSuchMethodError: org.apache.axis2.addressing.EndpointReference.isWSAddressingAnonymous()Z



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());;
            
        } 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/"/>
        </wsdl:port>
        <wsdl:port name="TwoParaSOAP12port_http" binding="axis2:TwoParaSOAP12Binding">
            <soap12:address location="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/"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions> 		 	   		  
Mime
View raw message