Issues with setting the contentType in javacallout

@Dino-at-Google @Sai Saran Vaidyanathan @Siddharth Barahalikar

I am trying to set the content type in java callout. I am able to set the response using

messageContext.getMessage().setContent(variableName);

But I am not able to set the content type to application/json. tried using the following methods but no luck.

messageContext.getMessage().setcontentType("application/json"); 

also tried these methods

  • setResponseHeader
  • setHeader
  • setContentType
  • setcontentType

Can you plz help me on how to set the content type

May I know how to identify the methods supported in getMessage().

2 1 136
1 REPLY 1

The documentation (javadoc) is here.

I think you can use

messageContext.setVariable("message.header.content-type", "application/json");