Integration

Get Involved. Join the Conversation.

Topic

    Karen Edge
    ICS mapping to bring over XML tags
    Topic posted September 26, 2018 by Karen EdgeRed Ribbon: 250+ Points, tagged Integration, Mapping, REST, SOAP, xml 
    1238 Views, 15 Comments
    Title:
    ICS mapping to bring over XML tags
    Summary:
    Is there an ICS mapping function to bring over fields as is, with the XML tags?
    Content:

    I am working on an integration between Oracle Utilities (using its ICS Adapter) (SOAP-based) and Oracle Field Service Cloud (using its Adapter) (REST based).  There are fields in my outbound message from Oracle Utilities that I want to map to OFSC intact, with the XML tags included.  (The XML tags are subsequently used in OFSC to format the display of the data.)

    For example, if my field in Oracle Utilities has "<fielda>12345</fielda>" I would like that exact string to be mapped to a Property in OFSC.

    Currently the XML tags are being stripped out, moving just "12345" to OFSC.

    I would appreciate anyone's help or pointers to other posts.

    Version:
    18.2.3.0.1

    Comment

     

    • Hemanth Lakkaraju

      You can achieve this by using xsl:copy-of I believe. Based on the version, you are on ICS and XSLT do not have support for xsl:copy-of as far as I know.

      If your requirement is just to copy the xml tag to target element, then you may have to manually make this changes in xsl and re-import iar. But if your requirement is to insert/append the xml tag into target, that is not yet supported, I assume.

    • Subrahmanyam Vempati

      Can you share the input xml , xsl:copy-of can do the job but I suspect the input xml is different in this scenario. If we have nested tags it will be ignored and only the value will be transformed.

      Thanks,

      Vempati

    • Karen Edge

      Thank you for the comments.  Attached is a sample input XML.  I have highlighted in yellow the data to be moved as is - the entire <questionnaireDetails> piece, and there are several of them.  And yes, there are nested items within questionnaireDetails.  (This is a questionnaire that is sent in from the host and displayed as a form for a worker to complete - is has sections, questions, possible answers for a drop down, etc.)

      • Subrahmanyam Vempati

        Your case is straight forward, I was referring to a different case , xsl:copy-of will suffice your requirement. Please try the below snippet and let me know If you see any issues. Tweak a bit as per your requirement.As Hemanth, suggested you have to do it manually as it is not available in the mapper. Edit it in Jdev and re-import mapper.

        <xsl:template match="/">

            <xsl:for-each select="//validValue">
        <xsl:copy-of select="seq"/>
        <xsl:copy-of select="code"/>
        <xsl:copy-of select="shortText"/>
            </xsl:for-each>
        </xsl:template>
        • Karen Edge

          Thanks a ton!  I do not really know XSL and thus was hoping for a ICS function.  I will give it a shot, but it may take me some time to get it working.  I do know how to export / import the mapping.  I really appreciate you looking at this and now I have hope it can be solved.

          • Subrahmanyam Vempati
            Nothing to worry :-), this community is a great place to learn.You will find quick help Just a comment away! I will share a document with the steps to export /import. Thanks, Vempati
          • Subrahmanyam Vempati

            Here is a few steps to follow:

            1) Export the integration, you will get an iar file.

            2) In Jdeveloper, Create a Service bus application and a project under the application.

            3) Import this .iar file to the project

            4) Navigate to Project>Resources>Processor_* ( These processors folders will have all your xslts used in the integration, you need find the one you want to edit.

            5) Once you have updated the mapper, you can import this particular XSL file to your mapper the ICS .

            Note: Any XSL's which are edited through Jdeveloper, cannot be edited again through ICS design time.

            Refer to these links for more insights Import, XSL

            Let me know If you need further help ,happy to discuss!

            Thanks,

            Vempati

            • Karen Edge

              Hi Vempati.  I did not have JDeveloper so I installed it, but it is just too much of learning curve for me - I did not get past step 2.  I have used Notepad++ to edit XSLs before so that is what I tried.  I have attached the resulting XSL.  The element in question is id_186.  I commented out the original line and inserted your example.  The error I get is as follows, which is not very informative for me:

              <bpelFault><faultType>0</faultType><selectionFailure xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"><part name="summary"><summary>The &lt;from> value is invalid. The result of from-spec is null. Either the from node value or the xpath query in the from node value was invalid. According to BPEL4WS spec 1.1 section 14.3, the from node value should not be empty. Verify the from node value at line number 229 in the BPEL source. </summary></part><part name="query"><query>ora:doXSLTransformForDoc(&amp;apos;resources/processor_61/resourcegroup_64/req_18676a744364415a83a5344ccf24f0a4.xsl&amp;apos;, $ics_api_internal_variable.parameters)</query></part><part name="lineNumber"><lineNumber>229</lineNumber></part><part name="activity"><activity>170011-BpAss15-BpSeq1.3-20</activity></part></selectionFailure></bpelFault>

              Any ideas?  Thanks, Karen.

              • Hemanth Lakkaraju

                Regarding Jdeveloper issue (step#2), normal jdeveloper installation will not work. You need to download soa-quickstart-installation (with jdeveloper) to have ServiceBus extensions available.

                Regarding the error - it means that the required source value is not available for assigning to target. Can you attach the updated xsl and complete error stacktrace?

              • Subrahmanyam Vempati

                Hi Karen,

                Good try, I think you have missed the attachment. If you install the Jdev it will be much easier, here are the links to download /create the project and import.

                Installer

                Create Servicebus application

                To import refer the snapshot attached.

                The snippet I have shared may not work as is, It is an example. As Hemanth mentioned, If you can share the XSL file we will be able to help. You can also follow the below steps to achieve it.

                If you open the xsl by following the above steps in Jdev, You will get  source section of XSLT. Just replace the xsl:value-of to xsl:copy-of.

                Thanks,

                Vempati

    • Karen Edge

      Sorry for my absence; I had to get a new OIC environment and it took awhile to get everything up and running it in, and my integrations moved over.  Now I am back testing this issue.

      First - I could not get the ServiceBus extensions installed with JDev; I get all sorts of errors so I just give up and will edit the XSL in Notepad ++.

      Second - I have tried dozens of variations of XSL with no luck.  I did not realize that I cannot attach a .XSL file in this forum, so I saved as .TXT and have attached here.  The file ending 9a is close to the suggestions from Subrahmanyam Vempati.  The apply-templates statement is on line 130.  This version gets error:

      [2018-10-15T15:20:06.926+00:00] [OICWAM_d_server_1] [ERROR] [] [oracle.soa.bpel.system] [tid: [STANDBY].ExecuteThread: '56' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: cloud.admin] [ecid: aa78d507-2e61-411a-83f7-d8ac93660b44-00132f00,0] [APP: soa-infra] [partition-name: DOMAIN] [tenant-name: GLOBAL] [oracle.soa.tracking.FlowId: 43] [oracle.soa.tracking.InstanceId: 48] [oracle.soa.tracking.SCAEntityId: 137] [oracle.soa.tracking.FaultId: 18] [composite_name: WAM_TO_OFSC_ACTIVITY_MAINT!01.00.0000] [FlowId: 0000MPsK1Jh1ZbGpywL6iW1RgYu10002fL] Unhandled BPELFault:faultName: {{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure}[[
      messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage}
      parts: {{
      summary=<summary>The &lt;from> value is invalid.
      Xpath expression associated with &lt;from> in copy assign activity is invalid.
      There is an user error that results in missing element value(s) in the xpath query.
      Please review the payload and modeling to ensure that all elements defined in the &lt;from> xpath query have valid non-null values .
      </summary>
      ,activity=<activity>48-BpAss13-BpSeq3.3-17</activity>
      ,query=<query>ora:doXSLTransformForDoc('resources/processor_61/resourcegroup_64/req_18676a744364415a83a5344ccf24f0a4.xsl', $messagecontext_16.parameters)</query>
      ,lineNumber=<lineNumber>410</lineNumber>}

      ]]

      The version that ends in 7b is a simplified version; it does moves the questionnaireDetails field over, but without the tags.

      I appreciate any further suggestions.  I did buy a 900+ page book (used) on XSLT to help me understand better what I am doing, not that it has helped much...

      • Hemanth Lakkaraju

        How about trying this way? This is a hand-coded entry, so you might want to look-out for right prefixes for the functions.

         

        <nsmpr1:SH_questionnaire_input>
        <xsl:copy-of select="oraext:parseEscapedXML(oraext:get-content-as-string(nsmpr2:questionnaireDetails))"/>
        </nsmpr1:SH_questionnaire_input>

        • Karen Edge

          Thanks for the suggestion.  The only change I made was to add the xml_id at the end (since I assume that is needed?)  like this:

          <xsl:copy-of select="oraext:parseEscapedXML(oraext:get-content-as-string(nsmpr2:questionnaireDetails))" xml:id="id_186"/>

          But I got the following error:

          Problems invoking sender :  <env:Fault xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soap-env:Server</faultcode><faultstring>XPathExecutionError</faultstring><faultactor/><detail><summary>XPath expression failed to execute.
          An error occurs while processing the XPath expression; the expression is ora:doXSLTransformForDoc('resources/processor_61/resourcegroup_64/req_18676a744364415a83a5344ccf24f0a4.xsl', $messagecontext_16.parameters)
          The XPath expression failed to execute; the reason was: javax.xml.transform.TransformerException: oramds:/deployed-composites/oracleinternalics/WAM_TO_OFSC_ACTIVITY_MAINT_rev01.00.0000/resources/processor_61/resourcegroup_64/req_18676a744364415a83a5344ccf24f0a4.xsl&lt;Line 130, Column 131&gt;: XML-22044: (Error) Extension function error: Error invoking 'parseEscapedXML':'oracle.xml.parser.v2.XMLParseException; lineNumber: 37; columnNumber: 79; Expected name instead of  .'
          Check the detailed root cause described in the exception message text and verify that the XPath query is correct.
          </summary><detail/></detail></env:Fault>.

    • Karen Edge
    • Karen Edge