uritemplate

Optional query string parameters in URITemplate in WCF?

只谈情不闲聊 提交于 2019-11-29 05:24:00
I'm developing some RESTful services in WCF 4.0. I've got a method as below: [OperationContract] [WebGet(UriTemplate = "Test?format=XML&records={records}", ResponseFormat=WebMessageFormat.Xml)] public string TestXml(string records) { return "Hello XML"; } So if i navigate my browser to http://localhost:8000/Service/Test?format=XML&records=10 , then everything works as exepcted. HOWEVER, i want to be able to navigate to http://localhost:8000/Service/Test?format=XML and leave off the "&records=10" portion of the URL. But now, I get a service error since the URI doesn't match the expected URI

Passing a class as parameter in RESTful WCF Service

久未见 提交于 2019-11-29 04:04:34
In my RESTful WCF Serice I need to pass a class as a parameter for URITemplate. I was able to pass a string or multiple strings as parameters. But I have a lot of fields are there to pass to WCF Service. So I have created a class and added all the fields as properties and then I want to pass this class as one paramenter to the URITemplate. When I am trying to pass class to the URITemplate I am getting error "Path segment must have type string". Its not accepting class as a parameter. Any idea how to pass class as a parameter. Here is my code (inputData is class) [OperationContract] [WebGet

What is the best way to design a HTTP request when somewhat complex parameters are needed?

梦想的初衷 提交于 2019-11-28 16:51:40
I have some web services that I am writing and I am trying to be as RESTful as possible. I am hosting these web services using a HTTPHandler running inside of IIS/ASP.NET/SharePoint. Most of my services expect a HTTP GET. I have two of these that are simply returning some data (i.e., a query) and will be Idempotent , but the parameters may be somewhat complex. Both of them could include characters in the parameters of the service that are not allowed for at least the PATH portion of the URL. Using IIS, ASP.NET, and SharePoint I have found that the following characters in the URL path don't

Optional query string parameters in URITemplate in WCF?

为君一笑 提交于 2019-11-27 22:54:05
问题 I'm developing some RESTful services in WCF 4.0. I've got a method as below: [OperationContract] [WebGet(UriTemplate = "Test?format=XML&records={records}", ResponseFormat=WebMessageFormat.Xml)] public string TestXml(string records) { return "Hello XML"; } So if i navigate my browser to http://localhost:8000/Service/Test?format=XML&records=10, then everything works as exepcted. HOWEVER, i want to be able to navigate to http://localhost:8000/Service/Test?format=XML and leave off the "&records

Passing a class as parameter in RESTful WCF Service

萝らか妹 提交于 2019-11-27 03:30:05
问题 In my RESTful WCF Serice I need to pass a class as a parameter for URITemplate. I was able to pass a string or multiple strings as parameters. But I have a lot of fields are there to pass to WCF Service. So I have created a class and added all the fields as properties and then I want to pass this class as one paramenter to the URITemplate. When I am trying to pass class to the URITemplate I am getting error "Path segment must have type string". Its not accepting class as a parameter. Any idea