Take the 2-minute tour ×

I have a WCF Rest service that i am try to test with the Firefox Rest Client,

The signature of the method i am calling is

        [WebInvoke(Method = "POST", UriTemplate = "UploadEvidenceData/{userName}/{password}/{cdb}")]
    public EvidenceData UploadEvidenceData(string userName, string password, string cdb, EvidenceData evidence)

The Data Contract for evidence is

    [DataContract(Name = "EvidenceData", Namespace = "http://StudentEvidence.com")]
public class EvidenceData
    public string LearnerID { get; set; }

    public string UnitID { get; set; }

    public string AssessorID { get; set; }

    public int MethodO { get; set; }  //int

    public int MethodEwt { get; set; }  //int

    public int MethodEp { get; set; }  //int

    public int MethodQc { get; set; }  //int

    public int MethodEps { get; set; }  //int

    public int MethodPd { get; set; }  //int

    public int MethodS { get; set; }  //int

    public int MethodEwa { get; set; }  //int

    public int MethodEch { get; set; }  //int

    public int MethodEwe { get; set; }  //int

    public int MethodApel { get; set; }  //int

    public int EvidenceID { get; set; }  //int

    public string EvidenceFileName { get; set; }

    public int EvidenceFileSize { get; set; }  //int

    public string EvidenceDescription { get; set; }

    public string AssessorFeedback { get; set; }

    public string Signature { get; set; }

    public int RequirementID { get; set; }  //int

    public int ModuleID { get; set; }  //int

    public EvidenceData()
        this.LearnerID = string.Empty;
        this.UnitID = string.Empty;
        this.AssessorID = string.Empty;
        this.MethodO = 0;
        this.MethodEwt = 0;
        this.MethodEp = 0;
        this.MethodQc = 0;
        this.MethodEps = 0;
        this.MethodPd = 0;
        this.MethodS = 0;
        this.MethodEwa = 0;
        this.MethodEch = 0;
        this.MethodEwe = 0;
        this.MethodApel = 0;
        this.EvidenceID = 0;
        this.EvidenceFileName = string.Empty;
        this.EvidenceFileSize = 0;
        this.EvidenceDescription = string.Empty;
        this.AssessorFeedback = string.Empty;
        this.Signature = null;
        this.RequirementID = 0;
        this.ModuleID = 0;

and when i use the client use the address http://something.com/Service/UploadEvidence/user/pass/mydb

and in the body i put

{"AssessorFeedback":"Nothing to report","AssessorID":"32fac8c2-0f9b-4cad-a2e4-55b06e968da0","EvidenceDescription":"some evidence","EvidenceFileName":"Lighthouse.jpg","EvidenceFileSize":561276,"EvidenceID":0,"LearnerID":"61b9eca6-6c3e-4bd3-8963-69d9ad3e5eeb","MethodApel":0,"MethodEch":0,"MethodEp":0,"MethodEps":0,"MethodEwa":0,"MethodEwe":0,"MethodEwt":0,"MethodO":0,"MethodPd":0,"MethodQc":0,"MethodS":0,"ModuleID":1131,"RequirementID":30476,"Signature":null,"UnitID":"c33ea6e1-ac54-46dc-a512-3a2efafd5a0b"}

and i have custom header of application/json

This all works fine from a .net client, but not from the rest client plugin of firefox 400 everytime.

any help is very much appreciated


My Web config File

    <httpRuntime maxRequestLength="2147483647"/>
    <modules runAllManagedModulesForAllRequests="true">
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
        <standardEndpoint name=""
                          transferMode="Buffered" />

share|improve this question
Don - just trimmed your signature: stackoverflow.com/faq#signatures –  JcFx Aug 24 '12 at 14:27
@JcFx A simple "Thanks" doesn't hurt and is actually polite. Suggested edits should be substantive improvements addressing multiple issues in the post. –  fancyPants Aug 24 '12 at 14:36
@JcFx Though the link you provided is also valid, please have a look here: meta.stackexchange.com/questions/139830/… Anyway thank you very much for your commitment to this site. –  fancyPants Aug 24 '12 at 14:38
@tombom My own "thanks in advance", plus name, was removed from my first post (stackoverflow.com/posts/11214301/revisions). Since then I've seen any number of thanks + name sigs removed from other posts. I understood we were not to sign posts at all. I personally think the civility of the site would be improved by allowing signatures, and thank yous, as long as they don't self-promote, but above all think that any rule should be applied consistently. I'll gladly bow to your greater experience in this case. –  JcFx Aug 24 '12 at 14:45
@JcFx Well, two arguments against removing "thank you"s: 1. It causes unnecessary work for others who review edits 2. Search for "thank" on this site and you can find thousands of questions/answers, so sometimes such edits are just reputation farming. Of course I don't impute this to you. –  fancyPants Aug 24 '12 at 15:04

1 Answer 1

up vote 0 down vote accepted

400 often means wrong Http method. Does the Firefox client use GET (which would require a different attribute on your method, and a tweak to your web.config to allow web get), or are you certain it's POST?

Also, check this content-type issue: Why does my C# client, POSTing to my WCF REST service, return (400) Bad Request?

Also see if adding RequestFormat = WebMessageFormat.Json to the [WebInvoke] attribute decorating your service method helps. I think this defaults to xml, which is probably what the .NET client sends. http://msdn.microsoft.com/en-us/library/system.servicemodel.web.webinvokeattribute.requestformat.aspx

share|improve this answer
Appreciate the response, the link, I am already using application/json. I am using POST because they complex type is being passed in the request body as JSON which is why it does not appear in the UriTemplate? so if i am correct the GET wont work which is why I am not using GET. –  Mr Cecil Dooberry Aug 24 '12 at 15:19
That's right, you shouldn't use get (it won't work with that configuration). I just wondered if the Firefox client used GET by default? Also, you might post your Web.Config - I think the problem is more likely to be in the Service Configuration than in the implementation. Also - check to see if cross-domain access is enabled: I'm not sure what 'domain' the Firefox test client appears to be calling from, but that's another thing that has given me a 400 error in the past. –  JcFx Aug 24 '12 at 15:22
posted web config above, the Firefox client default is GET but i had changed to POST. –  Mr Cecil Dooberry Aug 24 '12 at 15:40
I can't see what's wrong there, but hopefully with that info somebody else will be able to. –  JcFx Aug 24 '12 at 15:46
One final thought. You might try adding RequestFormat = WebMessageFormat.Json to your WebInvoke attribute –  JcFx Aug 24 '12 at 16:24

Your Answer


