【问题标题】:AXIS 1.4 adds elements to custom fault typeAXIS 1.4 将元素添加到自定义故障类型
【发布时间】:2008-12-09 09:57:53
【问题描述】:

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

似乎 AXIS 1.4 为每个自定义故障元素添加了 <exceptionName><hostname> 元素。在 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>

这似乎是 Axis 1.4 中的 error。有谁知道这种行为的解决方法?

【问题讨论】:

    标签: wsdl axis


    【解决方案1】:

    有解决该问题的方法:

    在从 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 服务重新生成代码时,您都必须调整故障类。

    【讨论】:

      猜你喜欢
      • 2013-09-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-29
      • 1970-01-01
      • 2015-11-14
      • 2016-05-26
      • 1970-01-01
      相关资源
      最近更新 更多