wcf-rest

A restful service API designing issue

旧巷老猫 提交于 2019-12-08 05:47:10
问题 One issue about the restful service API designing. I'm not sure how is a proper way to do it. Please give me some suggestions. My scenario is like this. I have a user resource and permission resource. http://www.sample.com/rest/users http://www.sample.com/rest/permissions User can have multiple permission; one permission can be used for many users; it is many to many relationship. Normally, we can say a permission belongs to a user, so we have an API like: http://www.sample.com/rest/users/

Consume FileStream from WCT Restful service

妖精的绣舞 提交于 2019-12-08 04:55:06
问题 I have created a WCF Restful service, with the following code: Interface: [ServiceContract] public interface ISIGService { [OperationContract] [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "GetMultimedia/{id}")] Stream GetMultimedia(string id); } The code that implements this Service: public Stream GetMultimedia(string id) { string filePath = MultimediaBLL.GetFilePath(int.Parse(id)); if (string.IsNullOrEmpty(filePath))

Test Client for testing WCF Rest services or just use browser?

只愿长相守 提交于 2019-12-07 18:08:47
问题 I have written my first rest services and currently i am testing them in a browser. Is there a test client or some sort that provides additional features or is this the normal way of testing i.e. in IE, Firefox etc? 回答1: I use Fiddler. Browsers are a real pain to try and test with. 回答2: You may want to consider testing them through a unit testing framework instead of through the browsers. E.g. NUnit or - depending on your Visual Studio edition - MS Test might be options. You may be able to

Can't Pass JSON Post Data to WCF REST Service using Fiddler

自古美人都是妖i 提交于 2019-12-07 16:39:20
问题 I'm trying to invoke a WCF rest service as shown below: [WebInvoke(UriTemplate = "Login", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] public string Process(string AuthenticationInfo) { I'm trying to invoke it using the following below in Fiddler 2: User-Agent: Fiddler Host: localhost content-type: application/json;charset=utf-8 content-length: 0 data: {"AuthenticationInfo": "data"} I have a breakpoint in the method, and it does hit the breakpoint, but the

WCF + REST, Increase MaxStringContentLength

℡╲_俬逩灬. 提交于 2019-12-07 13:55:02
问题 We are running into the following error: There was an error deserializing the object of type Project.ModelType. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. There are a ton of articles, forum posts, etc., showing how to increase the MaxStringContentLength size for a WCF service. The problem I'm

Consume FileStream from WCT Restful service

那年仲夏 提交于 2019-12-07 09:44:28
I have created a WCF Restful service, with the following code: Interface: [ServiceContract] public interface ISIGService { [OperationContract] [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "GetMultimedia/{id}")] Stream GetMultimedia(string id); } The code that implements this Service: public Stream GetMultimedia(string id) { string filePath = MultimediaBLL.GetFilePath(int.Parse(id)); if (string.IsNullOrEmpty(filePath)) return null; try { FileStream multimediaFileStream = File.OpenRead(filePath); return multimediaFileStream

Customize the WebHttp Help Output in WCF

前提是你 提交于 2019-12-06 21:08:10
问题 For a service with webHttpBinding and helpEnabled="true", the help information is getting generated properly. Was wondering if it is possible to control the output somehow. Below are the changes I would like to make. Remove the JSON help as the service doesn't support JSON output. Having it there might be confusing to users. At least, have a way to output a note saying JSON is not supported. For the example replies shown, use a better example than "String content" where actual value samples

Create a WCF Proxy for a Rest Web Service

≡放荡痞女 提交于 2019-12-06 15:22:00
I have a complex WCF Rest service which take multiple inputs and objects. I cannot simply call it by doing an HTTP POST in Fiddler because there is too much data to provide (I could, but it will take me forever). So I would like to do it in code using a proxy. Is there a way to generate a proxy for a .NET 4 WCF Rest Service? Otherwise, what do you propose to allow me to easily test the service? Thanks. There's no standard way of creating a proxy for a WCF REST service (there's no WSDL for REST, one emerging standard, WADL, isn't widely adopted, and WCF doesn't support it). For testing purposes

Render an MVC3 action to a string from a WCF REST service method

故事扮演 提交于 2019-12-06 14:02:27
问题 I have a WCF REST service that takes some parameters and sends an email. The template for the email is an MVC3 action. Essentially I want to render that action to a string. If it were an ASP.NET WebForm, I could simply use Server.Execute(path, stringWriter, false) . However when I plug in the path to my action, I get Error executing child request . I have full access to HttpContext from my service ( AspNetCompatibilityRequirementsMode.Allowed ). I know there are other answers out there for

Restful WCF POST issue with application/json content type request

橙三吉。 提交于 2019-12-06 12:28:55
问题 I've configured a RESTful WCF with the following POST "operation": [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "/Test", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json)] void PostTest(Stream stream); In my web.config, I've configured the following: <service name="MyTest.TestSvc" behaviorConfiguration="MyTest.TestBehavior" > <endpoint address="" behaviorConfiguration="MyBehavior" binding="webHttpBinding" contract="MyTest.ITestSvc"/> <endpoint