on 10-27-2010 10:18 AM
Dear All,
We have a requirement of dynamically modifying the namespace of the target XML . The scenario is as follows:
There are multiple recipients of a message, and two of the recipients are using the same target structure, but with a different XML namespace. We are catering to the different receivers using different interfaces, but because these two recipients are using the same Target message type, hence they can only point to any one namespace (the XML namespace mentioned in this target message type). For example, the required target messages look like:
Message expected at recipient 1:
<ns0:root xmlns:ns0="http://target1.com">
<tagA/>
<tagB/>
<tagC/>
</ns0:root>
Message expected at recipient 2:
<ns0:root xmlns:ns0="http://target2.com">
<tagA/>
<tagB/>
<tagC/>
</ns0:root>
Obviously, we can only create one message type with name root, and that can point to only 1 namespace. However, we need 2 different namespaces, based on the input payload. For example, if a flag in the input has a value 1, we set the namespace as "http://target1.com"; if it has value 2, we set the namespace as "http://target2.com". We are thinking of dynamically deriving the namespace at the time of mapping, but can not figure out a way to do so. We are currently using Graphical Mapping for one of the recipients; do we have to employ XSLT/ABAP mapping to achieve this? Has anybody done a work around this kind of a problem?
Awaiting Answers.
Thanks and Sincere Regards,
Sid
Hi Sid,
An XSLT map can replace the root element containing the namespace definition. You can parameterize the XSLT step as described in my blog: /people/peter.glas3/blog/2010/09/08/pi-parameterized-xslt--a-flexible-alternative .With the parameter, you can conditionally choose the root tag to be created, and take over all content appearing under the root tag.
kr,
Peter Glas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Peter,
Thanks for replying. Unfortunately, we are using PI 7.01 and not PI 7.1. Any other ideas?
Nice blog though!
P.S: Obviously, we could use 2 different interfaces pointing to the same message type, essentially creating two different communication channels towards the 2 receivers, and modify the payload within these channels using some Adapter Modules. However, this solution looks rather like firing a cannon to kill a fly, and I surely hope PI does have some other capabilities to achieve this using a single interface and single comm channel, which I do not know of (digging through help.sap right now), or can not think of right now.
Thanks and Regards,
Sid
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.