Skip to Content

Michal’s PI tips: composite web services on PI

Sometimes we one of the enterprise web services does not provide all the information necessary and it turns out that there is another web service which can return the missing fields. On the other hand many of the calling tools cannot or do not want to call multiple web services one by one to get all of the information but just want to use one composite web service which would return all information. Can PI leverage such integration flows and if so how? There are a couple ways of doing that via PI but in order for them to work efficiently we need to make some assumptions:

a) we cannot use a ccBPM – if we want our composite web service call to be quick we cannot use ccBPM for doing it

b) we should only be using ICO objects – we don’t want to use the ABAP stack at all as it can slow down each call and in particular synchronous web service calls can suffer from that

c) we need to be able to turn of all of the logging for sync calls (which is disabled by default in PI) but we need to make sure it’s turned off remembering that sync call logging on ICO is only possible as of PI 7.31 (EhP1 for SAP PI 7.3)

How to create a composite web service call then in PI itself?

As I mentioned there are still multiple ways of doing a composite web service, we could create a java proxy which would just call all of the necessary web services but would it allow us to use any of the PI tools ? Not necessary, we wouldn’t even be able to provide communication channel details (URL, passwords etc.). Taking that into accout we’d like to prepare a composite web service call which would be able to use PI’s communication channels (as this is a way not only to do nice administration but sometimes it can save us a lot of programming – like programming special autorization types, available with SOAP-AXIS communication channels in strandard). In order to use PI’s communication channels we’d need to either use a standard PI flow (like ICO) or lookup API. As it’s not possible to call two synchronous web services from one call we could try using the lookup API. The idea is to call a first web service in a normal way (using the ICO object) and then call all of the rest of web services using the lookup API.

Imagine that system 1 is calling a WS on system 2,3 and 4. ICO object has a standard configuration to call just system 2 and systems 3 and 4 are being called using the lookup API as per screenshot below. The lookup API for web service can be called using Bhavesh’s blog: Webservice Calls From a User Defined Function..

Was that simple ? Is that all ? It turnes out we may have a second issue with this approach which we need to solve – passing parameters. How can we call the rest of the web services if the first one will not return the object key? We can have two situations:

a) composite web service calls can return multiple outputs from multiple object IDs (like details for multiple master data objects -materials). In this case the return messages from all web service calls need to return object IDs which can be used for calling additional web services. There is no problem here.

b) composite web service call can return only information about one object (like Purchase Order details). In this case the response may not have Purchase Order number in the response so we need to find out a way to call the rest of the web services with the same object ID.

How can we deal with the issue from the second approach if we cannot use variables from request message in the response mapping?

We can easily do it using Adapter Specific Message Attributes – ASMA. Inside the request mapping put the object ID into some ASMA parameter and inside the response mapping you can query ASMA data to get the same object ID and this way it does not have to be in the reponse of the first web service call at all.

How do you fell out this approach?

You must be Logged on to comment or reply to a post.
    • Hi Shabz,

      now you’ve stubbed a knife in my heart 🙂
      a sync BPM with multiple sync send steps inside?
      I guess this would no longer be a sync call but a overnight call I guess hehe 🙂

      Michal Krawczyk

      • hate to break your heart man 🙂

        But on a serious note, I have one of the most complex BPMs I have ever put my hands running in production all happy and fine. it involves numerous WS calls and the end result of which is a E2E processing time under 5-6 sec

        What i love is the way we can control on the exceptions thus making it a meaningful business process in its own terms!

  • Hi Michal,

    What if it is not ICO – will it still work – will the parameter be available in the response? To be honest the context of ASMA attributes is not defined after all…

    And I am thinking – what if the attribute is set directly in the request (e.g. System namespace, FileName param)  – can it be used directly in the response e.g. when it comes for writing the file ?

    Thanks & best regards,