Package org.apache.axis2.client

Examples of org.apache.axis2.client.Options


                synLog.traceTrace("Message : " + synCtx.getEnvelope());
            }
        }

        try {
            Options options = new Options();
            options.setTo(new EndpointReference(serviceURL));

            if (action != null) {
                options.setAction(action);
            } else {
                if (synCtx.isSOAP11()) {
                    options.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, true);
                } else {
                    Axis2MessageContext axis2smc = (Axis2MessageContext) synCtx;
                    org.apache.axis2.context.MessageContext axis2MessageCtx =
                            axis2smc.getAxis2MessageContext();
                    axis2MessageCtx.getTransportOut().addParameter(
                            new Parameter(HTTPConstants.OMIT_SOAP_12_ACTION, true));
                }
            }

            options.setProperty(
                    AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE);
            sc.setOptions(options);

            OMElement request = getRequestPayload(synCtx);
            if (synLog.isTraceOrDebugEnabled()) {
View Full Code Here


     * @return clonned Options object
     */
    public static Options cloneOptions(Options options) {

        // create new options object and set the parent
        Options clonedOptions = new Options(options.getParent());

        // copy general options
        clonedOptions.setCallTransportCleanup(options.isCallTransportCleanup());
        clonedOptions.setExceptionToBeThrownOnSOAPFault(options.isExceptionToBeThrownOnSOAPFault());
        clonedOptions.setManageSession(options.isManageSession());
        clonedOptions.setSoapVersionURI(options.getSoapVersionURI());
        clonedOptions.setTimeOutInMilliSeconds(options.getTimeOutInMilliSeconds());
        clonedOptions.setUseSeparateListener(options.isUseSeparateListener());

        // copy transport related options
        clonedOptions.setListener(options.getListener());
        clonedOptions.setTransportIn(options.getTransportIn());
        clonedOptions.setTransportInProtocol(options.getTransportInProtocol());
        clonedOptions.setTransportOut(clonedOptions.getTransportOut());

        // copy username and password options
        clonedOptions.setUserName(options.getUserName());
        clonedOptions.setPassword(options.getPassword());

        // cloen the property set of the current options object
        for (Object o : options.getProperties().keySet()) {
            String key = (String) o;
            clonedOptions.setProperty(key, options.getProperty(key));
        }

        return clonedOptions;
    }
View Full Code Here

       
        RampartPolicyData rpd = rmd.getPolicyData();
       
        //Get the user
        //First try options
        Options options = rmd.getMsgContext().getOptions();
        String user = options.getUserName();
        if(user == null || user.length() == 0) {
            //Then try RampartConfig
            if(rpd.getRampartConfig() != null) {
                user = rpd.getRampartConfig().getUser();
            }
        }
       
        if(user != null && !"".equals(user)) {
            log.debug("User : " + user);
           
            // If NoPassword property is set we don't need to set the password
            if (token.isNoPassword()) {
                WSSecUsernameToken utBuilder = new WSSecUsernameToken();
                utBuilder.setUserInfo(user, null);
                utBuilder.setPasswordType(null);
                if (rmd.getConfig() != null) {
                    utBuilder.setWsConfig(rmd.getConfig());
                }
                return utBuilder;
            }
           
            //Get the password

            //First check options object for a password
            String password = options.getPassword();
           
            if(password == null || password.length() == 0) {
               
                //Then try to get the password from the given callback handler
                CallbackHandler handler = RampartUtil.getPasswordCB(rmd);
View Full Code Here

            MetadataSection[] metadataSections = metadata.getMetadatSections();
            MetadataReference reference = metadataSections[0].getMetadataReference();
           
            MexClient serviceClient = new MexClient();

            Options options = serviceClient.getOptions();
            options.setTo(reference.getEPR());
            options.setAction(DRConstants.SPEC.Actions.GET_METADATA_REQUEST);
           
            OMElement request = serviceClient.setupGetMetadataRequest(
                                                        MexConstants.SPEC.DIALECT_TYPE_POLICY,null);
            OMElement result = serviceClient.sendReceive(request);
           
View Full Code Here

    String repoPath = "target" + File.separator + "repos" + File.separator + "client";
    String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_axis2.xml";
   
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);

    Options clientOptions = new Options ();
    clientOptions.setAction(echoAction);
    clientOptions.setTo(new EndpointReference (to));

    //setting the SOAP version as 1.2
    if (runSoap12)
      clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);

    String sequenceKey = SandeshaUtil.getUUID();
    clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
   
    ServiceClient serviceClient = new ServiceClient (configContext,null);
   
    // Set a bad acks to so the CreateSequence will be refused.
    String acksTo = AddressingConstants.Final.WSA_NONE_URI;
    clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
   
    clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
    clientOptions.setUseSeparateListener(true);   
    clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
    serviceClient.setOptions(clientOptions);   
   
    TestCallback callback1 = new TestCallback ("Callback 1");
    serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1",sequenceKey),callback1);
       
View Full Code Here

    String repoPath = "target" + File.separator + "repos" + File.separator + "client";
    String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_axis2.xml";
   
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);   
   
    Options clientOptions = new Options ();
    clientOptions.setAction(pingAction);
    clientOptions.setTo(new EndpointReference (to));
    clientOptions.setFaultTo(new EndpointReference(AddressingConstants.Final.WSA_ANONYMOUS_URL));

    String sequenceKey = SandeshaUtil.getUUID();
    clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
    clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1);
   
    if (soap12)
      clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
   
    ServiceClient serviceClient = new ServiceClient (configContext,null);
    serviceClient.setOptions(clientOptions);

    // Send a single ping message
View Full Code Here

    String repoPath = "target" + File.separator + "repos" + File.separator + "client";
    String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_axis2.xml";

    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);

    Options clientOptions = new Options ();
    clientOptions.setAction(pingAction);
    clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
   
    clientOptions.setTo(new EndpointReference (to));
   
    String sequenceKey = "sequence1";
    clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
    ServiceClient serviceClient = new ServiceClient (configContext,null);
    serviceClient.setOptions(clientOptions);
   
    try{
      serviceClient.fireAndForget(getPingOMBlock("ping1"));   
     
      //now deliver the next out of order
      clientOptions.setProperty(SandeshaClientConstants.MESSAGE_NUMBER,new Long(3));
      serviceClient.fireAndForget(getPingOMBlock("ping3"));
 
      Thread.sleep(5000);
      StorageManager mgr = SandeshaUtil.getInMemoryStorageManager(configContext);
      Transaction t = mgr.getTransaction();
      String inboundSequenceID = SandeshaUtil.getSequenceIDFromInternalSequenceID(SandeshaUtil.getInternalSequenceID(to, sequenceKey),
          mgr);
      t.commit();
     
      SandeshaClient.forceDispatchOfInboundMessages(serverConfigCtx,
          inboundSequenceID,
          true); //allow later msgs to be delivered
     
      //check that the server is now expecting msg 4
      StorageManager serverStore = SandeshaUtil.getInMemoryStorageManager(serverConfigCtx);
      t = serverStore.getTransaction();
      RMDBean rMDBean =
        serverStore.getRMDBeanMgr().retrieve(inboundSequenceID);
      assertNotNull(rMDBean);
      assertEquals(rMDBean.getNextMsgNoToProcess(), 4);
     
      //also check that the sequence has an out of order gap that contains msg 2     
      assertNotNull(rMDBean.getOutOfOrderRanges());
      RangeString rangeString = rMDBean.getOutOfOrderRanges();
      assertTrue(rangeString.isMessageNumberInRanges(2));
      t.commit();
     
      //we deliver msg 2
      //set highest out msg number to 1
      String internalSequenceId = SandeshaUtil.getInternalSequenceID(to, sequenceKey);
      t = mgr.getTransaction();
      RMSBean rmsBean = SandeshaUtil.getRMSBeanFromInternalSequenceId(mgr, internalSequenceId);
      rmsBean.setNextMessageNumber(1);
      // Update the bean
      mgr.getRMSBeanMgr().update(rmsBean);
      t.commit();
     
      clientOptions.setProperty(SandeshaClientConstants.MESSAGE_NUMBER,new Long(2));
      serviceClient.fireAndForget(getPingOMBlock("ping2"));
    }
    finally{
      configContext.getListenerManager().stop();
      serviceClient.cleanup();     
View Full Code Here

    String repoPath = "target" + File.separator + "repos" + File.separator + "client";
    String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_axis2.xml";

    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);

    Options clientOptions = new Options ();
    clientOptions.setAction(pingAction);
    clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
   
    clientOptions.setTo(new EndpointReference (to));
   
    String sequenceKey = "sequence2";
    clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
    ServiceClient serviceClient = new ServiceClient (configContext,null);
    serviceClient.setOptions(clientOptions);
    try
    {
      serviceClient.fireAndForget(getPingOMBlock("ping1"));   
     
      //now deliver the next out of order
      clientOptions.setProperty(SandeshaClientConstants.MESSAGE_NUMBER,new Long(3));
      serviceClient.fireAndForget(getPingOMBlock("ping3"));
 
      String internalSequenceId = SandeshaUtil.getInternalSequenceID(to, sequenceKey);
      waitForMessageToBeAcked(serviceClient, internalSequenceId);
     
View Full Code Here

    if (log.isDebugEnabled())
      log.debug("Enter: WSRMParentProcessor::setupOutMessage");

    msgContext = rmMsgCtx.getMessageContext();
    configurationContext = msgContext.getConfigurationContext();
    Options options = msgContext.getOptions();

    storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext,
        configurationContext.getAxisConfiguration());

    internalSequenceID =
      (String)rmMsgCtx.getProperty(Sandesha2Constants.MessageContextProperties.INTERNAL_SEQUENCE_ID);
   
    toAddress = rmMsgCtx.getTo().getAddress();
    sequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
   
    if(internalSequenceID==null)
    {
      internalSequenceID = SandeshaUtil.getInternalSequenceID(toAddress, sequenceKey);     
    }
View Full Code Here

   
    String repoPath = "target" + File.separator + "repos" + File.separator + "client";
    String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_axis2.xml";
   
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
    Options clientOptions = new Options ();
   
    clientOptions.setTo(new EndpointReference (to));
    clientOptions.setProperty(Configuration.TRANSPORT_URL,transportTo);
   
//    String sequenceKey = SandeshaUtil.getUUID();
//    clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
   
    ServiceClient serviceClient = new ServiceClient (configContext,null);
   
    try
    {
      String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
      clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
      clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
     
      String offeredSequenceID = SandeshaUtil.getUUID();
      clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,offeredSequenceID);
     
      serviceClient.setOptions(clientOptions);
      //serviceClient.
     
      clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
      clientOptions.setUseSeparateListener(true);
     
      serviceClient.setOptions(clientOptions);
     
      String sequenceKey = SandeshaClient.createSequence(serviceClient,true);
      clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY, sequenceKey);
     
      long limit = System.currentTimeMillis() + waitTime;
      Error lastError = null;
      while(System.currentTimeMillis() < limit) {
        Thread.sleep(tickTime); // Try the assertions each tick interval, until they pass or we time out
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.