locked
Error "The content type 'text/plain; charset=UTF-8' is not supported." at PUT Request RRS feed

  • Question

  • I developed my first WCF Data service as shown below with MS Visual Studio, and now I'm testing the different REST methods by using the "REST Client" add in for Firefox. I'm using the JSON format. I did the PUT method:

    {"requestUrl":"http://localhost:1080/BNFSDataModel01/WcfDataService1.svc/Company(102)","requestMethod":"PUT","requestBody":"{
     "d":{
      "Name": "Text Company",
      "IndustrialSectorCode": "66.0E",
      "DefaultCurrencyCode": "EUR",
      "RegistrationCountryCode": "DE",
      "LogoPicture": "",
      "RegistrationStatusCode": "INIT",
      "SupplyChainRoleCode": "BBP000",
      "ConnectionStateText": "Command okay. ",
      "LastModificationDate": "/Date(1331856000000)/"
     }}
     ","headers":[]
    }

    the system throws me the following error message:

    {
     "error": {
      "code": "",
      "message": {
       "lang": "de-DE", "value": "The content type 'text/plain; charset=UTF-8' is not supported."
      }
     }
    }

    Can somebody tell me please, what I have to consider. By the way, I use the IIS as internet server.

    Thank you very much in advance.

    ==================

    The WCF Data Service source:

    using System;
    using System.Collections.Generic;
    using System.Data.Services;
    using System.Data.Services.Common;
    using System.Linq;
    using System.ServiceModel.Web;
    using System.Web;

    namespace BNFSDataModel01
    {
     public class WcfDataService1 : DataService<BNFSEntityModelContainer>
     {
      // Diese Methode wird nur einmal aufgerufen, um dienstweite Richtlinien zu initialisieren.
      public static void InitializeService(DataServiceConfiguration config)
      {
       // TODO: Regeln festlegen, die angeben, welche Entitätssets und welche Dienstvorgänge sichtbar, aktualisierbar usw. sind
       // Beispiele:
       config.SetEntitySetAccessRule( "Company", EntitySetRights.All);
       config.SetEntitySetAccessRule( "PostalAddress", EntitySetRights.All);
       // config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
       config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
            }
        }
    }


    Saturday, March 17, 2012 8:47 PM

Answers

  • "headers": [{"content-type": "application/json"}];


    Peter Q. http://blogs.msdn.com/peter_qian

    • Marked as answer by Gunther Stuhec Thursday, March 22, 2012 10:51 PM
    Sunday, March 18, 2012 4:54 AM
    Answerer

All replies

  • "headers": [{"content-type": "application/json"}];


    Peter Q. http://blogs.msdn.com/peter_qian

    • Marked as answer by Gunther Stuhec Thursday, March 22, 2012 10:51 PM
    Sunday, March 18, 2012 4:54 AM
    Answerer
  • Peter, thank you very much. This works.

    Thursday, March 22, 2012 10:51 PM