"content-type of the request should be text/xml " Error when connecting to Salesforce via SOAP

HI , I need help resolving this issue.

  • I have created a POST callout out to the Salesforce URL: https://login.salesforce.com/services/Soap/c/50.0

  • I added the SOAP raw body under the Body Tab complete with my SF credentials.

  • I selected the XML option (and I notice that there is no “XML (text/html)” option anymore)

  • I unchecked the default Content-Type key under the Headers tab ( it was Read-Only and not letting me change the value to “text/html” from the default value of “application/xml”).

  • Added a new Content-Type key set to “text/html” under the Headers tab. Please see the last entry

  • Added the SOAPAction key under the Headers tab.

When I sent the Post method , I got a 500 response where the fault string tag indicated that “content-type of the request should be text/xml”

  • I have listed screen shots


1.Why is it returning this error when it seems like everything should be configured correctly?

  1. Does the latest version of Postman still use the “text/html” option for the Body tab ?
    Currently only HTML, Text, JSON, JavaScript, and XML are the only selections but I have seen examples with “XML (text/xml)”.

Thanks . See scrapes below. (Note: Credentials have been falsified for security reasons)

Hi @twill727, Welcome to the community!

On checking the documentation of the mentioned API, it seems this API supports content-type as “text/xml”. Can you please try to use “text/xml”

Hope this helps :slight_smile:

@pranavdavar Thanks for your response however; I did do what you said for the content type. (Please see my steps in the question I had submitted on the forum). The problem was that the Content Type under the Headers Tag was set to “application/xml” but it was also Read-Only so that I could not change the value for this content type key.
So I unchecked the Content Type check box and created a new Content Type key having the correct “text/xml” value and I checked its checkbox instead. However authentication still did not work.
Does that make sense? I did look at the link you had sent by the way.

By doing so, did u get the same error or some other error you got?

Yes unfortunately I did get the same error.

I got the same error message but I also noticed an icon next to the Body Tab’s Content-Type menu that indicates that the “language selected is different from the language inferred from the Content-Type header”, So I am wondering if the newly created Content Type that I created has been overridden by the default Content Type key? I have enclosed a screen scrape. Maybe postman does not acknowledge that new one.

HI @pranavdavar I discovered the problem: In order to stop the Content-Type from automatically displaying the application/xml , we need to:

  1. change the method from Post to Get so that the Content-Type will be removed.

1B) Set the Body Tab to form-data.

  1. In the Headers tab, add the new Content-Type as the key and add text/xml as the value.

  2. Change the method back to Post and verify that the default Content-Type does not overwrite the one you just added in step 2.

3b) Change Body Tab to raw.

  1. Send your request and verify that you get a return code of 200 OK.

  2. Check the response body which should give you your SF user instance and you
    Solution page: Content-Type Header Automatically Added to GET Requests - #6 by mer2018

@twill727, Glad to hear that you found out the solution. But I haven’t faced such an issue previously. Not sure why you faced this one.

Generally, if you explicitly apply the content type tag it will overwrite the old tag.