1
我有一个代码,执行正确的网络服务调用。并且它还记录返回的SOAP Header。现在我需要在UI上显示相同的XML,因为我需要从驼峰上下文中检索输出。从骆驼上下文检索输出
代码:
DefaultCamelContext context = new DefaultCamelContext();
// append the routes to the context
String myString = "<route id=\"my_Sample_Camel_Route_with_CXF\" xmlns=\"http://camel.apache.org/schema/spring\">"
+ " <from uri=\"file:///home/viral/Projects/camel/cxfJavaTest/src/data?noop=true\"/>"
+ " <log loggingLevel=\"INFO\" message=\">>> ${body}\"/>"
+ " <to uri=\"cxf://http://www.webservicex.net/stockquote.asmx?wsdlURL=src/wsdl/stockquote.wsdl&serviceName={http://www.webserviceX.NET/}StockQuote&portName={http://www.webserviceX.NET/}StockQuoteSoap&dataFormat=MESSAGE\"/>"
+ " <log loggingLevel=\"INFO\" message=\">>> ${body}\"/>"
+ " </route>";
;
InputStream is = new ByteArrayInputStream(myString.getBytes());
RoutesDefinition routes = context.loadRoutesDefinition(is);
context.addRouteDefinitions(routes.getRoutes());
context.setTracing(true);
context.start();
Thread.sleep(3000);
System.out.println("Done");
context.stop();
有没有办法使用上下文变量或任何其他方式来获取,其使用日志语句打印Web服务的响应让Web服务输出?
如果您提供的代码比对我非常有帮助。
在此先感谢。
我需要在相同的地方从我开始驼峰不是另一个类(处理器)的响应。实际上我需要在UI上显示响应。这就是为什么我需要在调用者程序中的响应。 – Viral