2008-12-09 71 views
2

也许有人找到了以下问题的解决方法:AXIS 1.4添加元素,以自定义故障类型

看来,如果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。有没有人知道这种行为的解决方法?

回答

0

有该问题解决方法:生成从org.apache.axis.AxisFault延伸改变构造为为了抑制的元素(下面是故障类,它是如下的故障类

在轴线用于在问题中返回的故障):

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服务的代码,都必须修改故障类。