|
@ -0,0 +1,60 @@
|
|
|
package camel.api7.route;
|
|
|
|
|
|
import org.apache.camel.builder.RouteBuilder;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
@Component
|
|
|
|
|
|
public class CxfConsumerTest extends RouteBuilder {
|
|
|
protected static final String SIMPLE_ENDPOINT_ADDRESS = "http://192.168.131.101:3333/soap/ws";
|
|
|
protected static final String SIMPLE_ENDPOINT_URI = "cxf:" + SIMPLE_ENDPOINT_ADDRESS
|
|
|
+ "?serviceClass=camel.api7.processor.TestWServiceImpl"
|
|
|
+ "&dataFormat=PAYLOAD";
|
|
|
|
|
|
|
|
|
// START SNIPPET: example
|
|
|
public void configure() {
|
|
|
|
|
|
from(SIMPLE_ENDPOINT_URI).log("log:msg")
|
|
|
.to("cxf:bean:testWService?dataFormat=CXF_MESSAGE");
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
// END SNIPPET: example
|
|
|
|
|
|
// @Test
|
|
|
// public void testInvokingServiceFromCXFClient() throws Exception {
|
|
|
// ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
|
|
|
// ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
|
|
|
// clientBean.setAddress(SIMPLE_ENDPOINT_ADDRESS);
|
|
|
// clientBean.setServiceClass(HelloService.class);
|
|
|
// clientBean.setBus(BusFactory.newInstance().createBus());
|
|
|
//
|
|
|
// HelloService client = (HelloService) proxyFactory.create();
|
|
|
//
|
|
|
// String result = client.echo(TEST_MESSAGE);
|
|
|
// assertEquals("We should get the echo string result from router", result, "echo " + TEST_MESSAGE);
|
|
|
//
|
|
|
// Boolean bool = client.echoBoolean(Boolean.TRUE);
|
|
|
// assertNotNull("The result should not be null", bool);
|
|
|
// assertEquals("We should get the echo boolean result from router ", bool.toString(), "true");
|
|
|
// }
|
|
|
//
|
|
|
// @Test
|
|
|
// public void testXmlDeclaration() throws Exception {
|
|
|
// String response = template.requestBody(SIMPLE_ENDPOINT_ADDRESS, ECHO_REQUEST, String.class);
|
|
|
// assertTrue("Can't find the xml declaration.", response.startsWith("<?xml version='1.0' encoding="));
|
|
|
// }
|
|
|
//
|
|
|
// @Test
|
|
|
// public void testPublishEndpointUrl() throws Exception {
|
|
|
// String response = template.requestBody(SIMPLE_ENDPOINT_ADDRESS + "?wsdl", null, String.class);
|
|
|
// assertTrue("Can't find the right service location.", response.indexOf("http://www.simple.com/services/test") > 0);
|
|
|
// }
|
|
|
|
|
|
|
|
|
|