czwartek, maja 14, 2015

org.xml.sax.SAXException: validation error: xsi:type "null" is not validly derived from the allowed type definition - how to communicate with SalesForce from Tibco BW

WSDL defining base object and extensions and using base object with xsi:type in definitions of 'generic' operations is not compliant with standards. Let's try to do some workaround in WSDL:

1. Define  on base object. Please not that name "xsi:type" is also not compliant but works in BW.
2. Change type of element in operation definition from base type to xsd:anyType.

and in BW:

3. Create mapper with derived object. Fill it. Inside @type put 'distinguishedNamespacePrefix:TypeName'. Please note that after this attribute BW will need to add empty @xsi:type - do not fill it, this is going to work this way.
4. In process 'Namespace Registry' redefine namespace of derived object using prefix name changed to 'distinguishedNamespacePrefix'. This ensures that our @xsi:type value will have valid namespace prefix.
5. On mapper top level input and also on SOAP call activity click exclamation mark 'Edit Statement'. Check 'Exclude result prefixes'. This in runtime moves all namespace definitions to the XML root. This makes our @xsi:type working due to the fact that xsi is visible from the top to bottom of the XML teee.
6. In SOAP call input mapping use 'Copy-Contents-Of' of derivative object.

Quick note about project validation: Error 'Syntactic error in data: /schema/complexType/attribute/@name: data "xsi:type" is not a valid NCName.  A valid example is "_NCname.has-no_colons".' is legitimate and looks bad, but hey - we avoided writing proxy or buying SalesForce adapter!

0 komentarze: