RE: [Axis2] synchronous dual channel blocking service invocation failed with error "Unable to engage module : addressing"

Stadelmann Josef <[email protected]>
Newsgroups gmane.text.xml.axis.user
Message-ID <DB774472C2709D43B623B28A47252E223CA83C70@wwfemr01.chres1.doleni.net>
Did you engage the addressing module at the client and at the server?

The second thing is to then think about how a server can call back the proper client.
This information must go to the server on initial call and that is why addressing is needed on either side.

Josef


From: Ashish Soni [mailto:[email protected]]
Sent: Donnerstag, 25. September 2014 17:05
To: [email protected]
Subject: [Axis2] synchronous dual channel blocking service invocation failed with error "Unable to engage module : addressing"

Hi,
I am trying to write "synchronous dual channel blocking service invocation." client code.
While running the code i am getting the error:
"org.apache.axis2.AxisFault: Unable to engage module : addressing
    at org.apache.axis2.client.ServiceClient.engageModule(ServiceClient.java:363)
    at edu.in.siemens.webservice.client.HelloWorldClient.main(HelloWorldClient.java:49)"

Ref:http://axis.apache.org/axis2/java/core/docs/userguide-samples.html
Client Code:
package edu.in.siemens.webservice.client;

import java.io.StringWriter;

import javax.xml.namespace.QName;
import javax.xml.stream.XMLOutputFactory;

import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.client.async.AsyncResult;
import org.apache.axis2.client.async.AxisCallback;
import org.apache.axis2.client.async.Callback;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.context.MessageContext;

public class HelloWorldClient {
    private static EndpointReference targetEPR = new EndpointReference(
            "http://localhost:8080/axis2/services/UserGuideSampleService");

    public static void main(String[] args) throws Exception {
        ServiceClient client = new ServiceClient();

        try {

            OMFactory factory = OMAbstractFactory.getOMFactory();
            OMNamespace namespace = factory.createOMNamespace(
                    "http://example1.org/example1", "example1");

            OMElement method = factory.createOMElement("sayHello", namespace);
            OMElement value = factory.createOMElement("personToGreet",
                    namespace);

            value.addChild(factory.createOMText(value, "Ashish Soni"));
            method.addChild(value);

            Options options = new Options();
            options.setTo(targetEPR);
            options.setUseSeparateListener(true);
            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

            client.engageModule(Constants.MODULE_ADDRESSING);
            client.setOptions(options);
            OMElement result = client.sendReceive(method);

            StringWriter writer = new StringWriter();
            result.serialize(XMLOutputFactory.newInstance()
                    .createXMLStreamWriter(writer));
            writer.flush();
            System.out.println(writer.toString());
        } catch (AxisFault axisFault) {
            axisFault.printStackTrace();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            try {
                client.cleanup();
            } catch (AxisFault axisFault) {
                //
            }
        }
    }
}

Is any specific setup is required to run the client code.
--
Ashish Soni
Bangalore(Karnataka)- 560076

"A dream becomes a goal when action is taken toward its achievement."
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.