我有一个非常简单的骆驼路线,使soap到soap调用。
一切都很好,但是如果@Oneway操作中有一个抛出了SaopFault,我就无法捕获错误onException。如何捕获soapFault onException将消息设置为setBody(soapFault)?
谢谢你的帮助。
此方法从targetService抛出SaopFault
@WebMethod(operationName = "OneWayOperation")
@Oneway
public void onewayOperation(
@WebParam(partName = "OneWayOperationRequest",
name = "OneWayOperationRequest",
targetNamespace = "http://xxx.xxx.com/xmlschema/api")
com.xxx.xxx.xmlschema.api.OneWayOperationRequest oneWayOperationRequest
); @Bean(name = "sourceBean")
public CxfEndpoint buildCxfSoapEndpoint() {
CxfEndpoint cxf = new CxfEndpoint();
cxf.setAddress("http://0.0.0.0:9090/api");
cxf.setServiceClass(com.xxx.Service.class);
cxf.setWsdlURL("wsdl/xxx.wsdl");
return cxf;
}
@Bean(name = "targetBean")
public CxfEndpoint buildCxfSoapEndpoint() {
CxfEndpoint cxf = new CxfEndpoint();
cxf.setAddress("https://xxxx.com:443/api");
cxf.setServiceClass(com.xxx.Service.class);
cxf.setWsdlURL("wsdl/xxx.wsdl");
return cxf;
}
from("cxf:bean:sourceBean")
.to("cxf:bean:targetBean")
.onException(SoapFault.class)
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
SoapFault fault = exchange.getProperty(ExchangePropertyKey.EXCEPTION_CAUGHT, SoapFault.class);
// ** OneWay methods never comes here but the others ! **
}
})发布于 2022-06-14 11:21:48
我添加了?dataFormat=MESSAGE并解决了问题。
from("cxf:bean:sourceBean?dataFormat=MESSAGE")
.to("cxf:bean:targetBean?dataFormat=MESSAGE")https://stackoverflow.com/questions/72595819
复制相似问题