Apache CXF Wsdl2Java编译器错误:故障消息有多个部分

时间:2012-08-27 10:15:04

标签: web-services wsdl cxf

确定。所以我正在查看TMForum Group的MTOSI标准,并在sourceforge上找到reference implementation标准。现在这个实现包含很多WSDL文件,我想看看标准支持哪种操作。我不擅长阅读WSDL文件,所以我想使用Apache CXF将一些WSDL文件编译成Java文件,希望能让我更容易阅读。
不幸的是,Wsdl2Java编译器抛出了一个我无法理解的错误。所以我希望能在这里找到关于错误的一些见解 下面我发布了Wsdl文件内容。我得到的错误是:
故障消息ProcessingFailureException有多个部分,WSDL规范不允许这样做。
据我所知,有3个WSDL文件和2个XSD文件如下:
FaultServiceSOAP_HTTP.wsdl                              

    <wsdl:operation name="getActiveAlarmsCount">
        <wsdl:input>
            <soap12:header message="tmf854WS:getActiveAlarmsCount" part="mtosiHeader" use="literal" />
            <soap12:body parts="mtosiBody" use="literal" />
        </wsdl:input>
        <wsdl:output>
            <soap12:header message="tmf854WS:getActiveAlarmsCountResponse" part="mtosiHeader" use="literal" />
            <soap12:body parts="mtosiBody" use="literal" />
        </wsdl:output>
        <soap12:fault name="ProcessingFailureException">
            <soap12:fault name="ProcessingFailureException" use="literal" />
        </soap12:fault>
    </wsdl:operation>

    <wsdl:operation name="getActiveAlarms">
        <wsdl:input>
            <soap12:header message="tmf854WS:getActiveAlarms" part="mtosiHeader" use="literal" />
            <soap12:body parts="mtosiBody" use="literal" />
        </wsdl:input>
        <wsdl:output>
            <soap12:header message="tmf854WS:getActiveAlarmsResponse" part="mtosiHeader" use="literal" />
            <soap12:body parts="mtosiBody" use="literal" />
        </wsdl:output>
        <soap12:fault name="ProcessingFailureException">
            <soap12:fault name="ProcessingFailureException" use="literal" />
        </soap12:fault>
    </wsdl:operation>

</wsdl:binding>

<wsdl:service name="AlarmRetrieval">
    <wsdl:port name="AlarmRetrieval" binding="tmf854WS:AlarmRetrievalSoapHTTPBinding">
        <soap12:address location="http://aserver/mtosi/v1/AlarmRetrieval" />
    </wsdl:port>
</wsdl:service>

FaultService.wsdl

<?xml version="1.0" encoding="UTF-8"?>
<!-- TMF854 Version 1.0 - Copyright TeleManagement Forum 2005 -->
<wsdl:definitions name="TMF854-FaultService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="tmf854.v1.ws" xmlns:tmf854XSD="tmf854.v1" xmlns:tmf854WS="tmf854.v1.ws" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <!-- ===================== Import Type Definitions ============= -->
  <wsdl:types>
    <xsd:schema targetNamespace="tmf854.v1.ws">
      <xsd:import namespace="tmf854.v1" schemaLocation="../../xsd/interfaces/AlarmRetrieval.xsd"/>
    </xsd:schema>
  </wsdl:types>
  <!-- ===================== Import Exception Definitions ============= -->
  <wsdl:import location="Exceptions.wsdl" namespace="tmf854.v1.ws"/>
  <!-- ===================== Definition of getActiveAlarmsCount Request/Response Messages ========= -->
  <wsdl:message name="getActiveAlarmsCount">
    <wsdl:documentation>
    The getActiveAlarmsCount request message.
    </wsdl:documentation>
    <wsdl:part name="mtosiHeader" element="tmf854XSD:header"/>
    <wsdl:part name="mtosiBody" element="tmf854XSD:getActiveAlarmsCount"/>
  </wsdl:message>
  <wsdl:message name="getActiveAlarmsCountResponse">
    <wsdl:documentation>
    The getActiveAlarmsCount response message.
    </wsdl:documentation>
    <wsdl:part name="mtosiHeader" element="tmf854XSD:header"/>
    <wsdl:part name="mtosiBody" element="tmf854XSD:getActiveAlarmsCountResponse"/>
  </wsdl:message>
  <!-- ===================== Definition of getActiveAlarms Request/Response Messages ========= -->
  <wsdl:message name="getActiveAlarms">
    <wsdl:documentation>
    The getActiveAlarms request message.
    </wsdl:documentation>
    <wsdl:part name="mtosiHeader" element="tmf854XSD:header"/>
    <wsdl:part name="mtosiBody" element="tmf854XSD:getActiveAlarms"/>
  </wsdl:message>
  <wsdl:message name="getActiveAlarmsResponse">
    <wsdl:documentation>
    The getActiveAlarms response message.
    </wsdl:documentation>
    <wsdl:part name="mtosiHeader" element="tmf854XSD:header"/>
    <wsdl:part name="mtosiBody" element="tmf854XSD:getActiveAlarmsResponse"/>
  </wsdl:message>
  <!-- ===================== Port Type Definitions ====================== -->
  <!-- ===================== AlarmRetrieval Port Type  ===================== -->
  <wsdl:portType name="AlarmRetrieval">
    <wsdl:documentation>
    The MTOSI AlarmRetrievalServer porttype
    </wsdl:documentation>
    <wsdl:operation name="getActiveAlarmsCount">
      <wsdl:documentation>
        This is the getActiveAlarmsCount request/response operation
      </wsdl:documentation>
      <wsdl:input message="tmf854WS:getActiveAlarmsCount"/>
      <wsdl:output message="tmf854WS:getActiveAlarmsCountResponse"/>
      <wsdl:fault name="ProcessingFailureException" message="tmf854WS:ProcessingFailureException"/>
    </wsdl:operation>
    <wsdl:operation name="getActiveAlarms">
      <wsdl:documentation>
        This is the getActiveAlarms request/response operation
      </wsdl:documentation>
      <wsdl:input message="tmf854WS:getActiveAlarms"/>
      <wsdl:output message="tmf854WS:getActiveAlarmsResponse"/>
      <wsdl:fault name="ProcessingFailureException" message="tmf854WS:ProcessingFailureException"/>
    </wsdl:operation>
  </wsdl:portType>
</wsdl:definitions>

Exceptions.wsdl

<?xml version="1.0" encoding="UTF-8"?>
<!-- TMF854 Version 1.0 - Copyright TeleManagement Forum 2005 -->
<wsdl:definitions name="TMF854-Exceptions" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="tmf854.v1.ws" xmlns:tmf854XSD="tmf854.v1" xmlns:tmf854WS="tmf854.v1.ws" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <!-- ===================== Include (same namespace) Type Definitions ============= -->
  <wsdl:types>
    <xsd:schema targetNamespace="tmf854.v1.ws">
      <xsd:import namespace="tmf854.v1" schemaLocation="../../xsd/interfaces/Exceptions.xsd"/>
    </xsd:schema>
  </wsdl:types>
  <!-- ===================== Definition of Exception Message ====================== -->
  <wsdl:message name="ProcessingFailureException">
    <wsdl:documentation>
    The generic exception message.
    </wsdl:documentation>
    <wsdl:part name="mtosiHeader" element="tmf854XSD:header"/>
    <wsdl:part name="ProcessingFailureException" element="tmf854XSD:ProcessingFailureException"/>
  </wsdl:message>
</wsdl:definitions>

AlarmRetrieval.xsd

<?xml version="1.0" encoding="UTF-8"?>
<!-- TMF854 Version 1.0 - Copyright TeleManagement Forum 2005 -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="tmf854.v1" targetNamespace="tmf854.v1" attributeFormDefault="unqualified" elementFormDefault="qualified">
  <!-- ===================== Includes ========= -->
  <xsd:include schemaLocation="../common/header.xsd"/>
  <xsd:include schemaLocation="../networkResources/notifications.xsd"/>
  <!-- ===================== Element Declarations ========= -->
  <xsd:element name="getActiveAlarmsCount" type="getActiveAlarmsCount_T"/>
  <xsd:element name="getActiveAlarmsCountResponse" type="getActiveAlarmsCountResponse_T"/>
  <xsd:element name="getActiveAlarms" type="getActiveAlarms_T"/>
  <xsd:element name="getActiveAlarmsResponse" type="getActiveAlarmsResponse_T"/>
  <!-- ===================== Type Definitions ========= -->
  <xsd:simpleType name="AlarmSource_T">
    <xsd:annotation>
      <xsd:documentation>
      The source of the alarm with respect to the OS receiving this request. This is one of  the active alarm filter criteria.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="INTERNAL"/>
      <xsd:enumeration value="EXTERNAL"/>
    </xsd:restriction>
  </xsd:simpleType>
  <!-- ================= -->
  <xsd:complexType name="ActiveAlarmFilter_T">
    <xsd:annotation>
      <xsd:documentation>
      The active alarm filter data structure.
      Default interpretation (filter criteria is missing or is an empty list) indicates that it is not relevant to the query. All the filter criteria possible enumerations are applicable.
      Examples:
      #1: All filter criteria missing -> Retrieve all alarms associated with all MEs and this OS
      #2: source=internal, all other criteria missing -> Retrieve all alarms associated with this OS only
      #3: source=external, all other criteria missing -> Retrieve all alarms associated with the MEs only
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="source" type="AlarmSource_T" minOccurs="0">
        <xsd:annotation>
          <xsd:documentation>
          This attribute filters the alarms based on their source (with respect to the OS receiving this request). Possible values are INTERNAL, EXTERNAL, NOT_APPLICABLE. The value NOT_APPLICABLE means there is no filtering on the alarm source; i.e., internal and external alarms are in the scope.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="scope" type="NamingAttributesList_T" minOccurs="0">
        <xsd:annotation>
          <xsd:documentation>
          This attribute filters the alarms based on a list of managed elements. The listed managed elements are in the scope. 
If no managed element is provided, alarms from all managed elements are in scope.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="perceivedSeverityList" type="PerceivedSeverityList_T" minOccurs="0">
        <xsd:annotation>
          <xsd:documentation>
          This attribute filters the alarms based on a list of severities (see ITU-T X.733 definitions). The listed severities are in the scope. 
If no severity is provided, alarms with any severity are in scope.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="probableCauseList" type="ProbableCauseList_T" minOccurs="0">
        <xsd:annotation>
          <xsd:documentation>
          This attribute filters the alarms based on a list of probable causes (for details refer to the supporting document: ProbableCauses). The listed probable causes are in the scope. If no probable cause is provided, alarms with any probable cause are in scope.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="acknowledgeIndication" type="AcknowledgeIndication_T" minOccurs="0">
        <xsd:annotation>
          <xsd:documentation>
          This attribute filters the alarms based on its acknowledge indication. Possible values are EVENT_ACKNOWLEDGED, EVENT_UNACKNOWLEDGED, and NOT_APPLICABLE. The value NOT_APPLICABLE indicates that alarms with any acknowledge indication are in scope.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
    <xsd:attribute name="extVersion" type="xsd:string" use="optional"/>
    <xsd:attribute name="extAuthor" type="xsd:string" use="optional"/>
    <xsd:attribute name="tmf854Version" type="TMF854_Version_T" use="optional"/>
  </xsd:complexType>
  <!-- ===================== getActiveAlarmsCount Request/Response Messages ========= -->
  <xsd:complexType name="getActiveAlarmsCount_T">
    <xsd:annotation>
      <xsd:documentation>
            This operation asks the target top-level OS to count the number of active alarms as restricted by the provided filter. The target OS sends the result to the requesting OS.
            The operation can only be directed to a top-level OS and not to a subordinate OS.

            Raises ProcessingFailureException 
EXCPT_NOT_IMPLEMENTED - Raised when the OS does not support this operation
EXCPT_INTERNAL_ERROR - Raised in case of non-specific OS internal failure
EXCPT_INVALID_INPUT - Raised when an invalid input parameter is provided 
EXCPT_COMM_FAILURE - Raised when communication to an entity (needed to help fulfill the request) is lost
        </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="filter" type="ActiveAlarmFilter_T">
        <xsd:annotation>
          <xsd:documentation>
          Defines the subset of the set of active alarms known to the target OS that are to be counted
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
    <xsd:attribute name="extVersion" type="xsd:string" use="optional"/>
    <xsd:attribute name="extAuthor" type="xsd:string" use="optional"/>
    <xsd:attribute name="tmf854Version" type="TMF854_Version_T" use="optional"/>
  </xsd:complexType>
  <xsd:complexType name="getActiveAlarmsCountResponse_T">
    <xsd:annotation>
      <xsd:documentation>
            This is the response of the getActiveAlarmsCount operation. See also getActiveAlarmsCount_T.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="activeAlarmCount" type="xsd:unsignedInt">
        <xsd:annotation>
          <xsd:documentation>
              The number of active alarms that pass the filter conditions.
            </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
    <xsd:attribute name="extVersion" type="xsd:string" use="optional"/>
    <xsd:attribute name="extAuthor" type="xsd:string" use="optional"/>
    <xsd:attribute name="tmf854Version" type="TMF854_Version_T" use="optional"/>
  </xsd:complexType>
  <!-- ===================== getActiveAlarms Request/Response Messages ========= -->
  <xsd:complexType name="getActiveAlarms_T">
    <xsd:annotation>
      <xsd:documentation>
            This operation returns (to the requesting OS) a specified subset of the active alarms known to the target OS. The target OS returns all alarms satisfying the filter constraints of the requesting OS.
            This operation can only be directed to a top-level OS and not to a subordinate OS.
          Refer to the TMF 854 XML Solution Set document for details on the Message Exchange Pattern controls (multiple batch response).

            Raises ProcessingFailureException 
EXCPT_UNSUPPORTED_COMPRESSION_FORMAT - Raised when the specified file compression format is not supported
EXCPT_UNSUPPORTED_PACKING_FORMAT - Raised when the specified file packing format is not supported
EXCPT_NOT_IMPLEMENTED - Raised when the OS does not support this operation
EXCPT_INTERNAL_ERROR - Raised in case of non-specific OS internal failure
EXCPT_INVALID_INPUT - Raised when an invalid input parameter is provided 
EXCPT_COMM_FAILURE - Raised when communication to an entity (needed to help fulfill the request) is lost
        </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="filter" type="ActiveAlarmFilter_T" minOccurs="0">
        <xsd:annotation>
          <xsd:documentation>
          Defines the subset of the set of active alarms known to the target OS that are to be returned to the requesting OS
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
    <xsd:attribute name="extVersion" type="xsd:string" use="optional"/>
    <xsd:attribute name="extAuthor" type="xsd:string" use="optional"/>
    <xsd:attribute name="tmf854Version" type="TMF854_Version_T" use="optional"/>
  </xsd:complexType>
  <xsd:complexType name="getActiveAlarmsResponse_T">
    <xsd:annotation>
      <xsd:documentation>
            This is the response of the getActiveAlarms operation. See also getActiveAlarms_T.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="activeAlarmList" minOccurs="0">
        <xsd:annotation>
          <xsd:documentation>List of active alarms based on the provided filter.</xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="activeAlarm" type="Alarm_T" maxOccurs="unbounded">
              <xsd:annotation>
                <xsd:documentation>An Active alarm</xsd:documentation>
              </xsd:annotation>
            </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:sequence>
    <xsd:attribute name="extVersion" type="xsd:string" use="optional"/>
    <xsd:attribute name="extAuthor" type="xsd:string" use="optional"/>
    <xsd:attribute name="tmf854Version" type="TMF854_Version_T" use="optional"/>
  </xsd:complexType>
</xsd:schema>

Exceptions.xsd

<?xml version="1.0" encoding="UTF-8"?>
<!-- TMF854 Version 1.0 - Copyright TeleManagement Forum 2005 -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="tmf854.v1" targetNamespace="tmf854.v1" attributeFormDefault="unqualified" elementFormDefault="qualified">
  <!-- =========== Includes ========= -->
  <xsd:include schemaLocation="../common/header.xsd"/>
  <xsd:include schemaLocation="vendorExtensions.xsd"/>
  <!-- =========== Element Declarations ========= -->
  <xsd:element name="ProcessingFailureException" type="ProcessingFailureException_T"/>
  <!-- =========== Type Definitions ========= -->
  <xsd:simpleType name="ExceptionType_T">
    <xsd:annotation>
      <xsd:documentation>
      The type of exception returned by failed invokation of an MTOSI message request.
      </xsd:documentation>
    </xsd:annotation>
        <xsd:restriction base="xsd:string">
          <xsd:enumeration value="EXCPT_NOT_IMPLEMENTED"/>
          <xsd:enumeration value="EXCPT_INTERNAL_ERROR"/>
          <xsd:enumeration value="EXCPT_INVALID_INPUT"/>
          <xsd:enumeration value="EXCPT_OBJECT_IN_USE"/>
          <xsd:enumeration value="EXCPT_TP_INVALID_ENDPOINT"/>
          <xsd:enumeration value="EXCPT_ENTITY_NOT_FOUND"/>
          <xsd:enumeration value="EXCPT_TIMESLOT_IN_USE"/>
          <xsd:enumeration value="EXCPT_PROTECTION_EFFORT_NOT_MET"/>
          <xsd:enumeration value="EXCPT_NOT_IN_VALID_STATE"/>
          <xsd:enumeration value="EXCPT_UNABLE_TO_COMPLY"/>
          <xsd:enumeration value="EXCPT_CAPACITY_EXCEEDED"/>
          <xsd:enumeration value="EXCPT_ACCESS_DENIED"/>
          <xsd:enumeration value="EXCPT_UNSUPPORTED_ROUTING_CONSTRAINTS"/>
          <xsd:enumeration value="EXCPT_USERLABEL_IN_USE"/>
          <xsd:enumeration value="EXCPT_COMM_FAILURE"/>
          <xsd:enumeration value="EXCPT_UNSUPPORTED_COMPRESSION_FORMAT"/>
          <xsd:enumeration value="EXCPT_UNSUPPORTED_PACKING_FORMAT"/>
          <xsd:enumeration value="EXCPT_INVALID_FILTER_DEFINITION"/>
          <xsd:enumeration value="EXCPT_INVALID_TOPIC"/>
          <xsd:enumeration value="EXCPT_NOTIFICATION_SERVICE_PROBLEM"/>
        </xsd:restriction>
  </xsd:simpleType>
  <xsd:complexType name="ProcessingFailureException_T">
    <xsd:annotation>
      <xsd:documentation>
      A coarse grain approach is adopted for capturing exceptions as well. This has the advantage of making the catching of exceptions fairly generic. This is similar to the TMF 814 Corba interface. In the future, each interface operation could implement a specific set of the exceptions.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="exception" type="ExceptionType_T">
        <xsd:annotation>
          <xsd:documentation>The exception type based on the enumeration
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="reason" type="xsd:string" minOccurs="0">
        <xsd:annotation>
          <xsd:documentation>A string indicating further details about the exception. It is a free format string filled by the OS.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="vendorExtensions" type="ExceptionVendorExtensions_T" minOccurs="0">
        <xsd:annotation>
          <xsd:documentation>A string indicating further details about the exception. It is a free format string filled by the OS.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
    <xsd:attribute name="extVersion" type="xsd:string" use="optional"/>
    <xsd:attribute name="extAuthor" type="xsd:string" use="optional"/>
    <xsd:attribute name="tmf854Version" type="TMF854_Version_T" use="optional"/>
  </xsd:complexType>
</xsd:schema>

我试图在网上找到错误的详细原因,但直到现在都没有成功。如果有人能提供帮助,我将不胜感激。感谢所有提前。
P.S.:如果需要更多信息,请告诉我。

1 个答案:

答案 0 :(得分:3)

wsdl2java工具只是声明MTOSI参考实现中提供的文件不符合WSDL 1.1规范。错误在于以下消息定义中的Exception.wsdl

<wsdl:message name="ProcessingFailureException">
  <wsdl:documentation>
    The generic exception message.
   </wsdl:documentation>
  <wsdl:part name="mtosiHeader" element="tmf854XSD:header"/>
  <wsdl:part name="ProcessingFailureException" element="tmf854XSD:ProcessingFailureException"/>
</wsdl:message>

正如您在此处看到的,该消息包含两部分:mtosiHeaderProcessingFailureException。但是,WSDL 1.1 Specification, Sec. 3.6中禁止这样做:“故障信息必须只有一个部分。”。

这实际上不是你的错,而是MTOSI参考实现的错误。参考实现似乎相当陈旧(their web site最后更新2006)并使用过时的WS-Stack(Axis 1.3)。我想这个堆栈没有检查WSDL 1.1规范的所有不变量。值得庆幸的是,wsdl2java确实如此(虽然我建议使用wsimport工具,而不是标准的jdk功能)。

除了使用Axis 1.3或更改参考实现(即删除mtosiHeader部分或将其集成到ProcessingFailureException元素定义或其他内容)之外,您无能为力