Search code examples
web-serviceswsdlcxf

Apache CXF Wsdl2Java compiler error: Fault message has multiple parts


Ok. So I am looking at the MTOSI standards from the TMForum Group and found a reference implementation for the standard on sourceforge. Now this implementation contains a lot of WSDL files and I wanted to see what kind of operations are supported by the standards. I am not good at reading WSDL files, so I thought of using Apache CXF to compile some WSDL files to Java files, hoping to make it easier for me to read.
Unfortunately, the Wsdl2Java compiler is throwing an error that I am unable to fathom. So I was hoping to get some insight here on the error.
Below I have posted the Wsdl files contents. The error that I get is:
Fault Message ProcessingFailureException has multiple parts which is disallowed by the WSDL specification.
As far I could understand, there are 3 WSDL files and 2 XSD files as follows:
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>

I tried to find a detailed reason for the error on the net, but have been unsuccessful till now. Would appreciate it if somebody here could help. Thanks to all in advance.
P.S.:Do let me know if more information is required.


Solution

  • The wsdl2java tool simply states that the files supplied in the MTOSI reference implementation do not conform to the WSDL 1.1 specification. The error lies in Exception.wsdl in the following message definition:

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

    As you can see here, the message has two parts: mtosiHeader and ProcessingFailureException. This however, is forbidden in the WSDL 1.1 Specification, Sec. 3.6: "The fault message MUST have a single part.".

    This is actually not your fault, but the fault of the MTOSI reference implementation. The reference implementation seems to be rather old (their web site is last updated 2006) and works with an outdated WS-Stack (Axis 1.3). I guess this stack did not check for all invariants of the WSDL 1.1 spec. Thankfully, wsdl2java does (although I would recommend to use the wsimport tool, standard jdk functionality, instead).

    There is not much you can do except for using Axis 1.3 or changing the reference implementation (i.e. remove the mtosiHeader part or integrate it into the ProcessingFailureException element definition, or something else)