Package org.apache.axis2.client

Examples of org.apache.axis2.client.MessageSender


    if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
      System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
      return;
    }
   
    MessageSender sender = new MessageSender (AXIS2_CLIENT_PATH);
    Options clientOptions = new Options ();
    clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean (true));
    sender.setClientOptions(clientOptions);
    clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    clientOptions.setProperty(Sandesha2ClientAPI.AcksTo,acksToEPR);
    sender.engageModule(new QName ("Sandesha2-0.9"));
    clientOptions.setTo(new EndpointReference(toEPR));
    clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1");
    sender.send("ping",getPingOMBlock("ping1"));
    sender.send("ping",getPingOMBlock("ping2"));
    clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true");
    sender.send("ping",getPingOMBlock("ping3"));
  }
View Full Code Here


    if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
      System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
      return;
    }
   
    MessageSender sender = new MessageSender (AXIS2_CLIENT_PATH);
    Options clientOptions = new Options ();
    sender.setClientOptions(clientOptions);
    sender.engageModule(new QName ("sandesha"));
    clientOptions.setProperty(ClientAPI.SANDESHA_DEBUG_MODE,"on");   //Sets the debug on for sandesha.
    clientOptions.setTo(new EndpointReference(to));
    clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
    clientOptions.setProperty(ClientAPI.AcksTo,"http://www-lk.wso2.com:9080/axis2/services/AnonymousService/echoString");
    clientOptions.setReplyTo(new EndpointReference ("http://www-lk.wso2.com:9080/axis2/services/AnonymousService/echoString"));
    clientOptions.setFaultTo(new EndpointReference ("http://www-lk.wso2.com:9080/axis2/services/AnonymousService/echoString"));
    clientOptions.setProperty(ClientAPI.SEQUENCE_KEY,"sequence1");
    clientOptions.setSoapAction("urn:wsrm:Ping");
    clientOptions.setAction("urn:wsrm:Ping");
      sender.send("ping",getPingOMBlock("Microsoft-1"));
    sender.send("ping",getPingOMBlock("Microsoft-2"));
    clientOptions.setProperty(ClientAPI.LAST_MESSAGE, "true");
    sender.send("ping",getPingOMBlock("Microsoft-3"));
  }
View Full Code Here

    if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
      System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
      return;
    }
   
    MessageSender sender = new MessageSender (AXIS2_CLIENT_PATH);
    Options clientOptions = new Options ();
    sender.setClientOptions(clientOptions);
    sender.engageModule(new QName ("sandesha"));
    clientOptions.setProperty(ClientAPI.SANDESHA_DEBUG_MODE,"on");   //Sets the debug on for sandesha.
    clientOptions.setTo(new EndpointReference("http://131.107.72.15/ReliableMessaging_Service_Indigo/ReliableOneWay.svc"));
    clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
    clientOptions.setProperty(ClientAPI.SEQUENCE_KEY,"sequence1");
    clientOptions.setSoapAction("urn:wsrm:Ping");
    clientOptions.setAction("urn:wsrm:Ping");
      sender.send("ping",getPingOMBlock("Microsoft-1"));
    sender.send("ping",getPingOMBlock("Microsoft-2"));
    clientOptions.setProperty(ClientAPI.LAST_MESSAGE, "true");
    sender.send("ping",getPingOMBlock("Microsoft-3"));
  }
View Full Code Here

    if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
      System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
      return;
    }
   
    MessageSender sender = new MessageSender (AXIS2_CLIENT_PATH);
    sender.engageModule(new QName ("Sandesha2-0.9"));
    Options clientOptions = new Options ();
    sender.setClientOptions(clientOptions);
    clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean (true));
    clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    clientOptions.setTo(new EndpointReference(toEPR));
    clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1");
    sender.send("ping",getPingOMBlock("ping1"));
    sender.send("ping",getPingOMBlock("ping2"));
    clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true");
    sender.send("ping",getPingOMBlock("ping3"));

  }
View Full Code Here

    public void testEchoXMLSync() throws Exception {
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();

        OMElement payload = TestingUtils.createDummyOMElement();

        MessageSender sender = new MessageSender("target/test-resources/intregrationRepo");

        Options options = new Options();
        sender.setClientOptions(options);
        options.setTo(targetEPR);

        sender.send(operationName.getLocalPart(), payload);
        int index = 0;
        while (envelope == null) {
            Thread.sleep(4000);
            index++;
            if (index == 5) {
View Full Code Here

    public void testEchoXMLSync() throws Exception {
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();

        OMElement payload = createEnvelope();

        MessageSender sender = new MessageSender("target/test-resources/intregrationRepo");

        Options options = new Options();
        sender.setClientOptions(options);
        options.setTo(targetEPR);
        options.setSenderTransport(tOut);
        options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        sender.send(operationName.getLocalPart(), payload);

    }
View Full Code Here

public class MailClient {

    private static String toEpr = "http://localhost:8080/axis2/services/myservice";

    public static void main(String[] args) throws AxisFault {
        MessageSender msgSender = new MessageSender();

        Options options = new Options();
        options.setTo(
                new EndpointReference(toEpr));
        msgSender.setClientOptions(options);

        msgSender.send("echo", getPayload());
    }
View Full Code Here

    public static void main(String[] args) {
        try {
            OMElement payload = ClientUtil.getPingOMElement();

            MessageSender msgSender = new MessageSender();

            Options options = new Options();
            msgSender.setClientOptions(options);
            options.setTo(targetEPR);

            msgSender.send("ping", payload);

        } catch (AxisFault axisFault) {
            axisFault.printStackTrace();
        }
    }
View Full Code Here

        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();

        OMElement payload = createEnvelope();

        MessageSender sender = new MessageSender(serviceContext);

        Options options = new Options();
        options.setTo(targetEPR);

        sender.send(operationName.getLocalPart(), payload);
        int index = 0;
        while (envelope == null) {
//          if(index < 10){
            Thread.sleep(4000);
//                index++;
View Full Code Here

                        OMAbstractFactory.getSOAP11Factory() : OMAbstractFactory.getSOAP12Factory();
                fac.createSOAPHeader(axisOutMsgCtx.getEnvelope());
            }
        }

        OperationClient mepClient = axisAnonymousOperation.createClient(serviceCtx, clientOptions);
        mepClient.addMessageContext(axisOutMsgCtx);
        axisOutMsgCtx.setAxisMessage(
            axisAnonymousOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE));

        // set the SEND_TIMEOUT for transport sender
        if (endpoint != null && endpoint.getTimeoutDuration() > 0) {
            axisOutMsgCtx.setProperty(SynapseConstants.SEND_TIMEOUT, endpoint.getTimeoutDuration());
        }

        if (!outOnlyMessage) {
            // always set a callback as we decide if the send it blocking or non blocking within
            // the MEP client. This does not cause an overhead, as we simply create a 'holder'
            // object with a reference to the outgoing synapse message context
            // synapseOutMessageContext
            AsyncCallback callback = new AsyncCallback(synapseOutMessageContext);
            if (endpoint != null) {
                // set the timeout time and the timeout action to the callback, so that the
                // TimeoutHandler can detect timed out callbacks and take approprite action.
                callback.setTimeOutOn(System.currentTimeMillis() + endpoint.getTimeoutDuration());
                callback.setTimeOutAction(endpoint.getTimeoutAction());
            } else {
                callback.setTimeOutOn(System.currentTimeMillis());
            }
            mepClient.setCallback(callback);
        }

        // this is a temporary fix for converting messages from HTTP 1.1 chunking to HTTP 1.0.
        // Without this HTTP transport can block & become unresponsive because we are streaming
        // HTTP 1.1 messages and HTTP 1.0 require the whole message to caculate the content length
        if (originalInMsgCtx.isPropertyTrue(NhttpConstants.FORCE_HTTP_1_0)) {
            synapseOutMessageContext.getEnvelope().toString();
        }

        // with the nio transport, this causes the listener not to write a 202
        // Accepted response, as this implies that Synapse does not yet know if
        // a 202 or 200 response would be written back.
        originalInMsgCtx.getOperationContext().setProperty(
            org.apache.axis2.Constants.RESPONSE_WRITTEN, "SKIP");

        // if the transport out is explicitly set use it
        Object o = originalInMsgCtx.getProperty("TRANSPORT_OUT_DESCRIPTION");
        if (o != null && o instanceof TransportOutDescription) {
            axisOutMsgCtx.setTransportOut((TransportOutDescription) o);
            clientOptions.setTransportOut((TransportOutDescription) o);
            clientOptions.setProperty("TRANSPORT_OUT_DESCRIPTION", o);
        }

        mepClient.execute(true);
        if (wsRMEnabled) {
            Object rm11 = clientOptions.getProperty(SandeshaClientConstants.RM_SPEC_VERSION);
            if ( (rm11 != null) && rm11.equals(Sandesha2Constants.SPEC_VERSIONS.v1_1)){
                ServiceClient serviceClient = new ServiceClient(
                        axisOutMsgCtx.getConfigurationContext(), axisOutMsgCtx.getAxisService());
View Full Code Here

TOP

Related Classes of org.apache.axis2.client.MessageSender

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.