Search code examples
wcfwcf-binding

Handle JSON calls in WCF to single URL with method name contained in request body


We are replicating an existing service and need to offer the exact same contract.

Requests are posted to a single URL with the method name contained in the request body.

For example the request body of a call to LoginService.Login:

All calls will be made to: http://example.com/json

{"id": "","method":"LoginService.Login","params":{"aUserID":"flip","aPassword":"1234-613E-1240-C55D-9853F37A41B2"}}

How can we accomplish this within WCF? The response should also be JSON.


Solution

  • I didn't know what I wanted was called jsonrpc. Luckily somebody already tackled this problem:

    Implement JSON-RPC in WCF