SOAP request reply throws exception:caused by: org.xml.sax.SAXException: validation error: xsi:type "{http://schemas.xmlsoap.org/soap/encoding/}Array" is not validly derived from the allowed type definition of "responsibles" (typed as null)

SOAP request reply throws exception:caused by: org.xml.sax.SAXException: validation error: xsi:type "{http://schemas.xmlsoap.org/soap/encoding/}Array" is not validly derived from the allowed type definition of "responsibles" (typed as null)

book

Article ID: KB0086210

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

Resolution:
Title:
BW SOAP request reply throws the following exception when getting response from AXIS server:
caused by: org.xml.sax.SAXException: validation error: xsi:type "{http://schemas.xmlsoap.org/soap/encoding/}Array" is not validly derived from the allowed type definition of "responsibles" (typed as null)  

The WSDL  is defined as:
<xsd:complexType name = "ArrayOf_Responsible">
<xsd:complexContent>
<xsd:restriction base = "soapenc:Array">
<xsd:attribute ref = "soapenc:arrayType" wsdl:arrayType = "db:Responsible[]"/>
</xsd:restriction>
</xsd:complexContent>

The response is as follows:
...
   <soapenv:Body>
      <ns1:getBerechtigungenResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://services.pwm.db.com/pwmcrm/">
         <responsibles soapenc:arrayType="ns2:Responsible[1]" xsi:type="soapenc:Array" xmlns:ns2="http://datatypes.pwmcrm.services.pwm.db.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
            <responsibles xsi:type="ns2:Responsible">
               <RacfID xsi:type="ns2:RacfID">BTS007</RacfID>
               <Role xsi:type="ns2:Role">
                  <RoleName xsi:type="ns2:RoleNames">RM</RoleName>
                  <RoleTargetName xsi:type="ns2:RoleTargetNames">PD</RoleTargetName>
                  <RegionName xsi:type="ns2:RegionNames">Nord</RegionName>
                  <TeamName xsi:type="xsd:string">PWM MG Bremen</TeamName>
               </Role>
               <Role xsi:type="ns2:Role">
                  <RoleName xsi:type="ns2:RoleNames">RM</RoleName>
                  <RoleTargetName xsi:type="ns2:RoleTargetNames">PWM</RoleTargetName>
                  <RegionName xsi:type="ns2:RegionNames">NULL</RegionName>
                  <TeamName xsi:type="xsd:string">NULL</TeamName>
               </Role>
            </responsibles>
         </responsibles>
      </ns1:getBerechtigungenResponse>
   </soapenv:Body>
...

How to resolve this problem?

Resolution:
The problem happens because of wrong "xsi:type" value on the array element.  The value set for "xsi:type" is based on "http://schemas.xmlsoap.org/soap/encoding/" standard, which was introduced before XML schema became standard.  Industry is moving away from using soapencoding definitions and adopting schema standard that's why BW expects xsi:type="ns1:ArrayOf_Responsible" for element responsibles, not xsi:type="soapenc:Array".

To resolve this problem, please refer to  WS-I recommendations for declaration of array types:
http://www.ws-i.org/Profiles/BasicProfile-2_0(WGD).html#soapenc_Array

INCORRECT

<xsd:element name="MyArray2" type="tns:MyArray2Type"/>
<xsd:complexType name="MyArray2Type" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" >
  <xsd:complexContent>
    <xsd:restriction base="soapenc:Array">
     <xsd:sequence>
       <xsd:element name="x" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
     </xsd:sequence>
       <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="tns:MyArray2Type[]"/>
    </xsd:restriction>
   </xsd:complexContent>
  </xsd:complexType>

CORRECT

<xsd:element name="MyArray1" type="tns:MyArray1Type"/>
  <xsd:complexType name="MyArray1Type">
   <xsd:sequence>
    <xsd:element name="x" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
   </xsd:sequence>
</xsd:complexType>

Issue/Introduction

SOAP request reply throws exception:caused by: org.xml.sax.SAXException: validation error: xsi:type "{http://schemas.xmlsoap.org/soap/encoding/}Array" is not validly derived from the allowed type definition of "responsibles" (typed as null)