Archive for December, 2008

1. REST GET with StringArray as Input parameter to Get Method:-
 
Define same service with 2 endpoints one for webhttp for rest and one for soap.
let the service accept a string array.
 
Now when you browse the service it ll throw error ‘System.String[]’ is not convertible by ‘QueryStringConverter since rest method does not support the string array as input parameter.
 
   <endpoint address="secure" binding="basicHttpBinding" contract="SilverlightApplication1.Web.EmployeeService" />
       <endpoint address="" binding="webHttpBinding" behaviorConfiguration="webBehavior" contract="SilverlightApplication1.Web.EmployeeService"  />
 
The issue is although the soap works fine..once you define mutiple endpoint it does not work.The way to work around this is for soap you can pass the bindig name ehile instantiating the proxy.For REST the easiest alternative is to pass deleted string and parse it.Although this always pose a limitation,you have live it with.
 
Another quick around is to use this :-How to: Create a Service That Accepts Arbitrary Data using the WCF Web Programming Model
 
 
Do note that you can pass Array or custom objects to PUT and POST but not to get method.So if you have the following:-
 

l[WebGet]
public IEnumerable<Employee> SearchEmployeeByRandomFields(String strSearch, string[] retFields)
        { — search operation code —  }
you ll get  Request Error – The server encountered an error processing the request. See server logs for more details
 
 
2.Quick REST Learning Resources:-
 
 
 
Advertisements