AXIS 1.4将元素添加到自定义故障类型 [英] AXIS 1.4 adds elements to custom fault type

查看:62
本文介绍了AXIS 1.4将元素添加到自定义故障类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Maybe someone found a workaround for the following problem:

似乎AXIS 1.4向每个自定义故障元素添加了<exceptionName><hostname>元素.在WSDL中,将故障定义为仅包含自定义故障消息systemMessage.

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?

推荐答案

有解决此问题的方法:

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

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;
}

此替代方法解决了该问题.但是,每当为SOAP Web服务重新生成代码时,都必须调整故障类.

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

这篇关于AXIS 1.4将元素添加到自定义故障类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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