REST Only accepts String..?
So What I do is make a string exposed contract and convert it server side, and pass it to my method which SOAP was directly calling. Which works. ( I can call REST from firefox)
BUT now, I cannot expose my SOAP OperationContract with out causing a problem with the error:
Operation 'GetServices' of contract 'IServices' specifies multiple request body parameters to be serialized without any wrapper elements. At most one body parameter can be serialized without wrapper elements. Either remove the extra body parameters or set the BodyStyle property on the WebGetAttribute/WebInvokeAttribute to Wrapped.
Below are my 3 exposed methods. Only when I hide the 3rd will REST work. Removing my SOAP connection.. ( I belive it wants REST setup on the 3rd method and as its not been defined, fails to understand it)
// REST
[OperationContract]
[WebGet(UriTemplate = "GET/Services/{CostCentreNo}/{Filter}")]
List<Services> RestGetServices(String CostCentreNo, String Filter);
// REST
[OperationContract]
[WebGet(UriTemplate = "GET/ServiceDetails/{CostCentreNo}/{ServiceCode}/{Recurring}")]
List<ServiceDetails> RestGetServiceDetails(String CostCentreNo, String ServiceCode, String Recurring);
// SOAP
[OperationContract]
List<Services> GetServices(Int32 CostCentreNo, Int32 Filter);
Surely I can make just one contract method, which allows me to call either SOAP OR REST.
As mentioned in Can I pass non-string to WCF RESTful service using UriTemplate? :
This is taken from the answer ( Can I pass non-string to WCF RESTful service using UriTemplate? ), bold formatting is mine…
So an example of a REST and SOAP accessable method:
Which is accessible by
http://localhost:1337/WCF.IService.svc/rest/Services?CostCentreNo=1&Filter=1