Skip to Content

Adapter REST - change response content-type

Hi experts, we have a special requirement in our project which the sender REST adapter has to send a PDF file in the response payload.


To achieve this, we've developed a java module to get the base64 string content from the payload and transform it into a byte[], and we've changed the payload data as follows:


payload.setContentType("application/pdf");
payload.setContent(bytes);


But when we call the service in the browser or any other client, we realized that the content-type in the response still "application/json".


Does anyone has tried to change the content-type for the adapter REST before? Is this kind of operation allowed in adapter REST?

Thank you for the help.

Rgds. Raphael


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    Jun 22, 2015 at 10:55 AM

    Hi Raphael,

    Rest channel accept only application/xml and application/json

    please read Ryan Crosby comment in link

    Regards,

    Maheswarareddy

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 20, 2015 at 06:17 PM

    Hi,

    In NWDS, in Sender CC, under Adapter-Specific tab, in General tab, kindly uncheck the checkbox "Convert XML Payload To JSON".

    Regards,

    Souvik

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Raphael Xavier

      Hi,

      I don't think that it can be done via REST adapter. Instead, you can use mail adapter or SOAP adapter and use the payload as an attachment, and additionally using the converters.

      Regards,

      Souvik

  • Jun 22, 2015 at 01:44 AM

    Hi Raphael,

    Have you tried MessageTransformBean and insert it after the call adapter rest step?

    Regards,

    Mark

    Add comment
    10|10000 characters needed characters exceeded