So, I just finished this, Interface:
[OperationContract] [WebInvoke(Method = "POST", UriTemplate = "LoggingTest/{logID}/{logLevel}?errorCode={errorCodeInt}", BodyStyle = WebMessageBodyStyle.Bare)] void LoggingTest(string logID, string logLevel, int errorCodeInt, Stream message);
Implementation:
public void LoggingTest(string logID, string logLevel, int errorCodeInt, Stream message) { switch (logLevel) { case "error": log.Error(errorCodeInt, message, null); break; case "warn": log.Warn(errorCodeInt, message, null); break; case "info": log.Info(errorCodeInt, message, null); break; case "debug": log.Debug(errorCodeInt, message, null); break; } }
And now it works. Something must be related to the parameters passed to the UriTemplate, because when I changed it to pass such parameters:
UriTemplate = "LoggingTest/{logID}/{logLevel}?errorCode={errorCodeInt}",
he started taking POST.
Editing 7/7: here's the latest JavaScript too:
jqueryPost('LoggingTest/LogID/debug?errorCode=0', { message: 'this is a test message'} ; function jqueryPost(url, message) { $.post(url, message); }
Thoughtcrhyme
source share