WCF REST Service with POST

davism
davism used Ask the Experts™
on
I am attempting to resolve an issue WCF Rest Service and I am able to step through debug in one way:

I am able to step-through by calling on the URL specifying the method on the URL:

        [OperationContract]
        [WebInvoke(Method = "GET", UriTemplate = "/GetMember/{strTest}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string GetMember(string strTest);

Open in new window


But what I really needed is more like an object in the RequestBody. So, I originally had:

        [OperationContract]
        [WebInvoke(Method = "POST", UriTemplate = "/GetMember",  RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        GetTestMemberRes GetMember(GetTestMemberReq TestMemberReq);

Open in new window


I am getting this:
Results of test
And it does not even hit the breakpoint.

When I do the first operation contract I had to change the signature of the method. But when I do that and use the GET as well as update the URITemplate it works and I hit the break point but when I change it to a POST and use the object GetTestMemberReq. I get the above?

If the first one is working my config changes should be good.

I am using C#, .NET 4.0, and VS 2017.

Any information as to what I might be doing incorrectly.

Very much appreciated.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015
Commented:
Because you can't do a POST using a web browser and address bar alone--those are GETs by default. You would have to create a web page that has a form with its action attribute set to "POST". You could just use the tools I mentioned to you in your previous question.
Top Expert 2016

Commented:
Personally I use postman as referenced by käµfm³d 👽

Author

Commented:
käµfm³d 👽 and Daviod, ok gotchya on that. Makes sense because I was thinking there could to a crazy amount the address bar which had my shaking my head.

Ok relation to the tools. Would SOAPUI suffice to your knowledge? I'm not against Fiddler or Postman or anything like that it's just I am hamstrung on what is installed. Do not have the localadmin access nor have the ability to install anything.  It's the GPO. GPO's, serve a purpose, but the purpose and impact needs to be really managed well to not hinder.

That said, I do have SOAPUI installed...would that suffice I know it has the REST aspects in it. Or wouldn't event the F12 aspects of like Chrome work for this?
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

ǩa̹̼͍̓̂ͪͤͭ̓u͈̳̟͕̬ͩ͂̌͌̾̀ͪf̭̤͉̅̋͛͂̓͛̈m̩̘̱̃e͙̳͊̑̂ͦ̌ͯ̚d͋̋ͧ̑ͯ͛̉Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
I haven't done it myself, but it looks like SoapUI supports testing REST services.

I think Postman used to not be an installer, but I know it is now. You also might be able to find a portable version.

Author

Commented:
Actually, I just tried SOAPUI. Works as expected with what I am working with right now! Thanks!

Author

Commented:
Thank you both for the time and attention. Very, very much appreciated.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial