英文:
how to capture soap fault detail in camel-spring-ws
问题
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>abc-complex-type.x.x: Value '0' of attribute 'schemaVersion' of element 'ABCSubmission:ABCSubmission' is not valid with respect to the corresponding attribute use. Attribute 'schemaVersion' has a fixed value of '1'.</faultstring>
<detail>
<ns2:ABCSubmissionException xmlns:ns2="java:com.webservice.ejb" xmlns="ABCintegration.xdt">
<ns2:ABCIntegrationError schemaVersionMajor="1" schemaVersionMinor="0">
<ErrorName>ABCMessageSyntaxInvalid</ErrorName>
<ErrorDescription>cvc-complex-type.3.1: Value '0' of attribute 'schemaVersion' of element 'ABCSubmission:ABCSubmission' is not valid with respect to the corresponding attribute use. Attribute 'schemaVersion' has a fixed value of '1'.</ErrorDescription>
</ns2:ABCIntegrationError>
</ns2:ABCSubmissionException>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
英文:
I am using camel framework 2.22.0 and camel-spring-ws in my spring boot microservice to convert xml into soap at runtime and make a request to backend and same time receive the soap response and coverts it back to XML before sending the response back to calling system.
Success scenarios are all working fine but when soap fault it only logs the soap string and can't see any soap response been populated. soap response is not getting captured and doesn't get back to calling system apart from http status code 500.
The below is what backend system is sending as soap fault. I can't see anything in camel exchange body populated with soap fault. I need to capture the xml response in detail tag section and to send back to calling system.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>abc-complex-type.x.x: Value '0' of attribute 'schemaVersion' of element 'ABCSubmission:ABCSubmission' is not valid with respect to the corresponding attribute use. Attribute 'schemaVersion' has a fixed value of '1'.</faultstring>
<detail>
<ns2:ABCSubmissionException xmlns:ns2="java:com.webservice.ejb" xmlns="ABCintegration.xdt">
<ns2:ABCIntegrationError schemaVersionMajor="1" schemaVersionMinor="0">
<ErrorName>ABCMessageSyntaxInvalid</ErrorName>
<ErrorDescription>cvc-complex-type.3.1: Value '0' of attribute 'schemaVersion' of element 'ABCSubmission:ABCSubmission' is not valid with respect to the corresponding attribute use. Attribute 'schemaVersion' has a fixed value of '1'.</ErrorDescription>
</ns2:ABCIntegrationError>
</ns2:ABCSubmissionException>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
答案1
得分: 0
Camel在异常和故障之间进行区分(出于历史原因)。不幸的是,这一点在Camel文档中似乎缺失。
如果你希望Camel将故障视为与异常相同(由Camel错误处理程序处理),你需要设置:
.handleFault()
你可以在Camel上下文全局设置,也可以在特定路由上设置。另请参阅本页底部的评论
英文:
Camel differentiates between Exceptions and Faults (historic reasons). Unfortunately this seems to be missing in the Camel Documentation.
If you want that Camel treats Faults the same as Exceptions (handled by the Camel error handler), you have to set
.handleFault()
You can set this globally on the Camel Context or on specific routes. See also the comment at the bottom of this page
专注分享java语言的经验与见解,让所有开发者获益!
评论