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: [email protected]
To: [email protected]
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";));
            
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
                                      

Reply via email to