I've a WCF service which uses basic http binding. How do I invoke its operations/methods through a browser?
With the service running, right click the project that will contain the WCF client proxy and select Add > Service Reference. In the Add Service Reference Dialog, type in the URL to the service you want to call and click the Go button. The dialog will display a list of services available at the address you specify.
1.) Right-click on the 'My Service Projects' tree node in WCF Test Client, and click 'Add Service'. 3.) Invoke a method on it as you would have done a local service, then track in Fiddler and add to Postman as per the steps above.
You would need to add WebGetAttribute to your method like following sample
[OperationContract] [WebGet(UriTemplate = "/placesList/{userId}", ResponseFormat = WebMessageFormat.Xml)] List<Places> GetAllPlacesForUser(String userId) { string xml = ""; // build xml here return xml; }
Now in the browser, you could invoke the method like this
http://localhost:8085/GeoPlacesDataService/placesList/10
where 10 is the userId parameter.
Note: In order to add WebGetAttribute you have to reference System.ServiceModel.Web namespace which is found in a separate assembly
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With