cancel
Showing results for 
Search instead for 
Did you mean: 

Need conversion logic for the xml sending from legacy system ...!!!

Former Member
0 Kudos

Hi Experts ,

we have one requirement where in the legacy system ( Sender system) is sending .xml  file and PI needs to pick the file and send it to ECC Via IDOC AAE Receiver Adapter  to R/3  (SAP ECC) System .

The problem is the  .xml file which PI receives is in a different format  which is shown below

</tns:Header>

    <tns:Body>

        <esa:Payload>

            <esa:Header>

                <PayloadName></PayloadName>

                <PayloadVersion>1.0</PayloadVersion>

                <PayloadCreated>2014-01-07T02:39:55.793Z</PayloadCreated>

                <PayloadSize units="Bytes">432</PayloadSize>

            </esa:Header>

            <esa:Data>

                <zcs:HUM xmlns:zcs="com.">

                    <Hum_Number>00393155965135748871</Hum_Number>

                    <Source_Storage_Location>9000</Source_Storage_Location>

                    <Destination_Storage_Location>0100</Destination_Storage_Location>

                    <Material_Number>000000000000004123</Material_Number>

                    <Batch_Number>321940071 </Batch_Number>

                    <Quantity>0000000096000</Quantity>

                    <Production_Version>A100</Production_Version>

                    <Hostname>POSPI000003</Hostname>

                </zcs:HUM>

            </esa:Data>

        </esa:Payload>

    </tns:Body>

</tns:Envelope>|


need help to  convert this  .xml into PI Standard xml  format ( i mean without esa,zcs, ..So that at PI the message gets passed  successfully without throwing  xml parser issue or xml well not formed error .)  .


do i need to write any java code for this ?

Please experts needs your suggestions here .

regards,

khan ,

Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor
0 Kudos

Hi Aziz,

How is the XML arriving to PI, via File adapter or via SOAP adapter?

If the file is arriving via SOAP adapter you can select Use No SOAP Envelope and extract the payload with an XSL in the first mapping.

Regards.

Former Member
0 Kudos

Hi Inaki,

Thanks for the quick reply,

XML is arriving to PI via SOAP Adapter . If i need to extract the paylaod with an XSL in the first mapping do we need to go for XSLT Code ?

do we have any standard code ? which i can use ?

thanks

khan .

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

I have been facing the same issue.

Sample Incoming XML file is in the below mentioned Format :


<IsNotice
dt:dt="ui1">1</IsNotice>

<Op dt:dt="i4">2</Op>

<WkStn dt:dt="i4">1</WkStn>

<Tran dt:dt="i4">40</Tran>

The file is coming to SAP PI via File Adapter.

What can be done in this case to convert the file to SAP PI Soap xml.

Can we use a normal message mapping here or do we need to go for XSLT only ?

Regards,

Nitin Balodhi

iaki_vila
Active Contributor
0 Kudos

Hi Aziz:

XSL, to get the esa:payload tag:


<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">

    <xsl:template match="./child::*/child::*">

        <xsl:copy-of select="*"/>

    </xsl:template>

</xsl:stylesheet>

You can notice that it's getting all the children of the children of the root tag.

Regards.

Former Member
0 Kudos

Hi Inaki,

I am getting below error when i use this above code in the Operation mapping to remove the prefix and namespace

Unable to display tree view; Error when parsing an XML document (The prefix "tns" for element "tns:Body" is not bound.)

please let me know what i can do to correct this .

Former Member
0 Kudos

Hi Inaki,

I have configured Data Type , Message Type , SI , MM and then in OM trying to use the xsl Provided above for transformation of prefixes . But it throws error when i directly paste the .xml file in OM and trying to trigger . Error Below

"Unable to display tree view; Error when parsing an XML document (The prefix "tns" for element "tns:Body" is not bound.)"

Do i need to follow the same process or do i need to  use External Definition as my source structure . in order to use the xsl at first mapping ?


please advice .

Regards,

Khan

Muniyappan
Active Contributor
0 Kudos

Hi Aziz,

please make sure your pasted xml has  start and end tags


<tns:Body> </tns:Body>.


i don't think you need to change the external definition. make sure that you use xslt mapping first then message mapping.


Regards,

Muni.

peter_wallner2
Active Contributor
0 Kudos

Hi,

Use this template in an XSLT mapping to get rid of prefixes:

<xsl:template match="*">

            <xsl:element name="{local-name()}">

                <xsl:apply-templates select="@* | node()"/>

            </xsl:element>

        </xsl:template>

Best regards,

Peter

former_member190284
Participant
0 Kudos

Hi Inaki

Can you pls help me with some silly doubts

1. when the file is being sent from sender side, than always I have use file adapter, why soap here?

2. what process/steps needs to be done to make XSLT work before message mapping?

3. I know the use of NO SOAP Envelope , but in this case sine we are using XSLT mapping , what is the significance of use" NO SOAP Envelope "

Thanks