Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8898271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:34:16+00:00 2026-06-15T00:34:16+00:00

trying to POST json dictionary to C# WCF, when i invoke it HTTP Response

  • 0

trying to POST json dictionary to C# WCF, when i invoke it HTTP Response 415. Someone can tell me whats wrong with my code.

object Class

 [DataContract]
public class Class1
{
    [DataMember]
    public string AccNo;
     [DataMember]
    public string CompanyName;
     [DataMember]
    public string DocDate;
}

IService1.cs

   [OperationContract]
    [WebInvoke(Method = "POST", UriTemplate = "json/PostSalesOrderData", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        string PostSalesOrderData(string data);

Service1.svc.cs

 public string PostSalesOrderData(string data)
    {

        JavaScriptSerializer serializer = new JavaScriptSerializer();

        Dictionary<string, Class1> dict = serializer.Deserialize<Dictionary<string, Class1>>(data);

        return dict["Debtor"].AccNo.ToString();
    }

Fiddle Details

HTTP/1.1 415 Cannot process the message because the content type ‘application/json; charset=utf-8’ was not the expected type ‘text/xml; charset=utf-8’.
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Thu, 29 Nov 2012 01:21:55 GMT
Content-Length: 0

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T00:34:17+00:00Added an answer on June 15, 2026 at 12:34 am

    The endpoint for your service is not properly configured to receive JSON input. In order for the [WebInvoke] attribute to be honored, your endpoint needs to have the webHttpBinding, and it should also have an endpoint behavior of type <webHttp/>

    One easy way to ensure that it’s properly configured is to use the Factory attribute on the .svc file. Something like the example below:

    <%@ ServiceHost Language="C#" Debug="true"
                    Service="YourNamespace.YourServiceClass"
                    Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to post JSON data to Spring controller.. Not working at all JSP Code:
I am trying to POST JSON to a WCF service. The json object contains
I am having problems trying to POST a JSON Array. For my Android code,
I am trying to POST JSON to a WCF service. The json object contains
I am trying to post json object {venue:places, US} using below code- HttpClient client
I'm currently trying to post a JSON object from my view to my controller
I'm trying to POST a PayPal or GoogleCheckout buy now button from the code
I'm trying to post a JSON object through a POST. I'm trying to do
I'm trying to figure out how to POST JSON from Android by using HTTPClient.
I am trying to get my datatable to take a POST JSON output from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.