cancel
Showing results for 
Search instead for 
Did you mean: 

SOAP Lookup in HCI

markbernabe
Active Participant
0 Kudos

Hi HCI Experts,

I'm trying to build a scenario in HCI that looks something like the SOAP Lookup from UDF in PI.  I understand that there's the Content Enricher/Modifier pattern in HCI that could accomplish this, as discussed here . However, I'm getting no luck so far when trying to deploy the iFlow.

In my scenario, I'm basically just trying to enhance a standard integration content. So what I would like to happen is that, before HCI sends the incoming source message from COD into the message mapping, I would like to call a standard Query web service first, and get a value from its response and assign it in one of the fields in the source message. I've added the objects in Red in hopes of achieving that.

I added a Mapping before the Content Enricher because the actual source message from COD is different from the request message that the Web Service in COD_WS expects. Not really sure if this is the correct way.

So far, I'm only getting vague mapping errors during the execution of COD_ERP_Ser* mapping as per the logs. To make matters worse, the trace is not of much help. SAP said the tracing feature is already enabled in our tenant but I still couldn't see any message payload I'm also having doubts if the Content Enricher is really the right approach as it adds the message payload with the original message (either Enrich or Combine), as I understood it. So if it adds the payload, then the 2nd message mapping might not work as the source message would become different from what it really expects, hence the mapping error that I'm seeing. (Again, couldn't confirm this because of the useless trace)

Has anyone ever done this scenario with success?

Again, appreciate any inputs.

Thanks in advance.

Mark

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Mark,

I'm not sure I understand completly your scenario, but I did something similar not long ago, so I will try to help you.

Regarding your error, I think I know where the problem is, but I have to check something : are you sure the response payload from your Web Service is the same your mapping is expecting ?

For the trace, are you sure you activated it on your side to ? (In your flow properties, on 'Runtime Configuration' and 'Trace Configuration')

When you export the MPL does it work ? If not, you may try to ask to SAP support again.

Waiting for update,

Best regards,

Julen.

markbernabe
Active Participant
0 Kudos

Hi Julen,

Thanks for responding.

I just got the trace feature to work hence, the late response To answer your question, it's a No. The response of the web service connected to the Content Enricher is different from the expected source message of the COD_ERP_Ser Mapping. So what I would like to happen is to get the value from 1 of the fields in the response of the web service and assign it to a field in the source message before it enters the mapping.

Based on the trace, I'm getting an exception, 'Cannot produce target element' in the COD_ERP_Ser Mapping. The Content Enricher doesn't seem to work as the message that gets sent to COD_ERP_Ser is still the response of the 1st mapping.

Sriprasadsbhat
Active Contributor
0 Kudos

Hello Mark,

Content Enricher should work for your scenario ,post your Content Enricher Step input XML will be enriched with response you get from COD_WS SOAP Call.

Input Message Structure to Message Mapping will get changed post this Content Enricher step because Content Enricher will just push the response structure to node path you have mentioned.

If you dont want to change the mapping structure here is the way.


Step 1:

Change the content Enricher to RequestReply.

Step 2:

Before the request mapping add a Content Modifier to store the input message in property like below

Step 3:

Add one more content modifier after request reply and configure it like below.

1) Add header to store the value which you want to pass it original message later in step4[ Message Mapping ].

2) Configure the body like below to have the original structure again.

Step 4:

Add a Custom Function inside message mapping similar to that we have discussed in yesterdays post to retrieve the data stored in Step3 Content Modifier Header.

Hope this helps.!

Regards,

Sriprasad Shivaram Bhat

bhavesh_kantilal
Active Contributor
0 Kudos

And here I was trying exactly what Sivaram has proposed with a little tweak on my end to make sure it works. He beat me to it though

This is what I have done.. Hope this makes it clear.. Iflow looks as below

Start Step - Receive the Original SOAP Request Message

Content Modifier Step - Persist Original Message as a property


Execute Mapping - Forms the Request for my Lookup Mapping

Request Reply - Makes the Lookup call

Content Modifier - Sets the payload by combining Original Request Message and the response Message. My next mapping will be a multi mapping where I have the Original Request Message and the Response Message as 2 Message Types

Execute Mapping - Execute Mapping Program which is a N:1 or rather a 2:1 Mapping.

Regards

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

FYI - the 2nd Content Modifier as a XML as creating it manually can be a challenge


<multimap:Messages xmlns:multimap="http://sap.com/xi/XI/SplitAndMerge">

    <multimap:Message1>

           ${property.inPayloadProperty}

    </multimap:Message1>

    <multimap:Message2>

            ${in.body}

    </multimap:Message2>

</multimap:Messages>

Former Member
0 Kudos

Hi Mark,

I just read the responses of Shivaram and Bavesh, and it's exactly what I was thinking of telling you ! I think you will do great with both answer.

If I can just enhance with another thought, in our case, the web service was totally different than the incoming payload so we did a split of the payload (see attachment below). In the first branch we made a custom mapping before calling the web service, and we gathered the response payload with the original message, before sending the new payload to the last mapping.

Hope this help ! If you have any questions I will try my best.

Best regards,

Julen.

bhavesh_kantilal
Active Contributor
0 Kudos

Hello Mark,

Julen is being humble here. I think his approach of using a Multicast option with Join / Gather is the best approach in comparison to the mode we have suggested! It avoids complex "Setting / Getting Properties"

Hello Julen,

At times its good to have us be corrected! I had completely forgotten about the Multicast pattern. Am glad to be reminded of the same!

Regards

Bhavesh

markbernabe
Active Participant
0 Kudos

Hi Julen,

Thanks! Really appreciate it.

Quick question, what is the result after you've gathered the response payload with the original message? My understanding of the Gather step is it can only combine the messages if they have different formats. In my case, I only need to get a certain value from a particular field and assign it to one of the fields. So this might not work?

bhavesh_kantilal
Active Contributor
0 Kudos

Hello Mark,

- In the approach from Julen, the Gather Step will have combine messages of different XML Format.

- The Structutre of the XML will then be like the XML I have shared in my previous response.

- Your mapping will not change from a 1:N mapping to a N:1 mapping ( which I have a feeling you would not want to do as its a standard C4C mapping )

Regards

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

Update - The below solution also requires a change in the mapping! So the previous approach seems to be more cleaner. Sorry for the confusion!

If you do not want to change the mapping one other alternate could be that after your request reply, you have a mapping that converts the Response message to the same format as the original input XML message.

Then you can use the Incoming XML Format as XML Same Format  and Combine at XPATH and then use the XPATH to replace the values..

markbernabe
Active Participant
0 Kudos

Hi Sriprasad,

As always, it worked like a charm thanks again!

Former Member
0 Kudos

Hello Mark,

Like Bavesh said, the structure is as in his exemple, with a <multimap> tag et some <message1> <message2> tags.

My method is working, but it's a little extreme since (again like Bavesh is saying) you have to change your mapping from 1:N to N:1, which erase all previous mapping, so you will have remake the standard (took me half a day).

If you want to implement my method, there is one thing I did not try, which possibly could avoid the loss of the mapping : if you take a look at my flow, you could, after the Gather and before the N:1 mapping add a Groovy script, to take the informations you want and insert them at the spot you want in your payload.


With this method (theorically) you would just have to change the WSDL of you 1:N mapping with an enhanced version where the field of your web service are present.

I'm not sure my explanation are very clear... Let me rephrase.

In my case, since my two payloads have different format, I have no other choice to combine them. But if the two payload have the same format, I think it's possible to merge them. From memory, I would say that you have to make an Xpath expression of the node you want to extract, and a second Xpath expression for where you want to put the extracted node. Then all you have to do is enhance your WSDL from your 1:N mapping (with no mapping loss).

If you have any other question, I'm glad to help.

Regards,

Julen.

PS : I just assume that Bavesh is going to read my post and laught at my explanation nonsense.

UPDATE : Just read the previous post, so back to my method I think ?

bhavesh_kantilal
Active Contributor
0 Kudos

Laugh?! Why?

I love the questions on HCI that are being thrown on this forum and the responses we are getting. It reminds me of the XI 3.0 days! Please keep at it. Your response are extremely valid and bang on! I guess you've learnt it all the hard way while I am doing it the easier way of learning from others

Former Member
0 Kudos

Bhavesh Kantilal wrote:

I guess you've learnt it all the hard way while I am doing it the easier way of learning from others

That's exactly why I wanted to help in the first place, and I will continue to do so as soon as possible!

Sriprasadsbhat
Active Contributor
0 Kudos

Agree Bhavesh!

The time I have joined it was all matured SAP PI ( Heard my peers sharing experience on XI3.0 days ).Hope will tell one day our experience about early days of SAP HCI

Regards,

Sriprasad Shivaram Bhat

Answers (1)

Answers (1)

markbernabe
Active Participant
0 Kudos

Thank you experts for all your help!