Search in sources :

Example 31 with Parameter

use of org.apache.axis2.transport.testkit.message.RESTMessage.Parameter in project wso2-axis2-transports by wso2.

the class UtilsTransportServer method deployEchoService.

/**
 * Deploy the standard Echo service with the custom parameters passed in
 * @param name the service name to assign
 * @param parameters the parameters for the service
 * @throws Exception
 */
public void deployEchoService(String name, List<Parameter> parameters) throws Exception {
    AxisService service = new AxisService(name);
    service.setClassLoader(Thread.currentThread().getContextClassLoader());
    service.addParameter(new Parameter(Constants.SERVICE_CLASS, Echo.class.getName()));
    // add operation echoOMElement
    AxisOperation axisOp = new InOutAxisOperation(new QName("echoOMElement"));
    axisOp.setMessageReceiver(new RawXMLINOutMessageReceiver());
    axisOp.setStyle(WSDLConstants.STYLE_RPC);
    service.addOperation(axisOp);
    service.mapActionToOperation(Constants.AXIS2_NAMESPACE_URI + "/echoOMElement", axisOp);
    // add operation echoOMElementNoResponse
    axisOp = new InOutAxisOperation(new QName("echoOMElementNoResponse"));
    axisOp.setMessageReceiver(new RawXMLINOnlyMessageReceiver());
    axisOp.setStyle(WSDLConstants.STYLE_RPC);
    service.addOperation(axisOp);
    service.mapActionToOperation(Constants.AXIS2_NAMESPACE_URI + "/echoOMElementNoResponse", axisOp);
    for (Parameter parameter : parameters) {
        service.addParameter(parameter);
    }
    cfgCtx.getAxisConfiguration().addService(service);
}
Also used : InOutAxisOperation(org.apache.axis2.description.InOutAxisOperation) AxisOperation(org.apache.axis2.description.AxisOperation) QName(javax.xml.namespace.QName) AxisService(org.apache.axis2.description.AxisService) RawXMLINOutMessageReceiver(org.apache.axis2.receivers.RawXMLINOutMessageReceiver) Parameter(org.apache.axis2.description.Parameter) RawXMLINOnlyMessageReceiver(org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver) InOutAxisOperation(org.apache.axis2.description.InOutAxisOperation)

Aggregations

Parameter (org.apache.axis2.description.Parameter)23 AxisFault (org.apache.axis2.AxisFault)10 AxisService (org.apache.axis2.description.AxisService)6 QName (javax.xml.namespace.QName)4 MessageContext (org.apache.axis2.context.MessageContext)4 Iterator (java.util.Iterator)3 OMElement (org.apache.axiom.om.OMElement)3 AxisOperation (org.apache.axis2.description.AxisOperation)3 AMQP (com.rabbitmq.client.AMQP)2 List (java.util.List)2 Map (java.util.Map)2 TransportOutDescription (org.apache.axis2.description.TransportOutDescription)2 ConsumerCancelledException (com.rabbitmq.client.ConsumerCancelledException)1 QueueingConsumer (com.rabbitmq.client.QueueingConsumer)1 ShutdownSignalException (com.rabbitmq.client.ShutdownSignalException)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 PrintWriter (java.io.PrintWriter)1