AXIS 1.4 向自定义故障类型添加了元素

发布于 2024-07-10 04:20:32 字数 1588 浏览 10 评论 0 原文

也许有人找到了以下问题的解决方法:

似乎 AXIS 1.4 向每个自定义故障元素添加了 元素。 在 WSDL 中,故障被定义为仅包含自定义故障消息 systemMessage

这是我的服务返回的答案。 不要介意错误,它可能是作为故障返回的任何错误。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Server.generalException</faultcode>
         <faultstring/>
         <detail>
            <ns1:systemMessage xmlns:ns1="http://my.domain/workflow/engine/wsdl/types">
               <message>nullcvc-datatype-valid.1.2.1: '2008-12-02T00:00:00' is not a valid value for 'date'.cvc-type.3.1.3</message>
               <code>XML string is not valid</code>
               <parameter/>
            </ns1:systemMessage>
            <ns2:exceptionName xmlns:ns2="http://xml.apache.org/axis/">com.domain.commons.ws.schema.SystemMessageType</ns2:exceptionName>
            <ns3:hostname xmlns:ns4="http://xml.apache.org/axis/">my.host.com</ns3:hostname>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

看起来好像这是一个 错误。 有谁知道这种行为的解决方法?

Maybe someone found a workaround for the following problem:

It seems as if AXIS 1.4 adds an <exceptionName> and a <hostname> element to each custom fault element. In the WSDL the fault is defined to only consist of a custom fault message systemMessage.

This is the answer returned from my service. Never mind about the error, it could be any error that is returned as a fault.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Server.generalException</faultcode>
         <faultstring/>
         <detail>
            <ns1:systemMessage xmlns:ns1="http://my.domain/workflow/engine/wsdl/types">
               <message>nullcvc-datatype-valid.1.2.1: '2008-12-02T00:00:00' is not a valid value for 'date'.cvc-type.3.1.3</message>
               <code>XML string is not valid</code>
               <parameter/>
            </ns1:systemMessage>
            <ns2:exceptionName xmlns:ns2="http://xml.apache.org/axis/">com.domain.commons.ws.schema.SystemMessageType</ns2:exceptionName>
            <ns3:hostname xmlns:ns4="http://xml.apache.org/axis/">my.host.com</ns3:hostname>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

It seems as if this is an error in Axis 1.4. Does anyone know a workaround for this behaviour?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧人 2024-07-17 04:20:32

该问题有一个解决方法:

在从 org.apache.axis.AxisFault 扩展的 AXIS 生成的故障类中,按如下方式更改构造函数以抑制元素(下面是用于问题中返回的故障的故障类):

public SystemMessageType() {
    // Suppress the two elements
    this.removeHostname();
    this.removeFaultDetail(org.apache.axis.Constants.QNAME_FAULTDETAIL_EXCEPTIONNAME);
}

public SystemMessageType(
       java.lang.String message1,
       java.lang.String code,
       java.lang.String[] parameter) {
    // Call the default constructor
    this();
    this.message1 = message1;
    this.code = code;
    this.parameter = parameter;
}

此解决方法可以解决该问题。 然而,每当您重新生成 SOAP Web 服务的代码时,您都必须调整故障类。

There's a workaround for the problem:

In the AXIS generated fault class that extends from org.apache.axis.AxisFault alter the constructors as follows in order to suppress the elements (below is the fault class that is used for the fault returned in the question):

public SystemMessageType() {
    // Suppress the two elements
    this.removeHostname();
    this.removeFaultDetail(org.apache.axis.Constants.QNAME_FAULTDETAIL_EXCEPTIONNAME);
}

public SystemMessageType(
       java.lang.String message1,
       java.lang.String code,
       java.lang.String[] parameter) {
    // Call the default constructor
    this();
    this.message1 = message1;
    this.code = code;
    this.parameter = parameter;
}

This workaround solves the problem. Nevertheless, whenever you regenerate your code for the SOAP web service you have to adapt the fault class.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文