ADO.NET DataService: Passing parameter to [WebInvoke] Method


Consider following example :

public class SomeBusinessLayerService : DataService<MyEntityContainer>
 void DoSomething(string someParam)

I can not find example or any help on how can I pass parameter to the function!
Using WebClient (or goofinfg around with fiddler) I can trigger the function call, but no matter what I try the parameter someParam is always null
What's worse – if I change the type to int – all my attempts end in following error:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="">
  <message xml:lang="en-US">Bad Request - Error in query syntax.</message>

Can anyone please help with working example of POST content on how I can call it ?

NOTE: This is DataService, and not WCF service. I can get it working with WCF service same method without any problems.

EDIT: Also I need example of POST and not embedding parameter in URI because URI has size limit and requirement to sanitize the string.

Best Solution

After hours of also pulling my hair out with "Bad Request - Error in query syntax" responses, I finally got it working by passing the parameters in the URI.

Pay particular attention to the quotes around string parameters:

WRONG: DoSomething?someParam=param CORRECT: DoSomething?someParam='param'

Related Question