Package org.apache.axis2.context

Examples of org.apache.axis2.context.ConfigurationContext


        String soapAction = request.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
        if (soapAction == null) {
            soapAction = "\"\"";
        }
       
        ConfigurationContext configurationContext = msgContext.getConfigurationContext();
        configurationContext.fillServiceContextAndServiceGroupContext(msgContext);

        setMsgContextProperties(request, response, service, msgContext);

        if (!HTTPTransportUtils.isRESTRequest(contentType)) {
            HTTPTransportUtils.processHTTPPostRequest(msgContext,
View Full Code Here


                                     Response response,
                                     AxisService service,
                                     MessageContext msgContext) throws Exception {
        String contentType = request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
       
        ConfigurationContext configurationContext = msgContext.getConfigurationContext();
        configurationContext.fillServiceContextAndServiceGroupContext(msgContext);
       
        setMsgContextProperties(request, response, service, msgContext);
               
        InvocationResponse processed = RESTUtil.processURLRequest(msgContext,
                                                                  response.getOutputStream(),
View Full Code Here

     * Create an Axis2 ServiceClient configured for the externalService
     */
    protected ServiceClient createServiceClient(String externalServiceName, Definition wsdlDefinition, WebServicePortMetaData wsPortMetaData) {

        TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator(null, null);
        ConfigurationContext configurationContext = tuscanyAxisConfigurator.getConfigurationContext();

        QName serviceQName = wsPortMetaData.getServiceName();
        String portName = wsPortMetaData.getPortName().getLocalPart();

        ServiceClient serviceClient;
View Full Code Here

    public void doService2(
            final Request request,
            final Response response,
            final MessageContext msgContext) throws Exception {

        ConfigurationContext configurationContext = msgContext.getConfigurationContext();
        String soapAction = request.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
       
        AxisService service = findServiceWithEndPointClassName(configurationContext, endpointClassName);

        // TODO: Port this section
View Full Code Here

        if (!(msgContext.getAxisOperation() instanceof OutInAxisOperation) &&
                (msgContext.getProperty(org.apache.axis2.Constants.PIGGYBACK_MESSAGE) == null)) {
            return;
        }

        ConfigurationContext configContext = msgContext.getConfigurationContext();
        // if the mail message listner has not started we need to start it
        if (!configContext.getListenerManager().isListenerRunning(MailConstants.TRANSPORT_NAME)) {
            TransportInDescription mailTo =
                    configContext.getAxisConfiguration().getTransportIn(MailConstants.TRANSPORT_NAME);
            if (mailTo == null) {
                handleException("Could not find the transport receiver for " +
                    MailConstants.TRANSPORT_NAME);
            }
            configContext.getListenerManager().addListener(mailTo, false);
        }

        SynchronousCallback synchronousCallback = new SynchronousCallback(msgContext);
        Map callBackMap = (Map) msgContext.getConfigurationContext().
            getProperty(BaseConstants.CALLBACK_TABLE);
View Full Code Here

      System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
      return;
    }
   
    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;
    while (!complete) {
      sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
      if (sequenceReport!=null && sequenceReport.getCompletedMessages().size()==3)
        complete = true;
      else {
        try {
          Thread.sleep(1000);
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
      }
    }
   
    try {
      Thread.sleep(4000);
    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
   
    configContext.terminate();
    serviceClient.cleanup();
  }
View Full Code Here

      return;
    }

    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.setTo(new EndpointReference (toEPR));
   
   
    String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress() + "/" + ServiceClient.ANON_OUT_IN_OP;
    clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
   
    String sequenceKey = SandeshaUtil.getUUID()//sequence key for thie sequence.
    clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
   
//    clientOptions.setReplyTo(new EndpointReference (AddressingConstants.Final.WSA_ANONYMOUS_URL));
//    clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE);   //uncomment this to send messages without chunking.
//    clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1);  //uncomment this to send the messages according to the v1_1 spec.
//    serviceClient.engageModule(new QName ("sandesha2"));

    clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
   
    clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);   //uncomment this to send messages in SOAP 1.2

    clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
    clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID())//Uncomment this to offer a sequenceID for the incoming sequence.
    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);
   
    Callback callback4 = new TestCallback ("Callback 4");
    serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo4",sequenceKey),callback4);

    clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
    Callback callback5 = new TestCallback ("Callback 5");
    serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo5",sequenceKey),callback5);
   
        while (!callback5.isComplete()) {
            Thread.sleep(1000);
        }
       
        Thread.sleep(4000);
       
        configContext.terminate();
        serviceClient.cleanup();
       
  }
View Full Code Here

  public static MessageContext createNewRelatedMessageContext(RMMsgContext referenceRMMessage, AxisOperation operation)
      throws SandeshaException {
    try {
      MessageContext referenceMessage = referenceRMMessage.getMessageContext();
      ConfigurationContext configContext = referenceMessage.getConfigurationContext();
      AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();

      MessageContext newMessageContext = new MessageContext();
      newMessageContext.setConfigurationContext(configContext);
     
      Options newOptions = new Options ();
View Full Code Here

  public static void executeAndStore (RMMsgContext rmMsgContext, String storageKey) throws AxisFault {
    if (log.isDebugEnabled())
      log.debug("Enter: SandeshaUtil::executeAndStore, " + storageKey);
   
    MessageContext msgContext = rmMsgContext.getMessageContext();
    ConfigurationContext configurationContext = msgContext.getConfigurationContext();

    SandeshaPolicyBean policy = getPropertyBean(msgContext.getAxisOperation());
    if(policy.isUseMessageSerialization()) {
      msgContext.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING, Sandesha2Constants.VALUE_TRUE);

      StorageManager store = getSandeshaStorageManager(configurationContext, configurationContext.getAxisConfiguration());
      store.storeMessageContext(storageKey, msgContext);
     
    } else {
      // message will be stored in the Sandesha2TransportSender
      msgContext.setProperty(Sandesha2Constants.MESSAGE_STORE_KEY, storageKey);
View Full Code Here

      System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
      return;
    }
   
    String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);

    ServiceClient serviceClient = new ServiceClient (configContext,null);
//    serviceClient.engageModule(new QName ("sandesha2"));
   
    Options clientOptions = new Options ();
   
//    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.setTo(new EndpointReference (toEPR));
   
    EndpointReference endpoint =   serviceClient.getMyEPR(Constants.TRANSPORT_HTTP);
    clientOptions.setProperty(SandeshaClientConstants.AcksTo,endpoint.getAddress());
   
    clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
    clientOptions.setAction("urn:wsrm:Ping");
   
    String sequenceKey = "sequence2";
    clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
   
    serviceClient.setOptions(clientOptions);
   
    serviceClient.fireAndForget(getPingOMBlock("ping1"));
    serviceClient.fireAndForget(getPingOMBlock("ping2"));
   
    clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
    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 e) {
          e.printStackTrace();
        }
      }
    }
   
    try {
      Thread.sleep(4000);
    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
   
    configContext.terminate();
    serviceClient.cleanup();
  }
View Full Code Here

TOP

Related Classes of org.apache.axis2.context.ConfigurationContext

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.