Search in sources :

Example 1 with ServiceContext

use of org.apache.axis2.context.ServiceContext in project carbon-business-process by wso2.

the class AxisServiceUtils method getOperationClient.

public static OperationClient getOperationClient(BPELMessageContext partnerMessageContext, ConfigurationContext clientConfigCtx) throws AxisFault {
    AxisService anonymousService = AnonymousServiceFactory.getAnonymousService(partnerMessageContext.getService(), partnerMessageContext.getPort(), clientConfigCtx.getAxisConfiguration(), partnerMessageContext.getCaller());
    anonymousService.engageModule(clientConfigCtx.getAxisConfiguration().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(partnerMessageContext.isTwoWay() ? ServiceClient.ANON_OUT_IN_OP : ServiceClient.ANON_OUT_ONLY_OP);
    Options clientOptions = cloneOptions(partnerMessageContext.getInMessageContext().getOptions());
    clientOptions.setExceptionToBeThrownOnSOAPFault(false);
    /* This value doesn't overrideend point config. */
    clientOptions.setTimeOutInMilliSeconds(60000);
    return axisAnonymousOperation.createClient(serviceCtx, clientOptions);
}
Also used : Options(org.apache.axis2.client.Options) AxisOperation(org.apache.axis2.description.AxisOperation) ServiceGroupContext(org.apache.axis2.context.ServiceGroupContext) ServiceContext(org.apache.axis2.context.ServiceContext) AxisService(org.apache.axis2.description.AxisService)

Example 2 with ServiceContext

use of org.apache.axis2.context.ServiceContext in project carbon-business-process by wso2.

the class ServiceUtils method getOperationClient.

private static OperationClient getOperationClient(MessageContext partnerMessageContext, ConfigurationContext clientConfigCtx) throws AxisFault {
    AxisService anonymousService = AnonymousServiceFactory.getAnonymousService(Constants.registrationService, Constants.REGISTRATION_PORT, clientConfigCtx.getAxisConfiguration(), Constants.HUMANTASK_COORDINATION_MODULE_NAME);
    anonymousService.getParent().addParameter("hiddenService", "true");
    ServiceGroupContext sgc = new ServiceGroupContext(clientConfigCtx, (AxisServiceGroup) anonymousService.getParent());
    ServiceContext serviceCtx = sgc.getServiceContext(anonymousService);
    AxisOperation axisAnonymousOperation = anonymousService.getOperation(ServiceClient.ANON_OUT_IN_OP);
    Options clientOptions = cloneOptions(partnerMessageContext.getOptions());
    clientOptions.setExceptionToBeThrownOnSOAPFault(false);
    /* This value doesn't overrideend point config. */
    clientOptions.setTimeOutInMilliSeconds(60000);
    return axisAnonymousOperation.createClient(serviceCtx, clientOptions);
}
Also used : Options(org.apache.axis2.client.Options) AxisOperation(org.apache.axis2.description.AxisOperation) ServiceGroupContext(org.apache.axis2.context.ServiceGroupContext) ServiceContext(org.apache.axis2.context.ServiceContext) AxisService(org.apache.axis2.description.AxisService)

Example 3 with ServiceContext

use of org.apache.axis2.context.ServiceContext in project MassBank-web by MassBank.

the class AdminActions method viewServiceContext.

@Action(name = "viewServiceContext")
public View viewServiceContext(HttpServletRequest req) throws AxisFault {
    String type = req.getParameter("TYPE");
    String sgID = req.getParameter("PID");
    String ID = req.getParameter("ID");
    ServiceGroupContext sgContext = configContext.getServiceGroupContext(sgID);
    if (sgContext != null) {
        AxisService service = sgContext.getDescription().getService(ID);
        ServiceContext serviceContext = sgContext.getServiceContext(service);
        req.setAttribute("ServiceContext", serviceContext);
        req.setAttribute("TYPE", type);
    } else {
        req.setAttribute("ServiceContext", null);
        req.setAttribute("TYPE", type);
    }
    return new View("viewServiceContext.jsp");
}
Also used : ServiceGroupContext(org.apache.axis2.context.ServiceGroupContext) ServiceContext(org.apache.axis2.context.ServiceContext) AxisService(org.apache.axis2.description.AxisService)

Example 4 with ServiceContext

use of org.apache.axis2.context.ServiceContext in project carbon-apimgt by wso2.

the class WebsocketUtil method getSynapseMessageContext.

public static MessageContext getSynapseMessageContext(String tenantDomain) throws AxisFault {
    org.apache.axis2.context.MessageContext axis2MsgCtx = createAxis2MessageContext();
    ServiceContext svcCtx = new ServiceContext();
    OperationContext opCtx = new OperationContext(new InOutAxisOperation(), svcCtx);
    axis2MsgCtx.setServiceContext(svcCtx);
    axis2MsgCtx.setOperationContext(opCtx);
    if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) {
        ConfigurationContext tenantConfigCtx = TenantAxisUtils.getTenantConfigurationContext(tenantDomain, axis2MsgCtx.getConfigurationContext());
        axis2MsgCtx.setConfigurationContext(tenantConfigCtx);
        axis2MsgCtx.setProperty(MultitenantConstants.TENANT_DOMAIN, tenantDomain);
    } else {
        axis2MsgCtx.setProperty(MultitenantConstants.TENANT_DOMAIN, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
    }
    return MessageContextCreatorForAxis2.getSynapseMessageContext(axis2MsgCtx);
}
Also used : OperationContext(org.apache.axis2.context.OperationContext) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) ServiceContext(org.apache.axis2.context.ServiceContext) InOutAxisOperation(org.apache.axis2.description.InOutAxisOperation)

Example 5 with ServiceContext

use of org.apache.axis2.context.ServiceContext in project wso2-synapse by wso2.

the class OAuthUtilsTest method createMessageContext.

/**
 * Create a empty message context
 *
 * @return A context with empty message
 * @throws AxisFault on an error creating a context
 */
private static MessageContext createMessageContext() throws AxisFault {
    Axis2SynapseEnvironment synapseEnvironment = new Axis2SynapseEnvironment(new SynapseConfiguration());
    org.apache.axis2.context.MessageContext axis2MC = new org.apache.axis2.context.MessageContext();
    axis2MC.setConfigurationContext(new ConfigurationContext(new AxisConfiguration()));
    ServiceContext svcCtx = new ServiceContext();
    OperationContext opCtx = new OperationContext(new InOutAxisOperation(), svcCtx);
    axis2MC.setServiceContext(svcCtx);
    axis2MC.setOperationContext(opCtx);
    axis2MC.setTransportIn(new TransportInDescription("http"));
    MessageContext mc = new Axis2MessageContext(axis2MC, new SynapseConfiguration(), synapseEnvironment);
    mc.setMessageID(UIDGenerator.generateURNString());
    mc.setEnvelope(OMAbstractFactory.getSOAP12Factory().createSOAPEnvelope());
    mc.getEnvelope().addChild(OMAbstractFactory.getSOAP12Factory().createSOAPBody());
    return mc;
}
Also used : OperationContext(org.apache.axis2.context.OperationContext) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) ServiceContext(org.apache.axis2.context.ServiceContext) TransportInDescription(org.apache.axis2.description.TransportInDescription) SynapseConfiguration(org.apache.synapse.config.SynapseConfiguration) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) MessageContext(org.apache.synapse.MessageContext) Axis2MessageContext(org.apache.synapse.core.axis2.Axis2MessageContext) InOutAxisOperation(org.apache.axis2.description.InOutAxisOperation) Axis2MessageContext(org.apache.synapse.core.axis2.Axis2MessageContext)

Aggregations

ServiceContext (org.apache.axis2.context.ServiceContext)24 OperationContext (org.apache.axis2.context.OperationContext)15 InOutAxisOperation (org.apache.axis2.description.InOutAxisOperation)14 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)12 AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)11 AxisService (org.apache.axis2.description.AxisService)10 MessageContext (org.apache.synapse.MessageContext)10 ServiceGroupContext (org.apache.axis2.context.ServiceGroupContext)9 AxisOperation (org.apache.axis2.description.AxisOperation)8 Axis2MessageContext (org.apache.synapse.core.axis2.Axis2MessageContext)8 EndpointReference (org.apache.axis2.addressing.EndpointReference)6 Options (org.apache.axis2.client.Options)6 SynapseException (org.apache.synapse.SynapseException)6 MessageContext (org.apache.axis2.context.MessageContext)5 SynapseConfiguration (org.apache.synapse.config.SynapseConfiguration)5 Axis2SynapseEnvironment (org.apache.synapse.core.axis2.Axis2SynapseEnvironment)5 TransportOutDescription (org.apache.axis2.description.TransportOutDescription)4 Test (org.junit.Test)4 Map (java.util.Map)3 QName (javax.xml.namespace.QName)3