Package org.apache.axis2.client

Examples of org.apache.axis2.client.Options


    }
  }

  public static void closeSequence(ServiceClient serviceClient, String sequenceKey) throws SandeshaException {

    Options options = serviceClient.getOptions();
    if (options == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.serviceContextNotSet));

    String specVersion = (String) options.getProperty(SandeshaClientConstants.RM_SPEC_VERSION);
    if (!Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(specVersion)) {
      String message = SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.closeSequenceSpecLevel,
          specVersion);
      throw new SandeshaException (message);
    }
   
    String oldSequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
    options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, sequenceKey);
    closeSequence(serviceClient);

    options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, oldSequenceKey);
  }
View Full Code Here


    waitUntilSequenceCompleted(serviceClient, -1);
  }

  public static void waitUntilSequenceCompleted(ServiceClient serviceClient, String sequenceKey)
      throws SandeshaException {
    Options options = serviceClient.getOptions();
    if (options == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.optionsObjectNotSet));

    String oldSequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
    options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, sequenceKey);
    waitUntilSequenceCompleted(serviceClient);

    options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, oldSequenceKey);
  }
View Full Code Here

  public static void main(String[] args) throws AxisFault {
   
    String axis2_xml = CLIENT_REPO_PATH + File.separator + "client_axis2.xml";
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(CLIENT_REPO_PATH,axis2_xml);
   
    Options clientOptions = new Options ();
    clientOptions.setTo(new EndpointReference (toEPR));

    ServiceClient serviceClient = new ServiceClient (configContext,null);
    clientOptions.setAction("urn:wsrm:Ping");
    serviceClient.setOptions(clientOptions);
   
    serviceClient.fireAndForget(getPingOMBlock("ping1"));
    serviceClient.fireAndForget(getPingOMBlock("ping2"));
   
    clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
    serviceClient.fireAndForget(getPingOMBlock("ping3"));
   
    try {
      Thread.sleep(4000);
    } catch (InterruptedException e) {
View Full Code Here

    }
  }

  public static void waitUntilSequenceCompleted(ServiceClient serviceClient, long maxWaitingTime, String sequenceKey)
      throws SandeshaException {
    Options options = serviceClient.getOptions();
    if (options == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.optionsObjectNotSet));

    String oldSequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
    options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, sequenceKey);
    waitUntilSequenceCompleted(serviceClient, maxWaitingTime);

    options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, oldSequenceKey);
  }
View Full Code Here

  public static void sendAckRequest(ServiceClient serviceClient) throws SandeshaException {

    setUpServiceClientAnonymousOperations (serviceClient);
   
    Options options = serviceClient.getOptions();
    if (options == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.optionsObjectNotSet));

    ServiceContext serviceContext = serviceClient.getServiceContext();
    if (serviceContext == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.serviceContextNotSet));

    ConfigurationContext configContext = serviceContext.getConfigurationContext();

    String rmSpecVersion = (String) options.getProperty(SandeshaClientConstants.RM_SPEC_VERSION);
    if (rmSpecVersion == null)
      rmSpecVersion = Sandesha2Constants.SPEC_VERSIONS.v1_0;

    if (Sandesha2Constants.SPEC_VERSIONS.v1_0.equals(rmSpecVersion)) {
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.emptyAckRequestSpecLevel, rmSpecVersion));
    }
   
    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(rmSpecVersion);

    SOAPEnvelope dummyEnvelope = configureAckRequest(options, configContext);
   
    OMElement ackRequestedHeaderBlock = dummyEnvelope.getHeader().getFirstChildWithName(
        new QName(rmNamespaceValue, Sandesha2Constants.WSRM_COMMON.ACK_REQUESTED));

    String oldAction = options.getAction();

    serviceClient.addHeader(ackRequestedHeaderBlock);

    try {
      //to inform the sandesha2 out handler
      serviceClient.fireAndForget (null);
    } catch (AxisFault e) {
      String message = SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.cannotSendAckRequestException, e.toString());
      throw new SandeshaException(message, e);
    }

    serviceClient.removeHeaders();
    options.setAction(oldAction);
  }
View Full Code Here

    serviceClient.removeHeaders();
    options.setAction(oldAction);
  }

  public static void sendAckRequest(ServiceClient serviceClient, String sequenceKey) throws SandeshaException {
    Options options = serviceClient.getOptions();
    if (options == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.optionsObjectNotSet));

    String oldSequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
    options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, sequenceKey);
    sendAckRequest(serviceClient);

    options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, oldSequenceKey);
  }
View Full Code Here

   * @return
   * @throws SandeshaException
   */
  private static String getInternalSequenceIdFromServiceClient(ServiceClient serviceClient) throws SandeshaException
  {
    Options options = serviceClient.getOptions();
    if (options == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.optionsObjectNotSet));

    EndpointReference toEPR = options.getTo();
    if (toEPR == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.toEPRNotValid, null));

    String to = toEPR.getAddress();
    String sequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);

    String internalSequenceID = SandeshaUtil.getInternalSequenceID(to, sequenceKey);

    return internalSequenceID;
  }
View Full Code Here

   
    String axis2_xml = CLIENT_REPO_PATH + File.separator +"client_axis2.xml";
        ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(CLIENT_REPO_PATH,axis2_xml);
    ServiceClient serviceClient = new ServiceClient (configContext,null)
   
    Options clientOptions = new Options ();
    clientOptions.setTo(new EndpointReference (toEPR));
    clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
    clientOptions.setUseSeparateListener(true);
    serviceClient.setOptions(clientOptions);

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

    clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
    Callback callback3 = new TestCallback ("Callback 3");
    serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3","sequence1"),callback3);
   
        while (!callback3.isComplete()) {
            Thread.sleep(1000);
View Full Code Here

    }
   
    String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
   
    Options clientOptions = new Options ()
    clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
    clientOptions.setTo(new EndpointReference (toEPR));
   
    String sequenceKey = SandeshaUtil.getUUID();// "sequence2";
    clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
     
//    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(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1);  //uncomment this to send the messages according to the v1_1 spec.
//    clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
   
    clientOptions.setProperty(SandeshaClientConstants.SANDESHA_LISTENER, new SandeshaListenerImpl ());
    ServiceClient serviceClient = new ServiceClient (configContext,null);
    serviceClient.engageModule(new QName ("sandesha2"));
   
    clientOptions.setAction("urn:wsrm:Ping");
    serviceClient.setOptions(clientOptions);
   
    clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");

    serviceClient.fireAndForget(getPingOMBlock());
    SandeshaClient.waitUntilSequenceCompleted(serviceClient);
   
    configContext.terminate();
View Full Code Here

    }
   
    String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
   
    Options clientOptions = new Options ()
    clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
    clientOptions.setTo(new EndpointReference (toEPR));
   
    String sequenceKey = SandeshaUtil.getUUID();// "sequence2";
    clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
     
//    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(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1);  //uncomment this to send the messages according to the v1_1 spec.
   
//    clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
   
    clientOptions.setProperty(SandeshaClientConstants.SANDESHA_LISTENER, new SandeshaListenerImpl ());
    ServiceClient serviceClient = new ServiceClient (configContext,null);
//    serviceClient.engageModule(new QName ("sandesha2"));
   
    clientOptions.setAction("urn:wsrm:Ping");
    serviceClient.setOptions(clientOptions);
   
    serviceClient.fireAndForget(getPingOMBlock("ping1"));
    serviceClient.fireAndForget(getPingOMBlock("ping2"));
   
    clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
    serviceClient.fireAndForget(getPingOMBlock("ping3"));
   
    SequenceReport sequenceReport = null;
     
    boolean complete = false;
View Full Code Here

TOP

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

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.