Integration

Get Involved. Join the Conversation.

Topic

    bdmonte
    Transforming XML string to XML file using Stage ActionAnswered
    Topic posted September 17, 2019 by bdmonte Green Ribbon: 100+ Points, tagged Integration, Mapping 
    52 Views, 6 Comments
    Title:
    Transforming XML string to XML file using Stage Action
    Summary:
    While transforming XML to XML file using stage action Write File approach, XSL I uploaded for the mapper complains about variable not defined.
    Content:

    Hi All,

    I am building an integration in ICS to export the BIP report, Perform Mapping and validations on the data, Create CSV file and Upload the data using FTP adapter. The data-type on the BIP report is XML. I downlaoded the IAR file of the integration to modify the XSL to add the Copy-of functionality as suggested on Oracle Community. Although when I run the integration, I receive below error message: The error from the XSL about variable not defined. Also attached is XSL file. 

    Any help is highly appreciated. 

     

    <bpelFault><faultType>0</faultType><subLanguageExecutionFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>XPath expression failed to execute.
    An error occurs while processing the XPath expression; the expression is ora:doXSLTransformForDoc('resources/processor_110/resourcegroup_113/req_26efcb72374a47049d389429856e29e1.xsl', $ics_api_internal_variable).
    The XPath expression failed to execute; the reason was: javax.xml.transform.TransformerException: oramds:/deployed-composites/default/NETWORKINVOICE_rev01.00.0000/resources/processor_110/resourcegroup_113/req_26efcb72374a47049d389429856e29e1.xsl&lt;Line 21, Column 157>: XML-22031: (Error) Variable not defined: 'NetworkCSVExport'..
    Check the detailed root cause described in the exception message text and verify that the XPath query is correct.
    </summary></part><part name="code"><code>XPathExecutionError</code></part></subLanguageExecutionFault></bpelFault>

     

     

     

    Version:
    19.3.2.0.0
    Code Snippet:

    Best Comment

    Hemanth Lakkaraju

    I believe param declaration should be above the template start. Also are you sure the $Base64_assign_1 has valid xml content? The parseXML is failing because it cannot find a xml tag. If it is xml content, can you try replacing parseXML with parseEscapedXML and see?

    Comment

     

    • Hemanth Lakkaraju

      Your XSLT doesn't define the variable as a parameter and the error is genuine. Actually there are 2 errors:

      1. NetwokCSVExport is not defined as a parameter to XSLT.
      2. copy-of statement uses Base64_assign_1 variable incorrectly. It should be used with $Base64_assign_1.

      Moreover, all this is not needed to write the report data from BIP to stage file. BIP response will have the base64encoded data in response (reportBytes element). You can simply use opaque schema to write to stage directory and map the reportBytes element to opaque element, which will write to stage file! You need this approach to read the stage file, but with above mentioned corrections!

      • bdmonte

        Thanks Hemanth for your valuable input. 

        I defined the Parameter as you suggested and rectified the variable by putting $ in front of it, Although I am now receiving error the below error similar to the other post: 

        I have attached modified XSL as well, Not sure what I am missing. 

         

        <bpelFault><faultType>0</faultType><subLanguageExecutionFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>XPath expression failed to execute.
        An error occurs while processing the XPath expression; the expression is ora:doXSLTransformForDoc('resources/processor_343/resourcegroup_346/req_e81734714be64fde9ea986bb1bcc0191.xsl', $ics_api_internal_variable).
        The XPath expression failed to execute; the reason was: javax.xml.transform.TransformerException: oramds:/deployed-composites/default/NETWORKINVOICE_rev01.00.0000/resources/processor_343/resourcegroup_346/req_e81734714be64fde9ea986bb1bcc0191.xsl&lt;Line 24, Column 216>: XML-22044: (Error) Extension function error: Error invoking 'parseXML':'oracle.xml.parser.v2.XMLParseException; lineNumber: 1; columnNumber: 1; Start of root element expected.'.
        Check the detailed root cause described in the exception message text and verify that the XPath query is correct.
        </summary></part><part name="code"><code>XPathExecutionError</code></part></subLanguageExecutionFault></bpelFault>

         

        • Hemanth Lakkaraju

          I believe param declaration should be above the template start. Also are you sure the $Base64_assign_1 has valid xml content? The parseXML is failing because it cannot find a xml tag. If it is xml content, can you try replacing parseXML with parseEscapedXML and see?

          • bdmonte

            Hi Hemanth, 

            I receive an error while uploading XSL if I move the param at the start of the template. So I exported application and Modified the IAR containing xsl file and moved the param  before the start of the template, but no success uploading the XSL. Also I log the Base64 decode data and see that it has XML inside it, I have attached image with error and also the Picture of Activity Stream which logs the base64decoded data. 

            Error(s) occured during processing map file "Write_Stage_Transforrmation_v4.xsl"

            • The specification of map sources and targets is incorrect. Please ensure the oracle-xsl-mapper:schema section in the map file being imported is exactly the same as the previously exported map file.
          • bdmonte

            Hi Hemanth,

            I was able to declare the Param at the start of the template by passing variable that I had assigned base64decoded value. So moving the param at the start was achieved by substituting variable name from previous step rather then using the decode function. The below XSL did it. Thanks again for guiding in proper direction. 

            xsl:param xml:id="id_30" name="decodeBase64_assign_1"/>
               <xsl:template match="/" xml:id="id_11">
                 <nstrgmpr:Write xml:id="id_12">
              <xsl:copy-of select="oraext:parseXML($decodeBase64_assign_1)"/>
               </nstrgmpr:Write>
               </xsl:template>