axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stadelmann Josef" <josef.stadelm...@axa-winterthur.ch>
Subject AW: Creating Dynamic Client
Date Mon, 16 May 2011 13:38:55 GMT
Did you engage the addressing module on the client and the server side? This is important.

The same addressing module must go to the client and the server into proper directories.

Josef.

 

Von: Mark Bullathsinghalage Cooray [mailto:mbcooray@groupwise.swin.edu.au] 
Gesendet: Freitag, 6. Mai 2011 02:28
An: java-user@axis.apache.org
Betreff: RE: Creating Dynamic Client

 

The error seems to be coming from Addressing module engage. If there is any one who could
give me a direction please assist me

 

INFO: Deploying module: addressing
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.axis2.context.MessageContext.getLocalProperty(Ljava/lang/String;)Ljava/lang/Object;
        at org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.processMessageID(AddressingOutHandler.java:253)
        at org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.writeHeaders(AddressingOutHandler.java:226)
        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 org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508)
        at axiomtryout.ServiceClientMultiOps.creatClient(ServiceClientMultiOps.java:46)
        at axiomtryout.Main.main(Main.java:30)

 


>>> "Mark Bullathsinghalage Cooray" <mbcooray@groupwise.swin.edu.au> 5/05/2011
11:46 AM >>>

Hi 

 

I did the change to;

 

 

 

OMElement responce = sc.sendReceive(getPayload());

 

 

 

public static OMElement getPayload(){
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://services/xsd <http://services/xsd>
", "ns0");
        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;
    }

 

But doesn't seems to work the error remains



>>> Martin Gainty <mgainty@hotmail.com> 5/05/2011 11:25 AM >>>
the receiving method for the client must be declared public static e.g.
public static OMElement getPricePayload(String symbol) 

sendReceive identifies the method (without parenthesis) e.g.
OMElement result = sender.sendReceive(getPricePayload);

Martin 
______________________________________________ 
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: Thu, 5 May 2011 10:35:00 +1000
From: mbcooray@groupwise.swin.edu.au
To: java-user@axis.apache.org
Subject: Creating Dynamic Client

Hi,

 

I need to create a client(s) on the fly. I tried using service client on a simple service
that has single operation that takes two parameters. At deployment point I started getting
following errors;

 

1.       org.apache.axis2.AxisFault: The service cannot be found for the endpoint reference
(EPR)

To overcome this problem I followed the guidelines given in [1]. However, it is also evident
by [2] that I should define the addressing module for the service that I am referring to.
By adding following code;

 

public void creatClient(){
        try {           
            
            ConfigurationContext myConfigContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem("C:/axis2-1.5.4/repository","C:/axis2-1.5.4/conf/axis2.xml");

 

            Options opts = new Options();
            opts.setTo(new EndpointReference("http://localhost:8080/axis2/services/TwoPara
<http://localhost:8080/axis2/services/TwoPara> "));
            opts.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
            opts.setProperty(AddressingConstants.INCLUDE_OPTIONAL_HEADERS,Boolean.TRUE);
            opts.activate(myConfigContext);
            opts.setAction("getValue");

 

            ServiceClient sc = new ServiceClient();
         
            sc.engageModule("addressing");            
            sc.setOptions(opts);

 

            //Error comes from this point

            OMElement responce = sc.sendReceive(getPayload());
            

            System.out.println(responce);

 

        } catch (AxisFault ex) {
            Logger.getLogger(ServiceClientBlocking.class.getName()).log(Level.SEVERE, null,
ex);
        }
    }

 

Then I loaded following .jar files to overcome some other errors that I got after implementing
the above code.

tomcat-6.0.16-catalina-tribes.jar 

axis2-jaxws-1.5.4.jar 

axis2-kernel-1.5.4.jar 

addressing-1.5.4-classpath-module.jar 

soapmonitor-1.5.4-javadoc.jar 

 

However, I am still getting following error message and cant seems to find any posts or literature
about a similar exception.

 

ERROR : 

 

INFO: Deploying module: addressing
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.axis2.context.MessageContext.getLocalProperty(Ljava/lang/String;)Ljava/lang/Object;
        at org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.processMessageID(AddressingOutHandler.java:253)
        at org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.writeHeaders(AddressingOutHandler.java:226)
        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 org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508)
        at axiomtryout.ServiceClientMultiOps.creatClient(ServiceClientMultiOps.java:46)
        at axiomtryout.Main.main(Main.java:30) 

 

 

Please be good enough to give me a direction in solving this issue.

 

Reference

 

[1] http://www.keith-chapman.org/2009/02/axis2-endpoint-reference-epr-for.html

[2]http://stackoverflow.com/questions/2526012/how-do-i-use-ws-addressing-properly-in-an-axis2-client

Mime
View raw message