Search in sources :

Example 71 with ConfigurationContext

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

the class FIXTransportSenderTest method testFIXTransportSenderInit.

@Test
public void testFIXTransportSenderInit() throws Exception {
    AxisService axisService = new AxisService("testFIXService");
    axisService.addParameter(new Parameter(FIXConstants.FIX_ACCEPTOR_CONFIG_URL_PARAM, "/sample/path/Mock.cfg"));
    axisService.addParameter(new Parameter(FIXConstants.FIX_INITIATOR_CONFIG_URL_PARAM, "/sample/path/Mock2.cfg"));
    ConfigurationContext cfgCtx = new ConfigurationContext(new AxisConfiguration());
    TransportOutDescription trpOutDesc = new TransportOutDescription("fix");
    FIXTransportSender fixTransportSender = new FIXTransportSender();
    fixTransportSender.init(cfgCtx, trpOutDesc);
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) AxisService(org.apache.axis2.description.AxisService) Parameter(org.apache.axis2.description.Parameter) TransportOutDescription(org.apache.axis2.description.TransportOutDescription) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 72 with ConfigurationContext

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

the class HessianMessageBuilderTest method testProcessDocumentWithSynEnv.

public void testProcessDocumentWithSynEnv() throws IOException {
    SynapseEnvironment synEnv = new Axis2SynapseEnvironment(new ConfigurationContext(new AxisConfiguration()), new SynapseConfiguration());
    testProcessDocument(synEnv);
}
Also used : Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) SynapseEnvironment(org.apache.synapse.core.SynapseEnvironment) SynapseConfiguration(org.apache.synapse.config.SynapseConfiguration)

Example 73 with ConfigurationContext

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

the class HessianMessageBuilderTest method testProcessDocumentFaultWithSynEnv.

public void testProcessDocumentFaultWithSynEnv() throws IOException {
    SynapseEnvironment synEnv = new Axis2SynapseEnvironment(new ConfigurationContext(new AxisConfiguration()), new SynapseConfiguration());
    testProcessDocumentFault(synEnv);
}
Also used : Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) SynapseEnvironment(org.apache.synapse.core.SynapseEnvironment) SynapseConfiguration(org.apache.synapse.config.SynapseConfiguration)

Example 74 with ConfigurationContext

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

the class EventSampleClient method initializeClient.

private void initializeClient(String addUrl) throws Exception {
    options = new Options();
    ConfigurationContext configContext;
    configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(configuration.getClientRepo(), configuration.getAxis2Xml());
    serviceClient = new ServiceClient(configContext, null);
    if (addUrl != null && !"null".equals(addUrl)) {
        serviceClient.engageModule("addressing");
        options.setTo(new EndpointReference(addUrl));
    }
    serviceClient.setOptions(options);
    message = factory.createOMElement("message", null);
}
Also used : Options(org.apache.axis2.client.Options) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) ServiceClient(org.apache.axis2.client.ServiceClient) EndpointReference(org.apache.axis2.addressing.EndpointReference)

Example 75 with ConfigurationContext

use of org.apache.axis2.context.ConfigurationContext in project pentaho-platform by pentaho.

the class AxisServiceExecutor method createServiceContent.

@Override
public void createServiceContent(AxisService axisService, String operationName, AxisConfiguration axisConfiguration, ConfigurationContext context, OutputStream out) throws Exception {
    // $NON-NLS-1$
    IParameterProvider pathParams = parameterProviders.get("path");
    // get the HTTP objects from the 'path' parameter provider
    // $NON-NLS-1$
    HttpServletRequest request = (HttpServletRequest) pathParams.getParameter("httprequest");
    @SuppressWarnings("unchecked") Enumeration names = request.getParameterNames();
    while (names.hasMoreElements()) {
        String name = (String) names.nextElement();
        if (name.equalsIgnoreCase("wsdl")) {
            // $NON-NLS-1$
            axisService.printWSDL(out, AxisUtil.getWebServiceExecuteUrl());
            return;
        }
    }
    // $NON-NLS-1$
    HttpServletResponse response = (HttpServletResponse) pathParams.getParameter("httpresponse");
    // $NON-NLS-1$
    ServletConfig servletConfig = (ServletConfig) pathParams.getParameter("servletconfig");
    // create a service group and group context for this service
    AxisServiceGroup axisServiceGroup = new AxisServiceGroup(context.getAxisConfiguration());
    axisServiceGroup.addService(axisService);
    ServiceGroupContext serviceGroupContext = new ServiceGroupContext(context, axisServiceGroup);
    // create a service context
    ServiceContext serviceContext = serviceGroupContext.getServiceContext(axisService);
    // get an operation by name, if possible
    AxisOperation axisOperation = axisService.getOperationByAction(operationName);
    OperationContext operationContext = serviceContext.createOperationContext(axisOperation);
    // create an object to hook into Axis and give it everything we have
    AxisServletHooks hooks = new AxisServletHooks();
    hooks.setContext(context);
    hooks.setServletConfig(servletConfig);
    hooks.setConfiguration(axisConfiguration);
    hooks.initContextRoot(request);
    hooks.setAxisService(axisService);
    hooks.setAxisOperation(axisOperation);
    hooks.setOperationContext(operationContext);
    hooks.setServiceContext(serviceContext);
    hooks.setAxisOperation(axisOperation);
    hooks.setOperationContext(operationContext);
    // now execute the operation
    if (request != null && response != null) {
        try {
            PentahoSessionHolder.setSession(userSession);
            String method = request.getMethod();
            if ("GET".equalsIgnoreCase(method)) {
                // $NON-NLS-1$
                hooks.handleGet(method, request, response);
            } else if ("POST".equalsIgnoreCase(request.getMethod())) {
                // $NON-NLS-1$
                hooks.handlePost(method, request, response);
            } else if ("PUT".equalsIgnoreCase(request.getMethod())) {
                // $NON-NLS-1$
                hooks.handlePut(method, request, response);
            }
        } catch (Exception e) {
            processAxisFault(hooks.getMessageContext(), out, e);
            // $NON-NLS-1$
            error(Messages.getInstance().getErrorString("RunService.ERROR_0001_ERROR_DURING_EXECUTION"), e);
        }
    }
}
Also used : OperationContext(org.apache.axis2.context.OperationContext) Enumeration(java.util.Enumeration) AxisOperation(org.apache.axis2.description.AxisOperation) ServiceContext(org.apache.axis2.context.ServiceContext) ServletConfig(javax.servlet.ServletConfig) HttpServletResponse(javax.servlet.http.HttpServletResponse) AxisServiceGroup(org.apache.axis2.description.AxisServiceGroup) HttpServletRequest(javax.servlet.http.HttpServletRequest) IParameterProvider(org.pentaho.platform.api.engine.IParameterProvider) ServiceGroupContext(org.apache.axis2.context.ServiceGroupContext) AxisServletHooks(org.pentaho.platform.plugin.services.webservices.AxisServletHooks)

Aggregations

ConfigurationContext (org.apache.axis2.context.ConfigurationContext)143 AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)97 Axis2SynapseEnvironment (org.apache.synapse.core.axis2.Axis2SynapseEnvironment)58 Parameter (org.apache.axis2.description.Parameter)52 SynapseConfiguration (org.apache.synapse.config.SynapseConfiguration)52 Test (org.junit.Test)48 SynapseEnvironment (org.apache.synapse.core.SynapseEnvironment)45 OMElement (org.apache.axiom.om.OMElement)42 AxisFault (org.apache.axis2.AxisFault)27 AxisService (org.apache.axis2.description.AxisService)25 EndpointReference (org.apache.axis2.addressing.EndpointReference)23 MessageContext (org.apache.synapse.MessageContext)22 Options (org.apache.axis2.client.Options)21 MessageContext (org.apache.axis2.context.MessageContext)21 ServiceContext (org.apache.axis2.context.ServiceContext)15 Axis2MessageContext (org.apache.synapse.core.axis2.Axis2MessageContext)15 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)15 HashMap (java.util.HashMap)14 TransportOutDescription (org.apache.axis2.description.TransportOutDescription)14 ArrayList (java.util.ArrayList)13