Package org.apache.axis2.context

Examples of org.apache.axis2.context.ServiceContext


    String internalSequenceId = getInternalSequenceIdFromServiceClient(serviceClient);
   
    if (log.isTraceEnabled())
      log.trace("Looking up sequence with identifier " + internalSequenceId);
   
    ServiceContext serviceContext = serviceClient.getServiceContext();
    if (serviceContext == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.serviceContextNotSet));

    ConfigurationContext configurationContext = serviceContext.getConfigurationContext();

    // Get the in use storage manager and the sequence property bean manager
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext,configurationContext.getAxisConfiguration());
   
    // Create a transaction for the retrieve operation
View Full Code Here


        if (referenceMessage.getServiceContext()!=null) {
          newMessageContext.setServiceContext(referenceMessage.getServiceContext());
          newMessageContext.setServiceContextID(referenceMessage.getServiceContextID());
        } else {
          ServiceGroupContext sgc = newMessageContext.getServiceGroupContext();
          ServiceContext serviceContext = sgc.getServiceContext(referenceMessage.getAxisService());
          newMessageContext.setServiceContext(serviceContext);
        }
      }

      newMessageContext.setAxisOperation(operation);
View Full Code Here

          // be the RMIn
          OperationContext responseMsgOpCtx = requestMsgOpCtx;
          if (requestMsgOpCtx.getAxisOperation().getMessageReceiver() == null) {
            // Generate a new RM In Only operation

            ServiceContext serviceCtx = msgCtx.getServiceContext();
            AxisOperation op = msgCtx.getAxisService().getOperation(Sandesha2Constants.RM_IN_ONLY_OPERATION);
            responseMsgOpCtx = OperationContextFactory.createOperationContext (op.getAxisSpecificMEPConstant(), op, serviceCtx);         
          }
         
          responseMessageContext.setOperationContext(responseMsgOpCtx);
View Full Code Here

        if (referenceMessage.getServiceContext()!=null) {
          newMessageContext.setServiceContext(referenceMessage.getServiceContext());
          newMessageContext.setServiceContextID(referenceMessage.getServiceContextID());
        } else {
          ServiceGroupContext sgc = newMessageContext.getServiceGroupContext();
          ServiceContext serviceContext = sgc.getServiceContext(referenceMessage.getAxisService());
          newMessageContext.setServiceContext(serviceContext);
        }
      }

      newMessageContext.setAxisOperation(operation);
View Full Code Here

     * @param msgContext the active MessageContext
     * @return the appropriate back-end service object.
     * @throws AxisFault if there's a problem
     */
    protected Object getTheImplementationObject(MessageContext msgContext) throws AxisFault {
        ServiceContext serviceContext = msgContext.getServiceContext();
        Object serviceimpl = serviceContext.getProperty(ServiceContext.SERVICE_OBJECT);
        if (serviceimpl != null) {
            // since service impl is there in service context , take that from there
            return serviceimpl;
        } else {
            // create a new service impl class for that service
            serviceimpl = makeNewServiceObject(msgContext);
            //Service initialization
            DependencyManager.initServiceObject(serviceimpl, msgContext.getServiceContext());
            serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, serviceimpl);
            return serviceimpl;
        }
    }
View Full Code Here

        // mark the anon services created to be used in the client side of synapse as hidden
        // from the server side of synapse point of view
        anoymousService.getParent().addParameter(SynapseConstants.HIDDEN_SERVICE_PARAM, "true");
        ServiceGroupContext sgc = new ServiceGroupContext(
                        axisCfgCtx, (AxisServiceGroup) anoymousService.getParent());
        ServiceContext serviceCtx = sgc.getServiceContext(anoymousService);

        boolean outOnlyMessage = "true".equals(synapseOutMessageContext.getProperty(
                SynapseConstants.OUT_ONLY));

        // get a reference to the DYNAMIC operation of the Anonymous Axis2 service
View Full Code Here

        org.apache.axis2.context.MessageContext axis2MC
                = new org.apache.axis2.context.MessageContext();
        axis2MC.setConfigurationContext(this.configContext);

        ServiceContext svcCtx = new ServiceContext();
        OperationContext opCtx = new OperationContext(new InOutAxisOperation(), svcCtx);
        axis2MC.setServiceContext(svcCtx);
        axis2MC.setOperationContext(opCtx);
        MessageContext mc = new Axis2MessageContext(axis2MC, synapseConfig, this);
        mc.setMessageID(UIDGenerator.generateURNString());
View Full Code Here

                options.setAction("urn:echo");
                options.setTo(new EndpointReference("http://127.0.0.1:" +
                                        PORT + 
                                        "/axis2/services/SecureService" + i));
               
                ServiceContext context = serviceClient.getServiceContext();
                context.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
                        loadPolicy("/rampart/policy/" + i + ".xml"));
                serviceClient.setOptions(options);
               
                if (i == 31) {
                    OMNamespace omNamespace = OMAbstractFactory.getOMFactory().createOMNamespace(
                            "http://sample.com", "myNs");
                    SOAPHeaderBlock header = OMAbstractFactory.getSOAP12Factory()
                            .createSOAPHeaderBlock("VitalHeader", omNamespace);
                    header.addChild(AXIOMUtil.stringToOM("<foo>This is a sample Header</foo>"));
                    serviceClient.addHeader(header);
                }
               
                // Invoking the serive in the TestCase-28 should fail. So handling it differently..
                if (i == 28) {
                    try {
                        //Blocking invocation
                        serviceClient.sendReceive(getOMElement());
                        fail("Service Should throw an error..");

                    } catch (AxisFault axisFault) {
                        assertEquals("Expected encrypted part missing", axisFault.getMessage());
                    }
                }

                else{
                    //Blocking invocation
                    serviceClient.sendReceive(getEchoElement());
                }
            }

            System.out.println("--------------Testing negative scenarios----------------------------");

            for (int i = 1; i <= 22; i++) {
                if (!basic256Supported && (i == 3 || i == 4 || i == 5)) {
                    //Skip the Basic256 tests
                    continue;
                }
                Options options = new Options();

                if (i == 13) {
                    continue;
                }

                System.out.println("Testing WS-Sec: negative scenario " + i);
                options.setAction("urn:returnError");
                options.setTo(new EndpointReference("http://127.0.0.1:" +
                        PORT +
                        "/axis2/services/SecureService" + i));

                ServiceContext context = serviceClient.getServiceContext();
                context.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
                        loadPolicy("/rampart/policy/" + i + ".xml"));
                serviceClient.setOptions(options);

                try {
                    //Blocking invocation
View Full Code Here

      // if fist message - setup the sending side sequence - both for the server and the client sides
      SequenceManager.setupNewClientSequence(msgContext, internalSequenceId,specVersion);
    }

    ServiceContext serviceContext = msgContext.getServiceContext();
    OperationContext operationContext = msgContext.getOperationContext();
   
    //SENDING THE CREATE SEQUENCE.
    if (sendCreateSequence) {
      SequencePropertyBean responseCreateSeqAdded = seqPropMgr
View Full Code Here

      if (referenceMessage.getServiceGroupContext()==null) {
        ServiceGroupContext serviceGroupContext = new ServiceGroupContext (referenceMessage.getConfigurationContext(),referenceMessage.getAxisServiceGroup());
        referenceMessage.setServiceGroupContext(serviceGroupContext);
      }
      if (referenceMessage.getServiceContext()==null) {
        ServiceContext serviceContext = new ServiceContext (
            referenceMessage.getAxisService(),
                referenceMessage.getServiceGroupContext());
        referenceMessage.setServiceContext(serviceContext);
      }
     
View Full Code Here

TOP

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

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.