Tuesday 26 March 2013

Oracle SOA 11G – lookupXRef1M function

lookupXRef() and lookupXRef1M() functions can be used to look up single and multiple values correspondingly from SOA 11G Cross Reference table (DEV_SOAINFRA.XREF_DATA).
lookupXRef1M() function will be used to look up multiple values of target system associated with the one value of source system.
Example Table Structure :

lookupXRef1M
lookupXRef1M

Cross Reference Table ( DEV_SOAINFRA.XREF_DATA ) Structure :

XREF_DATA_TABLE
XREF_DATA_TABLE
Issue:
lookupXRef1M() function looking up values differently for BPEL Assign activity and for BPEL Transformation (XSL).
While using with Assign activity it is giving the response like the below.
BPEL Assign activity :






<assign name="assignLookupXRef1M">
           <copy>
             <from expression="xref:lookupXRef1M('Sample.xref','SIEBEL','SBL_001','FUSION',true())"/>
             <to variable="outputVariable" part="payload"
                 query="/client:processResponse/client:result"/>
           </copy>
         </assign>
BPEL Assign activity response :











<outputVariable>
<part  name="payload">
<client:result>
<value>FUS_001</value>
<value>FUS_002</value>
<value>FUS_003</value>
</client:result>
</processResponse>
</part>
</outputVariable>
While using it with XSL Transformation in BPEL it is just returning the concatenated values of target system.
BPEL Transformation:

<xsl:template match="/">
    <client:processResponse>
      <client:result>
        <xsl:value-of select='xref:lookupXRef1M("Sample.xref",/client:process/client:xrefReferenceColumnName,/client:process/client:xrefReferenceColumnValue,/client:process/client:xrefColumnName,true())'/>
      </client:result>
    </client:processResponse>
  </xsl:template>
BPEL Transformation response :

<outputVariable>
    <part  name="payload">
        <processResponse>
            <client:result>FUS_001FUS_002FUS_003</client:result>
        </processResponse>
    </part>
</outputVariable>
Solution to get the values properly in BPEL XSL Transformation :
Assign the lookupXRef1M() response in variable and iterate it using node() function like shown below with in the xsl to get the proper result as we get it in Assign activity.

<?xml version="1.0" encoding="UTF-8" ?>
<?oracle-xsl-mapper
  <!-- SPECIFICATION OF MAP SOURCES AND TARGETS, DO NOT MODIFY. -->
  <mapSources>
    <source type="WSDL">
      <schema location="../LookupXRef1M.wsdl"/>
      <rootElement name="process" namespace="http://xmlns.oracle.com/CompositesSamples/LookupXRef1M"/>
    </source>
  </mapSources>
  <mapTargets>
    <target type="WSDL">
      <schema location="../LookupXRef1M.wsdl"/>
      <rootElement name="processResponse" namespace="http://xmlns.oracle.com/CompositesSamples/LookupXRef1M"/>
    </target>
  </mapTargets>
  <!-- GENERATED BY ORACLE XSL MAPPER 11.1.1.5.0(build 110418.1550.0174) AT [THU JAN 10 12:18:08 EST 2013]. -->
?>
<xsl:stylesheet version="1.0"
                xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
                xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:bpm="http://xmlns.oracle.com/bpmn20/extensions"
                xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
                xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                xmlns:ora="http://schemas.oracle.com/xpath/extension"
                xmlns:client="http://xmlns.oracle.com/CompositesSamples/LookupXRef1M"
                xmlns:dvm="http://www.oracle.com/XSL/Transform/java/oracle.tip.dvm.LookupValue"
                xmlns:hwf="http://xmlns.oracle.com/bpel/workflow/xpath"
                xmlns:med="http://schemas.oracle.com/mediator/xpath"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:ids="http://xmlns.oracle.com/bpel/services/IdentityService/xpath"
                xmlns:xdk="http://schemas.oracle.com/bpel/extension/xpath/function/xdk"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap"
                xmlns:exsl="http://exslt.org/common"
                exclude-result-prefixes="xsi xsl plnk wsdl client xsd bpws xp20 bpel bpm ora socket mhdr oraext dvm hwf med ids vha xdk xref ldap"
                extension-element-prefixes="exsl">
                <xsl:output method="xml" indent="yes"/>
  <xsl:template match="/">
    <xsl:variable name="response" select='xref:lookupXRef1M("Sample.xref",/client:process/client:xrefReferenceColumnName,/client:process/client:xrefReferenceColumnValue,/client:process/client:xrefColumnName,true())'/>
    <client:processResponse>
      <client:result>
        <xsl:for-each select="exsl:node-set($response)/node()">
            <xsl:element name="value">
                <xsl:value-of select="."/>
            </xsl:element>
        </xsl:for-each>
      </client:result>
    </client:processResponse>
  </xsl:template>
</xsl:stylesheet>

No comments:

Post a Comment

xslt padding with characters call template for left pad and right pad

  Could a call-template be written that took two parameters ?   a string, and a   number) return the string with empty spaces appended t...