Skip to Content

Consuming Synchronous RESTful Web Service with PI – II

Continued from my earlier blog.

The blogpost will be incomplete without mentioning an architectural constraint associated with the approach. Since we are using the dynamic configuration to store on the URL until it is invoked by the receiver adapter, we need to live with the limitation of maximum length for the value a dynamic configuration can accept. The default limit is 200 characters and SAP strongly recommends against increasing the limit. Therefore the approach is good for a RESTful web service carrying fewer parameters. One way to manage this limitation is to work with the Web Service provider towards building shorter static part in the URL, leaving more space for dynamic values.

2. GET Method

By default SOAP channel calls POST method on the target server. However in this case it was essential that GET method is invoked. This is made possible by setting the parameters for the handler as below:

Key – set soap12.webmethod

Value – GET

The screenshot in previous blog also shows this configuration.

Well, the journey is not over yet. As we embark upon testing this scenario, we are greeted by a weird error in mapping.


Although it points to mapping error, the problem lies somewhere else.

By default the SOAP adapter is configured to extract payload from SOAP Body child. However since we are not dealing with SOAP at all, there is no question of extracting the payload. The RESTful web server typically sends a response that PI accepts as an attachment. Therefore we need to train the SOAP adapter to extract the payload from attachments. The following configuration in the communication channel does the trick.


Activate the channel and execute the scenario. Voila! We are able to consume a light-weight, dynamic web service using SAP PI.

Of course , we may discover more challenges as we travel down the path of calling different flavors of RESTful web services. However there is one thing I can vouch for – the journey will always be exciting and the results enlightening..

Please feel free to share your experience / feedback on this topic.

You must be Logged on to comment or reply to a post.
  • Thank you for these two blogs. I managed to call a web service via dynamic url with you
    instructions. But I have the 200 characters problem. Is there any solution for

    • Thanks Gil. For our scenario, we worked with the WS provider to shorten the static part of the URL and thus leave more space for adding the runtime values.

      However if I were to explore further, I would try to write a custom axis module that would extract values from multiple dynamic config variables ( so that the total length available to us is 200 x N ) , concatenate them and set as the URL for the adapter. 



      • Hi,

        Thank very much for this blog.Now I am facing probleme with axis adapter.My synchnronous scenario is :

        SRM->SAP PI–>Web service Rest ( using GET method).

        My sender and receiver are developped as shown in the attachment :




        Any idea please?

  • Hi Amit,

    Thanks for the wonderful blog which helped me a lot.

    But even after using the option of Keep Attachment in the receiver channel I am getting “Premature end of file exception” during response message mapping. The response payload is empty. The channel is initialized successfully.

    I have created a proxy to soap axis sync scenario to a restful web service for getting exchange rates back.

    Any pointers would be helpful.



  • Hello Amit,

    I configured the SOAP receiver channel as mentioned in the blog, but I get the same error as Pooja, end of file

    I’ve checked ‘Keep XI Headers’ & ‘Keep Attachments’ check boxes and ‘Payload Extraction’ to ‘Attachment’.

    Can you please help me with this error?



  • Hi Amit ,

    Thanks for sharing this nice idea..I followed the solution but can you please suggest me if the dynamic url contains “&” ,How can we pass it via UDF .everytime I pass the ampersand it gets converted into &#38 in header part of the XI message.

    Can you please help me with this error?


    Suparna Banerjee