use of org.apache.camel.component.xmlrpc.XmlRpcRequestImpl in project camel by apache.
the class XmlRpcConverter method toXmlRpcRequest.
@Converter
public static XmlRpcRequest toXmlRpcRequest(final List<?> parameters, Exchange exchange) {
// get the message operation name
String operationName = exchange.getIn().getHeader(XmlRpcConstants.METHOD_NAME, String.class);
// create the request object here
XmlRpcRequest request = new XmlRpcRequestImpl(operationName, parameters);
return request;
}
use of org.apache.camel.component.xmlrpc.XmlRpcRequestImpl in project camel by apache.
the class XmlRpcDataFormatTest method testRequestMessage.
@Test
public void testRequestMessage() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:request");
mock.expectedMessageCount(1);
XmlRpcRequest result = template.requestBody("direct:request", new XmlRpcRequestImpl("greet", new Object[] { "you", 2 }), XmlRpcRequest.class);
assertNotNull(result);
assertEquals("Get a wrong request operation name", "greet", result.getMethodName());
assertEquals("Get a wrong request parameter size", 2, result.getParameterCount());
assertEquals("Get a wrong request parameter", 2, result.getParameter(1));
assertMockEndpointsSatisfied();
}
use of org.apache.camel.component.xmlrpc.XmlRpcRequestImpl in project camel by apache.
the class SpringXmlRpcDataFormatTest method testRequestMessage.
@Test
public void testRequestMessage() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:request");
mock.expectedMessageCount(1);
XmlRpcRequest result = template.requestBody("direct:request", new XmlRpcRequestImpl("greet", new Object[] { "you", 2 }), XmlRpcRequest.class);
assertNotNull(result);
assertEquals("Get a wrong request operation name", "greet", result.getMethodName());
assertEquals("Get a wrong request parameter size", 2, result.getParameterCount());
assertEquals("Get a wrong request parameter", 2, result.getParameter(1));
assertMockEndpointsSatisfied();
}
use of org.apache.camel.component.xmlrpc.XmlRpcRequestImpl in project camel by apache.
the class XmlRpcConverter method toXmlRpcRequest.
@Converter
public static XmlRpcRequest toXmlRpcRequest(final Object[] parameters, Exchange exchange) {
// get the message operation name
String operationName = exchange.getIn().getHeader(XmlRpcConstants.METHOD_NAME, String.class);
// create the request object here
XmlRpcRequest request = new XmlRpcRequestImpl(operationName, parameters);
return request;
}
use of org.apache.camel.component.xmlrpc.XmlRpcRequestImpl in project camel by apache.
the class XmlRpcDataFormat method unmarshalRequest.
protected Object unmarshalRequest(Exchange exchange, InputStream stream) throws Exception {
InputSource isource = new InputSource(stream);
XMLReader xr = newXMLReader();
XmlRpcRequestParser xp;
try {
xp = new XmlRpcRequestParser(xmlRpcStreamRequestConfig, typeFactory);
xr.setContentHandler(xp);
xr.parse(isource);
} catch (SAXException e) {
throw new XmlRpcClientException("Failed to parse server's response: " + e.getMessage(), e);
} catch (IOException e) {
throw new XmlRpcClientException("Failed to read server's response: " + e.getMessage(), e);
}
return new XmlRpcRequestImpl(xp.getMethodName(), xp.getParams());
}
Aggregations