Search in sources :

Example 1 with PassThroughHttpSender

use of org.apache.synapse.transport.passthru.PassThroughHttpSender in project wso2-synapse by wso2.

the class ServiceUtils method receive.

/**
 * This will provide the mocking functionality of AxisEngine.receive() method.
 * when AxisEngine is mocked, this method can be used with doAnswer
 *
 * @param axis2MessageContext
 * @throws IOException
 * @throws HttpException
 */
public static void receive(MessageContext axis2MessageContext) throws IOException, HttpException {
    if (axis2MessageContext.getServiceContext() == null) {
        ServiceContext svcCtx = new ServiceContext();
        OperationContext opCtx = new OperationContext(new InOutAxisOperation(), svcCtx);
        axis2MessageContext.setServiceContext(svcCtx);
        axis2MessageContext.setOperationContext(opCtx);
    }
    PassThroughHttpSender sender = new PassThroughHttpSender();
    ConfigurationContext cfgCtx = new ConfigurationContext(new AxisConfiguration());
    sender.init(cfgCtx, new TransportOutDescription("http"));
    sender.invoke(axis2MessageContext);
}
Also used : OperationContext(org.apache.axis2.context.OperationContext) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) PassThroughHttpSender(org.apache.synapse.transport.passthru.PassThroughHttpSender) ServiceContext(org.apache.axis2.context.ServiceContext) InOutAxisOperation(org.apache.axis2.description.InOutAxisOperation) TransportOutDescription(org.apache.axis2.description.TransportOutDescription)

Aggregations

ConfigurationContext (org.apache.axis2.context.ConfigurationContext)1 OperationContext (org.apache.axis2.context.OperationContext)1 ServiceContext (org.apache.axis2.context.ServiceContext)1 InOutAxisOperation (org.apache.axis2.description.InOutAxisOperation)1 TransportOutDescription (org.apache.axis2.description.TransportOutDescription)1 AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)1 PassThroughHttpSender (org.apache.synapse.transport.passthru.PassThroughHttpSender)1