How can i test a wcf service in a browser? I mean if i only enter the url in the browser it should give 开发者_JS百科me only relevent xml
It depends on what type of WCF service you have:
if you're using a WCF REST service (
webHttpBinding
), then you should be able to just navigate to the service address, e.g.http://yourserver/somedir/service.svc
if you're using anything else, you have a SOAP service, and you cannot test a SOAP service in a web browser - the browser just doesn't understand and speak SOAP. There's however a WCF Test Client app in your C:\ drive somewhere which you can use for that purpose.
Make a test application for it. It can be as simple as having a UI with a bunch of buttons, when you press a button then a certain function exposed by the WCF service is called, you could maybe echo the output to a textblock in the app. You could also have a bunch of input type UI items (textboxes, dropdowns, whatever) so you can select parameters to pass to the WCF function.
If you want to be really classy, then make a set of unit tests for it - this means that you will have to have it hosted somewhere though so that it can be called any time the tests are run.
精彩评论