Question

I have gone through much articles and questions but I am unable to resolve my problem. I am new to Fiddler and don't know how to use it. I want to pass List ob objects as an input in my WCF REST Service.

Here is my Service Interface:

[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "LeadStage",
    ResponseFormat = WebMessageFormat.Xml,
    RequestFormat = WebMessageFormat.Json,
    BodyStyle = WebMessageBodyStyle.Bare)]
Result AddLeadStage(ReqLeadStage[] rls);

This is my ReqLeadStage class.

public class ReqLeadStage
{
    public string Id { get; set; }
    public string Name { get; set; }
    public string Comments_Remarks__c { get; set; }
    public string Entry_Point__c { get; set; }
    public string Exit_Point__c { get; set; }
    public string IsActive { get; set; }
    public string Sequence_No__c { get; set; }
    public string Stage_Description__c { get; set; }
    public string CreatedById { get; set; }
    public string CreatedDate { get; set; }
    public string LastModifiedById { get; set; }
    public string LastModifiedDate { get; set; }
}

And this is my Web.Config

<system.serviceModel>
  <services>
      <service name="SalesForceWCF.SalesForce" behaviorConfiguration="">
          <endpoint address="" behaviorConfiguration="RESTBehavior"
            binding="webHttpBinding" contract="SalesForceWCF.ISalesForce"/>
      </service>
  </services>
<behaviors>
    <endpointBehaviors>
        <behavior name="RESTBehavior">
            <webHttp helpEnabled="true"/>
        </behavior>
    </endpointBehaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
      <behavior name="Default">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
  </serviceBehaviors>
</behaviors>
<protocolMapping>
    <add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>    
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

And this is my Result class:

[DataContract]
public class Result
{
    [DataMember]
    public int CODE { get; set; }
    [DataMember]
    public string STATUS { get; set; }
    [DataMember]
    public string DESCRIPTION { get; set; }
}

Here is how I ma calling it from Fiddler: POST Request

And JSON:

[ { "attributes" : { "type" : "Lead_Stage__c", "url" : "/services/data/v29.0/sobjects/Lead_Stage__c/a009000000Rmb3wAAB" }, "Name" : "Discovery", "LastModifiedById" : "005900000028VWrAAM", "CreatedById" : "005900000028VWrAAM", "CreatedDate" : "2013-12-23T10:22:48.000+0000", "LastModifiedDate" : "2013-12-23T10:22:48.000+0000", "Id" : "a009000000Rmb3wAAB" }, ...... ]

This is a complete picture How I am sending my Request! Complete POST Request

And this is the error:

400 Bad Request

400 Bad Request Error. I am not able to trace it.

Thanks!

Was it helpful?

Solution

A per the discussion between me and Faizan Mubashe Here he comes to know that The problem was in database section.

Previously he was not able to figure out how he can debug the WCF service.

So the steps of doing that is simple

dubug your service and then make a request through REST Client Add on from Mozilla.

If that is not working properly then you can go to debug menu -> attach a process -> find and select the REST Mozilla.

This will enable the Debugging of project/ WCF rest Service.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top