Search code examples
javaweb-serviceswcfc#-4.0wcf-binding

How to call a Windows Service WCF Web Service Method through Browser


I have a WCF Web Service that is hosted in a Windows Service. The WCF Web Service is to be used by a Java based frontend, which will make http calls and will receive a JSON response. The problem I am getting is whilst I can get the web service to run, if I type "mydomain.com/myservice/mymethod", I get bad request back.

The web service initially had mex set for service end points, and I tried the same again, but still no luck. I took mex off, but still no luck. All this was being set on the start of the windows service. The web service is only using BasicHttpBinding.

So, my question is this - "How do I can a web service method using basichttpbinding hosted in a window service through the browser in order for this to be used by a non .net client?"

Thanks


Solution

  • WCF uses SOAP as its primary native protocol for communication. If your client does not want to communicate using SOAP you can make your WCF service RESTFUL with ease. Have a look at the following:

    WCF REST Services

    Brand new services ideally should be implemented in WebAPI rather than RESTFUL WCF. Also have a look at

    REST WCF vs. WebAPI