Skip to Content

Sender Rest adapter Get operation processing

Hi All,

I have a scenario where I need to host a REST service using GET operation and there are 2 optional parameters (let's call them a and b).

Since this is GET operation, I am not expecting any HTTP payload in body. I have configured the sender rest channel to convert data to XML and add wrapper of Message type name (refer screenshots). I have done request mapping to hard code a few parameters.

However, if I send a GET message to the service using a rest client with no payload, I receive an error (MP: exception caught with cause Unable to parse XML message payload to extract operation for receiver determinationorg.xml.sax.SAXParseException: Premature end of file.). PI doesn't seem to like empty HTTP body even in case of GET operation.

Also noticed that:

  1. REST adapter does not add the wrapper element to the request message, if there is no content in body. I would have though it would create an empty root level tag with message type name.
  2. If I change the option to POST and pass {}, as HTTP body, my interface works fine.

Am I doing something wrong here?



Message was edited by: Sanjeev Shekhar Singh

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jun 28, 2016 at 07:11 AM

    I dont have a REST adapter on my landscape and hence while not a direct answer, Why not use the plain HTTP_AAE Adapter with the GET method?

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 28, 2016 at 07:36 AM

    Hi Sanjeev,

    you need to define the parameters in REST resources in the sender channel

    in the runtime the parameters will be available in the dynamic configuration and you need to extract these in your mapping

    you don't have to send any payload, the parameters will be supplied in the url

    Capture.JPG (50.9 kB)
    Capture.JPG (65.8 kB)
    Capture.JPG (50.9 kB)
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.