web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

The remote server returned an error: (415) Cannot process the message because the content type 'application/json' was not the expected type 'text/xml; charset=utf-8'..

(0) ShareShare
ReportReport
Posted on by 150

Hello Everyone,
                the following error occured while calling a wcf webservice below is my code,

var webClient = new WebClient();
webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
var serviceUrl = "10.20.10.10/.../ProcedureExecuterBatch.svc";

// upload the data using Post mehtod
string response = webClient.UploadString(serviceUrl, memoryStream.ToString());



any help would be appriaciated ,  thanks in advance.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    The wcf you are calling does not support application/JSON format. It only accepts text/xml format.

    Try this

    webClient.Headers[HttpRequestHeader.ContentType] = "text/xml";

  • Razim Khan Profile Picture
    150 on at

    when i change it to

    webClient.Headers[HttpRequestHeader.ContentType] = "text/xml";

    the following error occured

    The remote server returned an error: (400) Bad Request

  • Suggested answer
    Community Member Profile Picture
    on at

    I believe you have not specified any method. You need to specify a method in the URL which will return the data.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans