cancel
Showing results for 
Search instead for 
Did you mean: 

Parsing the xml message and then identifying which method to use in XI??

0 Kudos

In our scenario SAP XI need recieve and send message to third party .These xml messages use Document/Literal and therefore are not using any direct method calls. The broker(third party) will receive a document/literal messages and will forward this message to the given recipient(SAP XI). The recipient(XI) will need to parse the message, dissamble it's parts and will call the appropriate method in the business layer. In turn, a response message is send.

Which method eventually will be called is determined by the root element of the Soap messages body. For example msg04 has the root element vchmsg04. After receiving the message, the method vchmsg04 will be called.

Can you please help us or guide us on how this can be achieved??

Accepted Solutions (1)

Accepted Solutions (1)

udo_martens
Active Contributor
0 Kudos

Hi Parvez,

you can put both for the Interface Determination conditions and for Receiver Determination, if various methods requires various receiver systems. Just put in the determinations more than one interface/receiver and add a XPATH condition. See [Logical Routing Objects|http://help.sap.com/saphelp_nw2004s/helpdata/en/2a/d52c413894f823e10000000a155106/frameset.htm]

If you want to find receivers dynamicly there is now as well a possiblity to achieve that for synchronous processes:

[SAP NetWeaver Process Integration: Enhanced Receiver Determination for Synchronous Scenarios|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/8027] [original link is broken] [original link is broken] [original link is broken];

Regards,

Udo

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Udo,

The Actual scenario posted in the following thread

Please look into the thread.

Regards

Vijayanand Poreddy

0 Kudos

Hi Udo,

In our scenario , we have to expose the messages through a webservice to which the third party will push the data(document/literal messages ) in xml format.

On recieving the message we need to parse the message , read the header and identify which method need to mapped with the incoming message.

Any thoughts?

Thanks

Parvez

udo_martens
Active Contributor
0 Kudos

Hi Parvez,

yes, but what is the problem?

You can, if the condition is just in the SOAP envelop, route the message to PIs http adapter and create a XPath condition on the required field. The condition will execute a specified inbound interface and as well a interface mapping. The same is possible for receivers. I posted allread the SAP library links. What is the problem?

Regards,

Udo

nisarkhan_n
Active Contributor
0 Kudos

Udo replies are pretty much clear to your questions, just to check once more do u want to know the root elememnt name and then do the processing? or the value in the some node at top then do it?

i think you want to know the root element name not value( any how it doesn't contain the value)

ur ?

"For example msg04 has the root element vchmsg04. After receiving the message, the method vchmsg04 will be called"

so if the root element name is vchmsg04 then do some thing? right?

0 Kudos

Yes, we need to identify the message based on the root and not on the value....for example below is the sample msg....and now we need to identify reading the below message

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

- <vchmsg04 xmlns="http://surf.nl/vch/berichten" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://surf.nl/vch/berichten kva.xsd">

- <learnerinformation>

- <contentype>

- <referential>

- <sourcedid>

<source>source</source>

<id>id</id>

</sourcedid>

<indexid>indexid</indexid>

</referential>

- <ext_contentype>

<sender>sender</sender>

<receiver>receiver</receiver>

<processid>processid</processid>

<filtercode>filtercode</filtercode>

</ext_contentype>

</contentype>

- <identification>

- <formname>

- <typename>

<tysource sourcetype="imsdefault">tysource</tysource>

<tyvalue>Full</tyvalue>

</typename>

<text>text</text>

</formname>

- <name>

- <partname>

- <typename

Thanks a lot for all your quick replies.

nisarkhan_n
Active Contributor
0 Kudos

Can you use the dynamic configuration code to read the XML root element name using the UDF

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");

conf.put(key, a);

return "";

}

this code gicves you the fielvalue, can you search for the code to read the fieldname and so on.....this is a guess i am not sure it will work or not....might be some JAVA GURU can help to put more light on this.

0 Kudos

Hi Nisar,

Thanks for the reply.

The Messages from the third party would be sent to the webservice URL that is provided by us, so my question is where can i write this UDF to identify the message and then do the processing?

Regards,

Parvez

udo_martens
Active Contributor
0 Kudos

Hi Parvez,

ok, for you i repeat myself: You need a condition (X-Path) in the determinations.

For example:

if local-name(/*) eq 'vchmsg04' then go for this receiver or that interface (mapping) endif

Regards,

Udo

0 Kudos

Hello Udo,

Thanks for your reply.

But i want to know one thing in X-path expression i can check for a condition of value of particular attribute under a node for example i can write a X path expression like

/p1:vchmsg04/p1:learnerinformation/p1:contentype/p1:ext_contentype/p1:processid =04

in the interface determination.

but in our scenario i cannot write the same condition for each message because they dont have a similar or generic structure.

If this is not feasible ,is it possible to write the condition on checking like

/p1 = vchmsg04 (checking if parent node is vchmsg04 ) ,if the answer is yes then is it not necessary to have a generic(unified) structure where we need to hold the payload??

A unified structure like

vchmsg(parentnode)

Vchmsg03(subnode)

Vchmsg04(subnode)

Vchmsg05(subnode)

-


example of payload of one of the message is as follows

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

- <vchmsg04 xmlns="http://surf.nl/vch/berichten" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://surf.nl/vch/berichten kva.xsd">

- <learnerinformation>

- <contentype>

- <referential>

- <sourcedid>

<source>source</source>

<id>id</id>

</sourcedid>

<indexid>indexid</indexid>

</referential>

- <ext_contentype>

<sender>sender</sender>

<receiver>receiver</receiver>

<processid>processid</processid>

<filtercode>filtercode</filtercode>

</ext_contentype>

</contentype>

- <identification>

- <formname>

- <typename>

<tysource sourcetype="imsdefault">tysource</tysource>