KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have exposed my REST API service using WCF Service Library and started by console application. when I try to consume the service from client ( another console application), I am getting "Bad Request" exception. please see the code below :- [ServiceContract(Namespace = "http://www.test.com/Enrollment")] public interface IEnrollService { [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "enroll", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml, BodyStyle= WebMessageBodyStyle.Bare)] string EnrollData(Enroll enrData); } public class EnrollService : IEnrollService { public string EnrollData(Enroll enrData) { return "Hello, your test data is " + enrData.AccountNumber; } } DataContract [DataContract(Namespace = "http://www.test.com/Enrollment")] public class Enroll { [DataMember] public string ClientId { get; set; } [DataMember] public string AccountNumber { get; set; } [DataMember] public string TaxId { get; set; } [DataMember] public string TaxType { get; set; } [DataMember] public string EmailAddress { get; set; } [DataMember] public string Pin { get; set; } [DataMember] public string State { get; set; } } app.config settings <system.serviceModel> <services> <service name="OEA.REST.EnrollService" behaviorConfiguration="OEABehavior"> <endpoint address="http://localhost:8010/OEA/Service/EnrollService" binding="webHttpBinding" behaviorConfiguration="webHttp" contract="OEA.REST.IEnrollService" /> <host> <baseAddresses> <a
Tags (comma-separated)
Save Edits
Cancel