Monday, July 18, 2011

JDev11g PS2 - XSLT designer limitations

There will be scenarios when you need to pass a counter variable /any status value into a transformation. Since Jdev 11g design supports multiple source transformation it’s easy to pass multiple variables as input into XSLT. The only issue that developers will encounter is the below error.

"Source parts of variables are either simple type or complex type, thus cannot be used to create mapper file".

1.    If you try to use a variable which is a simple type created in BPEL, it will through up this error.
Workaround
As a workaround you can create an element in XSD which is of complex type
XSD file code snippet

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://www.geo.com/test"
            targetNamespace="http://www.geo.com/test"
            elementFormDefault="qualified">
  <xsd:element name="loopCounter" type="CounterType"/>
  <xsd:complexType name="CounterType">
    <xsd:sequence>
      <xsd:element name="count" type="xsd:int" />
    </xsd:sequence>
  </xsd:complexType>
</xsd:schema>

Create a variable in BPEL by using this element. This will work with XSLT designer.

2.    In case you are using a message type and the message type is added in a WSDL file which is not attached to any partner link, then the same error will occur.

WSDL file code snippet
<definitions targetNamespace="http://geo.com/test/"
             xmlns="http://schemas.xmlsoap.org/wsdl/"
             xmlns:tns="http://geo.com/test/"
             xmlns:tns1="http://www.geo.com/test"
             …………………….
/">
  <types>
    <xsd:schema targetNamespace="http://geo.com/test/types"
                elementFormDefault="qualified"/>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <xsd:import namespace="http://www.geo.com/test" schemaLocation="xsd/test.xsd"/>
        </xsd:schema>
  </types>
 
  <message name="Counter">
        <part name="body" element="tns1:loopCounter"/>
    </message>

</definitions>

Workaround
 You will have to copy the types and message type definition to the WSDL file which is associated with any of the partner link present in the process. This is not a good practice as we are modifying the end system /interacting system wsdls, for internal use of the process flow.

So the best approach will be to use the first workaround as it is clean and neat and serves the purpose.

No comments: