cancel
Showing results for 
Search instead for 
Did you mean: 

Target Xml

Former Member
0 Kudos

Hello every one,

I have just done a file to file Scenario

Actually the requirement is my trading partner want target xml like shown below

<?xml version="1.0" ?>

- <ACKNOWLEDGE_DELIVERY_001>

- <CNTROLAREA>

- <BSR>

<VERB value="ACKNOWLEDGE">ACKNOWLEDGE</VERB>

<NOUN value="DELIVERY">DELIVERY</NOUN>

<REVISION value="001">001</REVISION>

</BSR>

But for me after i have done the whole scenario it is comming like shown below

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

- <ns0:MT_Ack_Delivery_Inbound xmlns:ns0="urn:commscope.com/ALUespares/AckDelivery">

- <ACKNOWLEDGE_DELIVERY_001>

- <CNTROLAREA>

- <BSR>

<VERB value="ACKNOWLEDGE">ACKNOWLEDGE</VERB>

<NOUN value="DELIVERY">DELIVERY</NOUN>

<REVISION value="001">001</REVISION>

</BSR>

You might have noticed the difference between the two xml

The Message Type and Name Space part as shown below should not come according to requirement

- <ns0:MT_Ack_Delivery_Inbound xmlns:ns0="urn:commscope.com/ALUespares/AckDelivery">

Can any one please help me ho do i do that

Regards

Swetha

Edited by: swethaXI on Jan 5, 2012 1:14 PM

Accepted Solutions (1)

Accepted Solutions (1)

udo_martens
Active Contributor
0 Kudos

Hello every one,

>

> I have just done a file to file Scenario

>

> Actually the requirement is my trading partner want target xml like shown below

Would be nice if you could describe your scenario detailed and exactly to avoid missunderstandings.

Regards,

Udo

Former Member
0 Kudos

sorry about the confusion my requirement is as shown below

Hello every one,

I have just done a Idoc flat file to xml file Scenario

Actually the requirement is my trading partner want target xml like shown below( tis is just a part of my target xml)

<?xml version="1.0" ?>

- <ACKNOWLEDGE_DELIVERY_001>

- <CNTROLAREA>

- <BSR>

<VERB value="ACKNOWLEDGE">ACKNOWLEDGE</VERB>

<NOUN value="DELIVERY">DELIVERY</NOUN>

<REVISION value="001">001</REVISION>

</BSR>

But for me after i have done the whole scenario it is comming like shown below

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

- <ns0:MT_Ack_Delivery_Inbound xmlns:ns0="urn:commscope.com/ALUespares/AckDelivery">

- <ACKNOWLEDGE_DELIVERY_001>

- <CNTROLAREA>

- <BSR>

<VERB value="ACKNOWLEDGE">ACKNOWLEDGE</VERB>

<NOUN value="DELIVERY">DELIVERY</NOUN>

<REVISION value="001">001</REVISION>

</BSR>

You might have noticed the difference between the two xml

The Message Type and Name Space part as shown below should not come according to requirement

- <ns0:MT_Ack_Delivery_Inbound xmlns:ns0="urn:commscope.com/ALUespares/AckDelivery">

Can any one please help me ho do i do that

Regards

Swetha

udo_martens
Active Contributor
0 Kudos

Hi Swetha,

does your IDoc xml flat file source looking 100% the same as the expected target except the namespace? Would be helpful if you could post (a part of) the source file.

If yes:

The xsl would not help because the copy expression copies as well the namespace. Most easy would be a message mapping. Create the normal extenal definition (including the ns) as source interface, the manipulated (excluding the ns) as target inteface. Then create a 1:1 mapping (there is a button in newer PI versions to map each field with same name).

Regards,

Udo

Former Member
0 Kudos

>>The Message Type and Name Space part as shown below should not come according to requirement

(by looking ur desc) u want to remove the MT along with the namespace and needs to have the final target structure starting from "ACKNOWLEDGE_DELIVERY_001" (as a root node) instead of ur message type name...then i guess XSLT will solve ur req.....why dont u try it just once and let us know(if u want to go with xslt)...

the copy expression is copying the structure from"ACKNOWLEDGE_DELIVERY_001"

udo_martens
Active Contributor
0 Kudos

Hi,

this will not work, unfortunately. The subnode belongs as well to the namespace and so the namespace will appear. Just test it.

Regards,

Udo

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Have you seen this thread and experts referencing links.?.. You can do using XSLT Mapping or Java mapping or rename your message type as the root element of what you want. Refer this thread..

udo_martens
Active Contributor
0 Kudos

Hi Baskar,

yes, you can do with XSL when you map each field. But a Message Mapping seems here to be more easy.

And - of course - you can use a non-parsing mapping (only string operations): ABAP or Java, just to manipulate the namepace (delete it).

Regards,

Udo

Former Member
0 Kudos

Hi Udo,

i have tested the code (under OM) and i am getting the required structure...i am not sure whether i have not undertsood u correctly or i am testing something else

<?xml version="1.0" ?>

- <ACKNOWLEDGE_DELIVERY_001>

- <CNTROLAREA>

- <BSR>

<VERB value="ACKNOWLEDGE">ACKNOWLEDGE</VERB>

<NOUN value="DELIVERY">DELIVERY</NOUN>

<REVISION value="001">001</REVISION>

</BSR>

Thanks

Amit Srivastava

Former Member
0 Kudos

Hi Swetha,

Try this

1. since your XSD is not big, define a data type with the name ACKNOWLEDGE_DELIVERY_001. when you define with this name then you will have the top element as ACKNOWLEDGE_DELIVERY_001 and then define all the elments below as per the XSD.

2. Define the message type. You can remove the XML namespace under the MT

3. use XML anonymizer bean in the receiver file adapter to remove the name space. under the module tab add as below

AF_Modules/XMLAnonymizerBean Local Enterprise Bean 0

ModuleKey : 0

Parameter Name: anonymizer.acceptNamespaces

Parameter value: Leave it blank

It works for me . Give a try and let me know.

Thanks,

Srini

Former Member
0 Kudos

Hello Amitsri,

I am new to PI i have no Idea about xslt mapping.

You have got any guide or any Interface screen shot to explain me about XSLT mapping.

Regards

Swetha

Former Member
0 Kudos

i guess u r done with ur req.....but in case u want to know the basics of xslt u can refer my article on xslt mapping:

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/000ee4d0-be91-2d10-8aaf-ff8045bdd...

Answers (2)

Answers (2)

Former Member
0 Kudos

u can also use xslt mapping...

add this xslt after the graphical mapping in OM


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*">
<xsl:copy-of select="//ACKNOWLEDGE_DELIVERY_001"/>
</xsl:template>
</xsl:stylesheet>

Former Member
0 Kudos

Hello Amit,

Thnks for your help, but i did not exactly get you,

Can you explain me bit more breifly( i mean where exactly i have to add the code in OM and every thing)

Sorry if i am asking simple questions it is my first interface.

Regards

Swetha

udo_martens
Active Contributor
0 Kudos

Hi Swetha,

he just wants to copy the source messge to the target with xsl. But if the source is exactly that what you wanna get as target, then you simply can avoid the use of a mapping at all (delete it from Interface Determination).

Regards,

Udo

Former Member
0 Kudos

1) copy the above code in notepad

2) save it as .xsl and then zip it

3) Import the zip file in ESR under Imported archives

4) in Operation mapping (after ur graphical mapping step) add this xslt mapping (Type-> xsl and select the created imported archive)

Former Member
0 Kudos

he just wants to copy the source messge to the target with xsl. But if the source is exactly that what you wanna get as target, then you simply can avoid the use of a mapping at all (delete it from Interface Determination).

No Udo,

Its a Idoc to file scenario.

Thanks

Swetha

Former Member
0 Kudos

hello,

remove namespace from "xml namespace " in Message Type as specified in the below link:

Former Member
0 Kudos

Hi Phani, thanks for your help

But in my scenario there is no Message type its a externatl defination( i mean i had to export the xsd of my Message Type and re import it as External defination to add some symbols like. and - in some feilds,

you have any idea how to do that in such cases

udo_martens
Active Contributor
0 Kudos

Hi,

can t you manipulate the xsd (delete the namespace declaration)?

Regards,

Udo

Former Member
0 Kudos

Hi,

Udo you sure we can do that

udo_martens
Active Contributor
0 Kudos

Hi,

great then dont hesitate!

Regards,

Udo