将CachedOutputStream转换为字符串。
将骆驼从2.12升级到2.23后,我的路线上出现了问题,同一条路线的代码相同。
调用端点后的响应类型为org.apache.camel.converter.stream.CachedOutputStream
我试图将CachedOutputStream
转换为字符串。
String body = exchange.getIn().getBody(String.class);
logger.info("FJA the string after caling endpoint: " + body);
我dk.bankconnect.hub.Util efter FJA efter更强:
-0��phjA����/ h`FhI [����G<�����,�Z���f���=��Rϝ��s#�� ��〜#
如何将CachedOutputStream转换为字符串?
我尝试了许多不同的方法来避免响应如流。但是,我没有成功。
这是我的路线的一段摘要:
from("direct:sdc:webservice")
.setProperty("webservice", constant(Boolean.TRUE))
.setProperty("duration", simple("Forwarding request to ${property.datacentral} datacentral"))
.choice().when().simple("${property.Tracked} == true").bean(Util.class, "dura-tion").end()
.bean(Util.class, "tracker")
.bean(Util.class, "foer")
.to(Util.getProperty("sdc.url"))
.bean(Util.class, "efter")
.convertBodyTo(Document.class)
.setProperty("duration", simple("Receiving response from ${proper-ty.datacentral} datacentral"))
.choice().when().simple("${property.Tracked} == true").bean(Util.class, "dura-tion").end()
.bean(Util.class, "tracker")
.setProperty(SoapError.FAULT, xpath("/soapenv:Envelope/soapenv:Body/soapenv:Fault/faultstring/text()", String.class).namespace("soapenv", Namespace.SOAP))
.end();
我的convertBodyTo失败,因为它突然变成了流。
答案 0 :(得分:-1)
好,很短
调用端点后的响应是org.apache.camel.converter.stream.CachedOutputStream类型 我试图将CachedOutputStream转换为字符串。
字符串主体= exchange.getIn()。getBody(String.class);
这不是可读的字符串,而是许多特殊字符。
坦率:-)