spring 集成中的自定义 SOAP 错误错误代码命名空间 [英] Custom SOAP Faults in spring integration Fault code namespace

查看:25
本文介绍了spring 集成中的自定义 SOAP 错误错误代码命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现如下自定义肥皂错误:

I am trying to implement custom soap faults like below:

@SoapFault(faultCode = FaultCode.CUSTOM, customFaultCode="{namespace}Server Error", faultStringOrReason="Error encountered when processing request message.") 
public class SystemFault extends BusinessException{ }. 

抛出的soap错误格式如下:

The soap fault thrown is of the below format:

<.SOAP-ENV:Fault>
     <.faultcode xmlns:ns0="namespace">ns0:star:Server Error<./faultcode>
     <.faultstring xml:lang="en">Error Encountered when processing the request.<./faultstring>
 <./SOAP-ENV:Fault>

如您所见,故障代码标记与命名空间声明一起出现.请让我知道是否有办法避免这种情况.soap错误客户端期望的格式是:

As you can see, fault code tag is appearing with a namespace declaration. Please let me know if there is anyway to avoid that. The format of soap fault client is expecting is:

<.soapenv:Fault xmlns:star="http://www.starstandard.org/STAR/5">
     <.faultcode>star:Custom Fault Code<./faultcode>
     <.faultstring>Custom Fault message<./faultstring>
<./soapenv:Fault>

我检查了 AbstractSoapFaultDefinitionExceptionResolver.resolveExceptionInternal() 方法,它需要 QName 实例的故障代码而不是字符串.请告诉我如何解决这个问题.

I Checked AbstractSoapFaultDefinitionExceptionResolver.resolveExceptionInternal() method and it is expecting QName instance for fault code and not a string. Please let me know how to solve this.

推荐答案

这似乎是一个旧帖子,但只是想尝试提供帮助.我认为您不必担心故障代码和故障描述.在soapFault 元素中实际上有第三个字段,名为detail.此元素有两个子元素,名为 code 和 description.用它来携带故障信息.

This seems to be an old post but just wanna try to help out. I think you should not worry about fault code and faultdescription. There is actually a third field in the soapFault element whitch is named detail. This element has two subelements named code and description. Use this to carry the fault information.

查看这篇文章:http://memorynotfound.com/spring-ws-add-detail-soapfault-exception-handling/

希望这能有所帮助.谢谢

Hope this can help. Thanks

这篇关于spring 集成中的自定义 SOAP 错误错误代码命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆