c# - wcf rest send dictionary as parameter -
i have rest service
[operationcontract] [webinvoke(method = "post", requestformat = webmessageformat.json, responseformat = webmessageformat.json, uritemplate = "dispatche")] string dispatche(dictionary<string, dispatchparameter> dispatchparameters);
and dispatchparameter code
public class dispatchparameter { public string servicename { get; set; } public string serviceurl { get; set; } public string parameter { get; set; } }
in client when call service service parameter(dispatchparameters) dose not value
httpclient client = new httpclient(); var param = new dictionary<string, dispatchparameter>(); param.add("persons",new dispatchparameter(){servicename = "personservice",serviceurl = "personservice url"}); var result = client.postasjsonasync("http://localhost:1822/dispatcherservice.svc/dispatche", dispatchparameters).result;
is there mistake in code?
Comments
Post a Comment