what is the URL for WCF post?
I create a VS 2008, WCF method like this
[WebMethod]
public string TestMethod(string param)
{
return "param:" + param;
}
so then I go to
http://localhost:57000/Service1.asmx?op=TestMethod
But how do I do a post to this?
On the test page it says
HTTP POST
The following is a sample HTTP POST
request and response. The placeholders
shown need to be replaced with actual
values.POST /Service1.asmx/TestMethod
HTTP/1.1 Host: localhost Content-Type:
application/x-www-form-urlencoded
Content-Length: lengthparam=string
HTTP/1.1 200 OK Content-Type:
text/xml; charset=utf-8
Content-Length: lengthstring
I would expect to be able to type in a url something like
http://localhost:57000/Service1.asmx?op=TestMethod?param=teststring
But that returns
Method ‘TestMethod?param=teststring’
was not found in service Service1.
What is the url to use to pass in a param to wcf or is it not possible or do I need to do something else to make it work
I can’t answer your specific question, but do you realize that “WebMethod” is an attribute from the .Net 1.1 library. I had to go look it up in the docs because I had never seen it before. That is definitely not WCF stuff.
From the error message you are getting, you need to put the parameter in a POST body and set the content type to application/x-www-form-urlencoded. You will need a tool like fiddler to do that.
You really should look into some of the newer libraries for doing web services stuff as what you are using is REALLY old. Search on the WebGet WebInvoke attributes to find newer HTTP web service facilities in WCF.