Package org.apache.axis2.client

Examples of org.apache.axis2.client.ServiceClient


    clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
   
    //setting the SOAP version as 1.1
    clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);

    ServiceClient serviceClient = new ServiceClient (configContext,null);
    //serviceClient.
   
    serviceClient.setOptions(clientOptions);
   
    clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
    serviceClient.fireAndForget(getPingOMBlock("ping3"));

    Thread.sleep(10000);
       
    SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
    assertTrue(sequenceReport.getCompletedMessages().contains(new Long(1)));
    assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
    assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
 
    configContext.getListenerManager().stop();
    serviceClient.cleanup();
  }
View Full Code Here


    clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
   
    //setting the SOAP version as 1.2
    clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
   
    ServiceClient serviceClient = new ServiceClient (configContext,null);
    //serviceClient.
   
    serviceClient.setOptions(clientOptions);
   
    clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
    serviceClient.fireAndForget(getPingOMBlock("ping3"));

    Thread.sleep(10000);
       
    SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
    assertTrue(sequenceReport.getCompletedMessages().contains(new Long(1)));
    assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
    assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
 
    configContext.getListenerManager().stop();
    serviceClient.cleanup();
  }
View Full Code Here

    String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
    
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);

    ServiceClient serviceClient = new ServiceClient (configContext,null)
   
    Options clientOptions = new Options ();
   
//    clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean (true));
    clientOptions.setTo(new EndpointReference (toAddress));
   
    String acksTo = null; //serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
    clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
   
    String sequenceKey = "sequence4";
    clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
   
    clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToAddress);
   
//    clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE);   //uncomment this to send messages without chunking.
   
//    clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);   //uncomment this to send messages in SOAP 1.2
   
    clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1)//uncomment this to send the messages according to the v1_1 spec.
   
//    clientOptions.setProperty(SandeshaClient.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID());  //Uncomment this to offer a sequenceID for the incoming sequence.
   
//    clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);

    clientOptions.setAction("urn:wsrm:EchoString");
   
    //You must set the following two properties in the request-reply case.
    clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
    clientOptions.setUseSeparateListener(true);
   
    serviceClient.setOptions(clientOptions);

    Callback callback1 = new TestCallback ("Callback 1");
    serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1);
   
    Callback callback2 = new TestCallback ("Callback 2");
    serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2);

   
    Callback callback3 = new TestCallback ("Callback 3");
    serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3);
   
        while (!callback3.isComplete()) {
            Thread.sleep(1000);
        }
       
View Full Code Here

 
  private void runStubBased () throws Exception {
    ConfigurationContext configurationContext = getConfigurationContext();
   
    RMInteropServiceStub stub = new RMInteropServiceStub (configurationContext, toAddress);
    ServiceClient stubServiceClient = stub._getServiceClient();
   
    String sequenceKey = "sequence4";
    String acksTo = null; //serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
   
    Options options = stubServiceClient.getOptions();
    setUpOptions(options, sequenceKey, acksTo);
   
    EchoString echoString = new EchoString ();
    echoString.setEchoString (new EchoStringRequestBodyType ());
    echoString.getEchoString().setSequence(sequenceKey);
View Full Code Here

  }
 
  private void run () throws Exception {
   
    ConfigurationContext configurationContext = getConfigurationContext();
    ServiceClient serviceClient = new ServiceClient (configurationContext,null)
   
    Options clientOptions = new Options ();

        serviceClient.engageModule(new QName("rampart"));
       
    String sequenceKey = "sequence4";
    String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
   
    setUpOptions(clientOptions, sequenceKey,acksTo);

    OMFactory factory = OMAbstractFactory.getOMFactory();
    OMNamespace namespace = factory.createOMNamespace("urn:wsrm:InteropOptions","rmi");
    OMElement acceptOfferElem = factory.createOMElement("acceptOffer",namespace);
    OMElement useOfferElem = factory.createOMElement("useOffer",namespace);
    acceptOfferElem.setText("true");
    useOfferElem.setText("true");
//    toEPR.addReferenceParameter(acceptOfferElem);
//    toEPR.addReferenceParameter(useOfferElem);
//    clientOptions.setManageSession(true); // without this reference params wont go.
   
    clientOptions.setReplyTo(new EndpointReference (AddressingConstants.Final.WSA_ANONYMOUS_URL));
   
    EndpointReference toEPR = new EndpointReference (toAddress);
    serviceClient.setTargetEPR(toEPR);
   
    serviceClient.setOptions(clientOptions);

    Callback callback1 = new TestCallback ("Callback 1");
    serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1);
   
    Callback callback2 = new TestCallback ("Callback 2");
    serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2);
   
    Callback callback3 = new TestCallback ("Callback 3");
    serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3);
   
        while (!callback3.isComplete()) {
            Thread.sleep(1000);
        }
       
View Full Code Here

  private void runStubBased () throws Exception {

    ConfigurationContext configurationContext = getConfigurationContext();
   
    RMInteropServiceStub stub = new RMInteropServiceStub (configurationContext, toAddress);
    ServiceClient stubServiceClient = stub._getServiceClient();
   
    String sequenceKey = "sequence4";
    String acksTo = stubServiceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
   
    Options options = stubServiceClient.getOptions();
    setUpOptions(options, sequenceKey, acksTo);
   
    EchoString echoString = new EchoString ();
    echoString.setEchoString (new EchoStringRequestBodyType ());
    echoString.getEchoString().setSequence(sequenceKey);
View Full Code Here

    ConfigurationContext configurationContext = generateConfigContext();
   
    Options clientOptions = new Options ();
    setUpOptions(clientOptions);
   
    ServiceClient serviceClient = new ServiceClient (configurationContext,null);   
    serviceClient.setOptions(clientOptions);
   
    clientOptions.setProperty(SandeshaClientConstants.MESSAGE_NUMBER,new Long(1));
    serviceClient.fireAndForget(getPingOMBlock("ping1"));
   
    clientOptions.setProperty(SandeshaClientConstants.MESSAGE_NUMBER,new Long(3));
    serviceClient.fireAndForget(getPingOMBlock("ping3"));
   
    boolean complete = false;
    while (!complete) {
      SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
      if (sequenceReport!=null && sequenceReport.getCompletedMessages().size()==2)
        complete = true;
      else {
        try {
          Thread.sleep(1000);
        } catch (InterruptedException e1) {
          e1.printStackTrace();
        }
      }
    }

    SandeshaClient.closeSequence(serviceClient);
   
    try {
      Thread.sleep(3000);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
   
    SandeshaClient.terminateSequence(serviceClient);
   
    try {
      Thread.sleep(3000);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
 
    configurationContext.getListenerManager().stop();
    serviceClient.cleanup();
  }
View Full Code Here

 
  private void runStubBased () throws Exception {
   
    ConfigurationContext configurationContext = generateConfigContext();
    RMInteropServiceStub stub = new RMInteropServiceStub (configurationContext,toEPR);
    ServiceClient stubServiceClient = stub._getServiceClient();
   
    Options options = stubServiceClient.getOptions();
    setUpOptions(options);
   
    options.setProperty(SandeshaClientConstants.MESSAGE_NUMBER,new Long(1));
    Ping ping = new Ping ();
    ping.setText("ping1");
    stub.Ping(ping);
   
    options.setProperty(SandeshaClientConstants.MESSAGE_NUMBER,new Long(3));
    ping = new Ping ();
    ping.setText("ping2");
    stub.Ping(ping);
   
    boolean complete = false;
    while (!complete) {
      SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(stubServiceClient);
      if (sequenceReport!=null && sequenceReport.getCompletedMessages().size()==2)
        complete = true;
      else {
        try {
          Thread.sleep(1000);
        } catch (InterruptedException e1) {
          e1.printStackTrace();
        }
      }
    }

    SandeshaClient.closeSequence(stubServiceClient);
   
    try {
      Thread.sleep(6000);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
   
    SandeshaClient.terminateSequence(stubServiceClient);
   
    try {
      Thread.sleep(3000000);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
   
    stubServiceClient.cleanup();
   
   
  }
View Full Code Here

  private void run() throws Exception {

    ConfigurationContext configurationContext = generateConfigContext();
   
    ServiceClient serviceClient = new ServiceClient(configurationContext, null);
   
//    String replyAddress = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress() + "/" + ServiceClient.ANON_OUT_ONLY_OP;
    String acksToAddress = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
   
    Options clientOptions = new Options();
    setUpOptions(clientOptions,acksToAddress);

    serviceClient.setOptions(clientOptions);

    serviceClient.fireAndForget(getPingOMBlock("ping1"));
    serviceClient.fireAndForget(getPingOMBlock("ping2"));
    serviceClient.fireAndForget(getPingOMBlock("ping3"));

    boolean complete = false;
    while (!complete) {
      SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
      if (sequenceReport!=null && sequenceReport.getCompletedMessages().size()==3)
        complete = true;
      else {
        try {
          Thread.sleep(1000);
        } catch (InterruptedException e1) {
          e1.printStackTrace();
        }
      }
    }

    SandeshaClient.terminateSequence(serviceClient);
   
    Thread.sleep(3000);
   
    configurationContext.getListenerManager().stop();
    serviceClient.cleanup();
  }
View Full Code Here

  private void runStubBased () throws Exception {
    String targetEndpoint = toEPR;
    ConfigurationContext configurationContext = generateConfigContext();
   
    RMInteropServiceStub stub = new RMInteropServiceStub (configurationContext, targetEndpoint);
    ServiceClient stubServiceClient = stub._getServiceClient();
   
    String acksToAddress = stubServiceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
   
    setUpOptions(stubServiceClient.getOptions(),acksToAddress);
   
    Ping ping = new Ping ();
    ping.setText("ping1");
    stub.Ping(ping);
   
View Full Code Here

TOP

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

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.