Package org.apache.axis2.context

Examples of org.apache.axis2.context.ServiceContext


        ConfigurationContext configurationContext = msgContext.getConfigurationContext();
        configurationContext.fillServiceContextAndServiceGroupContext(msgContext);

        setMsgContextProperties(request, response, service, msgContext);

        ServiceContext serviceContext = msgContext.getServiceContext();
        serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, this.endpointInstance);

        InvocationResponse processed = null;
        try {
            processed = RESTUtil.processURLRequest(msgContext,
                                                   response.getOutputStream(),
View Full Code Here


        AxisServiceGroup axisServiceGroup =
                supperTenantAxisConfiguration.getServiceGroup(
                        MultitenantConstants.MULTITENANT_DISPATCHER_SERVICE);
        ServiceGroupContext serviceGroupContext =
                this.superTenantConfigurationContext.createServiceGroupContext(axisServiceGroup);
        ServiceContext serviceContext = serviceGroupContext.getServiceContext(axisService);

        superTenantOutMessageContext.setServiceContext(serviceContext);

        AxisOperation axisOperation = axisService.getOperation(
                MultitenantConstants.MULTITENANT_DISPATCHER_OPERATION);
        OperationContext operationContext = serviceContext.createOperationContext(axisOperation);
        operationContext.addMessageContext(superTenantOutMessageContext);

        superTenantOutMessageContext.setOperationContext(operationContext);

        String transportOutName = msgContext.getTransportOut().getName();
View Full Code Here

        String hostName = NetworkUtils.getLocalHostname();
        log.debug("UserName : " + FrameworkSettings.USER_NAME + " Password : " + FrameworkSettings.PASSWORD + " HostName : " + hostName);
        authenticationAdminStub.login(userName, password, hostName);
        log.debug("getting sessionCookie");
        ServiceContext serviceContext = authenticationAdminStub.
                _getServiceClient().getLastOperationContext().getServiceContext();
        String sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
        log.debug("sessionCookie : " + sessionCookie);
        log.info("Successfully logged : " + sessionCookie);
        log.debug("exit from login method");
        return sessionCookie;
    }
View Full Code Here

        anonymousService.engageModule(axisConfig.getModule("UEPModule"));
        anonymousService.getParent().addParameter(
                BPELConstants.HIDDEN_SERVICE_PARAM, "true");
        ServiceGroupContext sgc = new ServiceGroupContext(
                clientConfigCtx, (AxisServiceGroup) anonymousService.getParent());
        ServiceContext serviceCtx = sgc.getServiceContext(anonymousService);

        // get a reference to the DYNAMIC operation of the Anonymous Axis2 service
        AxisOperation axisAnonymousOperation = anonymousService.getOperation(
                isTwoWay ? ServiceClient.ANON_OUT_IN_OP : ServiceClient.ANON_OUT_ONLY_OP);
View Full Code Here

        Session session;
        if (!sessionDescription.isStateful()) {
            session = ruleEngine.createSession(sessionDescription);
        } else {
            ServiceContext serviceContext =
                    requestMessageContext.getServiceContext();
            session = (Session) serviceContext.getProperty(RuleConstants.RULE_SESSION);
            if (session == null) {

                synchronized (resourceLock) {
                    session = (Session) serviceContext.getProperty(RuleConstants.RULE_SESSION);
                    if (session == null) {  // double check
                        session = ruleEngine.createSession(sessionDescription);
                        serviceContext.setProperty(RuleConstants.RULE_SESSION, session);
                    }
                }
            }
        }
View Full Code Here

    private OperationClient getOperationClient(boolean isTwoWay, MessageContext msgCtx) throws AxisFault {
        AxisService anonymousService = AnonymousServiceFactory.getAnonymousService(serviceName, portName, axisConfig);
        anonymousService.getParent().addParameter(org.wso2.carbon.bpel.b4p.utils.Constants.HIDDEN_SERVICE_PARAM, "true");
        ServiceGroupContext sgc = new ServiceGroupContext(
                clientConfigCtx, (AxisServiceGroup) anonymousService.getParent());
        ServiceContext serviceCtx = sgc.getServiceContext(anonymousService);

        // get a reference to the DYNAMIC operation of the Anonymous Axis2 service
        AxisOperation axisAnonymousOperation = anonymousService.getOperation(
                isTwoWay ? ServiceClient.ANON_OUT_IN_OP : ServiceClient.ANON_OUT_ONLY_OP);
View Full Code Here

            ConfigurationContext configurationContext = msgCtx.getConfigurationContext();

            msgCtx.setAxisService(axisService);
            ServiceGroupContext serviceGroupContext =
                    configurationContext.createServiceGroupContext(axisService.getAxisServiceGroup());
            ServiceContext serviceContext = serviceGroupContext.getServiceContext(axisService);

            OperationContext operationContext = serviceContext.createOperationContext(
                    jmsAxis2MessageContext.getOperationName());
            msgCtx.setServiceContext(serviceContext);
            msgCtx.setOperationContext(operationContext);

            msgCtx.setAxisService(axisService);
View Full Code Here

            authenticationStub._getServiceClient().getOptions().setManageSession(true);
            boolean resp = authenticationStub.login("admin","admin",NetworkUtils.getLocalHostname());

            // get the cooke to use in the next service invoations. This lets registry service to authenticate
            // the second request
            ServiceContext serviceContext = authenticationStub._getServiceClient().getLastOperationContext().getServiceContext();
            String sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
            // print the cookie
            System.out.println("session Cookie " + sessionCookie);

            // doing the registry update. Change the host and port in the URL, appropriately.
            ResourceAdminServiceStub stub = new ResourceAdminServiceStub("https://localhost:9443/services/ResourceAdminService");
View Full Code Here

            authenticationStub._getServiceClient().getOptions().setManageSession(true);
            boolean resp = authenticationStub.login("admin","admin",NetworkUtils.getLocalHostname());

            // get the cookie to use in the next service invoations. This lets registry service to authenticate
            // the second request
            ServiceContext serviceContext = authenticationStub._getServiceClient().getLastOperationContext().getServiceContext();
            String sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
            // print the cookie
            System.out.println("session Cookie " + sessionCookie);

            // doing the registry update. Change the host and port in the URL, appropriately.
            ResourceAdminServiceStub stub = new ResourceAdminServiceStub("https://localhost:9443/services/ResourceAdminService");
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

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.