cancel
Showing results for 
Search instead for 
Did you mean: 

Edit Payload XML Tag after mapping in cleanUp?

richard_strasser
Explorer
0 Kudos

Hello experts,

I've created a 1:N multi mapping with the graphical mapping and now the receiver system has a problem with a string within a tag in the payload which should be renamed from "request1" to "request".

I think I need something like

payload.replaceAll("request1","request");

but I don't know if this is possible in the cleanUp section of the graphical mapping.

As I have to use plain html adapter I can't use any adapter modules.

Best Regards,

Richard

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member187339
Active Contributor
0 Kudos

Hi Richard

>>I've created a 1:N multi mapping with the graphical mapping and now the receiver system has a problem with a string within a tag in the payload which should be renamed from "request1" to "request".

Do you mean you need to change the value inside a tag eg:

<tag1> xyz request1 abc</tag1> to <tag1> xyz request abc</tag1>

if yes then why dont you handle in the graphical mapping itself, during the node tag1 creation.

Regards

Suraj

richard_strasser
Explorer
0 Kudos

Hello Suraj!

Thanks for your quick response!

No, it's like

<request1> ABC </request1> which should be <request> ABC </request>

But it's not that easy:

As I wrote it's a multi mapping and I split one message into 2 messages.

Both messages have the name "request" and so I renamed one of them to request1 and now the partner system can't handle it without mapping on their side (and they won't do such a mapping for several reasons).

I think removing a "ns.0" namespace in the payload is a similar problem.

But as I wrote I'm working with the plain http adapter and can't use an adapter module.

BR,

Richard

stefan_grube
Active Contributor
0 Kudos

> Both messages have the name "request" and so I renamed one of them to request1 and now the partner system can't handle it without mapping on their side (and they won't do such a mapping for several reasons).

This is not necessary. Just leave the tags like they are.

richard_strasser
Explorer
0 Kudos

Hi Stefan!

When I upload the 2 messages into the signature part of the graphical mapping and both target messages have the same name (here it would be "request") I get 2 messages in the target structure section but both have the same subelements as the first uploaded message. After renaming one of it to "request1" both messages are displayed as they are defined.

Best Regards,

Richard

stefan_grube
Active Contributor
0 Kudos

So you have two different message types with same name?

richard_strasser
Explorer
0 Kudos

Hi Stefan!

So you have two different message types with same name?

Yes, unfortunately (well, they are external definitions from another system and for some reason they need this special name for processing the XML).

BR,

Richard

stefan_grube
Active Contributor
0 Kudos

I see. The graphical mapping tool identifies a message type by name and namespace, which of course should be unique.

You could use a Java mapping after the graphical mapping to replace the node names.

Would it be possible to do use two different mappings instead of of a multimapping?

richard_strasser
Explorer
0 Kudos

Hi Stefan!

You could use a Java mapping after the graphical mapping to replace the node names.

How can this be done (doing a Java mapping after graphical mapping)?

I read about a similar problem here where namespaces were removed:

[;

Would it be possible to do use two different mappings instead of of a multimapping?

I guess this would be the easiest way but as it's not clear up to now if the sending system will provide a file interface or a http call (both systems - sender, receiver - are no SAP Systems). If it'll be a file this file could easy be read a second time but if it's provided via http this will not be possible (as far as I know ..).

BR,

Richard

stefan_grube
Active Contributor
0 Kudos

The Java mapping is placed as second mapping step in the interface mapping.

The Java code takes the whole payload as String and with replaceAll method you can rename all nodes.

The other option is: Do an interface detemination with two target interfaces. Then you can assign two different mappings.

Shabarish_Nair
Active Contributor
0 Kudos

you can have a look into this wiki for some help with the code

http://wiki.sdn.sap.com/wiki/display/XI/ParametrizedJavaMappinginPI+7.1

richard_strasser
Explorer
0 Kudos

Hi Stefan!

The other option is: Do an interface detemination with two target interfaces. Then you can assign two different mappings.

This possibility sounds very promising, I think I'll give it a try!

BR,

Richard

richard_strasser
Explorer
0 Kudos

Hello Shabarish,

thanks for the link!

BR,

Richard