on 2009 Jan 21 8:00 AM
Hi,
I am doing file to idoc scenario and my requirement is as below:
XML file which i am getting is not having <ns> namespace tag and when i pass this file to PI it gives error due to namespace is missing.
Can anyone send UDF to add namespace tag in xml structure? Below is the xml structure actual and required.
Actual structure
<?xml version="1.0" encoding="UTF-8"?>
<Extracteur>
<Territoire>DL</Territoire>
<Inquiry>
<no_ina>86</no_ina>
<no_str>D1</no_str>
</Inquiry>
</Extracteur>
Required Structure
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_File xmlns:ns0="um:sap.com">
<Extracteur>
<Territoire>DL</Territoire>
<Inquiry>
<no_ina>86</no_ina>
<no_str>D1</no_str>
</Inquiry>
</Extracteur>
</ns0:MT_File>
Thanks
Kunal
Request clarification before answering.
Hi,
Sorry, I have had the wrong interpretation of your question. Basically, you need to modify the xml message and add the namespaces manually when you are testing. You can do this by:
1. Editing your xml using notepad
2. Add the tag <ns0:MT_File xmlns:ns0="um:sap.com"> just after <?xml version="1.0" encoding="UTF-8"?>
3. Add the tag </ns0:MT_File> at the end of the message
4. Save your file with an .xml extension
When in runtime, you do not need to add the tags since XI/PI will remove them. It will recognize the real structure.
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When in runtime, you do not need to add the tags since XI/PI will remove them. It will recognize the real structure.
Actually PI should recognize the real structure regardless of namespace because third party (File Sender) is not suppose to know the namespace used in PI. But it is not doing the same.
When i execute my scenario without giving namespace in payload, PI doesn,t except the payload without namespace.
Any Suggestions
Hi,
In mapping, just try to concatenate the namespace after the count of first line. Lets say if first line has 100 words add namespace after that. You can do it using mapping also. Try concat function.
You can write an UDF.
UDF logic :
inside loop
Count the number of letters until it find one 'nl'; new line
if new line found
concat namespace after that no of count including 'nl' and then again concatnate 'nl' in last
break;
else
do nothing
end loop
Hope this will clarify.
You can also replace first line with addition of firstline and namespace.
regards
Aashish Sinha
Use this XSLT mapping as first mapping step (before the graphical mapping):
<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:template match="/">
<ns0:MT_File xmlns:ns0="um:sap.com">
<xsl:copy-of select="." />
</ns0:MT_File>
</xsl:template>
</xsl:stylesheet>Regards
Stefan
Actually PI should recognize the real structure regardless of namespace because third party (File Sender) is not suppose to know the namespace used in PI. But it is not doing the same.
Not true at all!
The namespace is as important for the XML message structure as the tags names themselves!
So, if you define the structure within XI, you need to export the WSDL (in case of soap/web service) or XSD (in case of file, mail, http etc) and send it to the consumer of the interface, so that they create the message exactly like the service provider expects it. That's the best practice for cross-component/company integration.
On the other hand, if the message was already defined in the sender system, you'll need to import its definition (WSDL/XSD) in XI and develop the interface over it.
Nevertheless, it would always be possible to just:
1. change your data/message type to exclude the unecessary root tag.
2. leave the XML Namespace field of the message type as blank.
Regards,
Henrique.
| User | Count |
|---|---|
| 14 | |
| 8 | |
| 6 | |
| 6 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.