wcf-rest

WCF REST: What is it expecting my XML to look like in requests?

丶灬走出姿态 提交于 2021-02-18 01:00:29
问题 I have the following method in my WCF service: [OperationContract] [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml)] public int GetOne(string param1, string param2) { return 1; } I am sending xml from a Flex application, and it takes an object that looks like this: { param1: "test", param2: "test2" } and turns it into the following request: POST http://localhost:8012/MyService.svc/GetOne HTTP/1.1

WCF REST: What is it expecting my XML to look like in requests?

本小妞迷上赌 提交于 2021-02-18 00:55:08
问题 I have the following method in my WCF service: [OperationContract] [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml)] public int GetOne(string param1, string param2) { return 1; } I am sending xml from a Flex application, and it takes an object that looks like this: { param1: "test", param2: "test2" } and turns it into the following request: POST http://localhost:8012/MyService.svc/GetOne HTTP/1.1

WebInvoke POST “Method not allowed” in Wcf

て烟熏妆下的殇ゞ 提交于 2021-02-08 07:44:32
问题 my Rest wcf service as below... [ServiceContract] public interface IWinPhoneService { [OperationContract] [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "getkpimeasuredata", Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped)] List<MeasureData> GetKpiMeasureData(DomainData data); [OperationContract] [WebGet(UriTemplate = "getdata/{value}", ResponseFormat = WebMessageFormat.Json)] string GetData(string value); // TODO: Add your

How to Implement custom authentication in WCF service

眉间皱痕 提交于 2021-01-29 11:23:12
问题 I would like to create WCF restful service for mobile application with custom authentication. First request should be login, specially client sending username, password and getting access token. Then all other requests should be check access token. Also for authentication I would like to use asp.net membership provider in other words to use Forms based authentication. 回答1: At first, we should configure the Asp.net SQL membership Provider. Then we should use Username/password security mode so

In WCF can I have a wildcard character in a literal segment of my UriTemplate?

孤人 提交于 2021-01-27 17:11:09
问题 I am authoring a RESTful WCF service using .Net 4.0. I want the following two URLS: /root/document/{ids}?fields={fields} /root/externaldocument/{ids}?fields={fields} to map to the same interface member: Documents GetDocuments(string ids, string fields) I have tried putting a wildcard into a literal URL segment: [OperationContract] [WebGet(UriTemplate = "/root/*document/{ids}?fields={fields}")] Documents GetDocuments(string ids, string fields) However, this is not valid and I get the following

setting cookies within a wcf service

☆樱花仙子☆ 提交于 2020-05-14 09:01:32
问题 I have a asp mvc application consuming wcf rest services (all on the same box). For authentication calls, I am trying to set cookies inside a wcf rest service. Code on the client side - HttpResponseMessage resp; HttpClient client = new HttpClient("http://localhost/auth/login/"); resp = client.Get(); In the webservice I just use FormsAuthentication to set an authcookie. HttpCookie authCookie = FormsAuthentication.GetAuthCookie("foo", false); HttpContext.Current.Response.Cookies.Add(authCookie)

Bad Request Error On REST service Method call with POST (json Data)?

非 Y 不嫁゛ 提交于 2020-02-24 05:32:07
问题 Hi i am new to the RESTful WCF I am trying to do the the simple call to the webservice method using POST here is my code Service Interface code [ServiceContract] public interface IJsonSave { [OperationContract] [WebInvoke(UriTemplate = "/SaveJason", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest)] string SaveJason(string value); } web.config file code <?xml version="1.0"?> <configuration> <system

WCF REST : (C# 4.0 template) Securing with windows authentication and hosting in a windows service?

。_饼干妹妹 提交于 2020-01-17 13:50:46
问题 I am trying to find out how to secure my web services with Windows Authentication (Active Directory). I am using the "NEW" templates provided for c# 4.0 (vs 2010) and currently have this but i need to host it in a windows service - is this possible? I thought the WCF Rest clientCredentialType ="Windows" actually uses IIS to provide this type of security? I have searched the internet and found many examples with C# 3.5 but none for the new template provided to vs 2010 C# 4.0 to create a rest

WCF REST : (C# 4.0 template) Securing with windows authentication and hosting in a windows service?

≡放荡痞女 提交于 2020-01-17 13:49:06
问题 I am trying to find out how to secure my web services with Windows Authentication (Active Directory). I am using the "NEW" templates provided for c# 4.0 (vs 2010) and currently have this but i need to host it in a windows service - is this possible? I thought the WCF Rest clientCredentialType ="Windows" actually uses IIS to provide this type of security? I have searched the internet and found many examples with C# 3.5 but none for the new template provided to vs 2010 C# 4.0 to create a rest