Testing the solution
Now our interface is complete and we are ready to test it.
The interesting thing about our solution is that it is REST compliant, so we can directly test a method by using a browser, typing the correct URL (according to what is specified in the service contract), and passing the desired parameters.
For example, to test the item's price retrieval with a JSON response, we can use the http://localhost:35798/B2BService.svc/getPriceJSON?cust=05001041&date=2016-05-30&item=01001&qty=1
URL (the port number here is the debug port that Visual Studio assigns to the local web server, in bold are the parameters):
The result is this:
To retrieve the items list (modified from a particular date, for example 01/01/2015
) you can type http://localhost:35798/B2BService.svc/getItemsJSON?date=2015-01-01
in your browser.
This is the returned JSON response:
If we want to test our methods via code (for example from a C# application), we can create a HTTP Request
method to our WCF service...