Encoding/Decoding Web Service: Web Service Provider - Local Testing
(Page 4 of 4 )
It is very easy to test whether the service is working. Right click the Service1.asmx file in the project explorer and pick up View in Browser. What will be displayed is shown in the next picture. There are three hyperlinks in this screen. The enc and denc are the web methods you created.

The Service Description will take you to the details of what the service is doing (the "under the hood" stuff). Let's take a quick look at that in the next screen by clicking on the hyperlink, which will take you to the following URL: http://localhost/Hencode/Service1.asmx?WSDL. This is the protocol that was described in the introduction. It describes the service provided, using the other protocols. The result is shown in a compressed format (most nodes collapsed), but it has the message transport that uses the SOAP protocol with all the required definitions of namespaces, schemas, messages, ports, and so on. The tutorial format is too limited to discuss all the details but you will find articles, books and volumes of materials on this subject on the Internet.

Now let's take a look at the testing, which is our primary, limited interest. Click on the hyperlink enc. The following screen will be displayed:

This screen shows the two protocols involved for the success of this service, the Soap Protocol -- a lightweight protocol -- and the HTTP request/response Protocol(which this screen shot has not captured completely because of length). To test the service, insert a string such as 'Hodentek' into the textbox with the title strEncode and click the Invoke button. This uses the HTTP protocol and you will see the following displayed in the browser. You may notice that Hodentek has been encoded as SG9kZW50ZWs=. Similarly if you now paste the above encoded value in the textbox for the other link, denc you will notice that the string 'Hodentek' shown in the picture after the next is displayed in the browser.


This is proof positive that the web service is working correctly.
Summary
After a very brief introduction to web services, the tasks the service accomplishes were described. This service can be used to Base64 encode strings. A step by step method of creating the service and testing the service in the VS2003 IDE was also described. In part 2, creating a web consumer will be described. As described this service is hosted on the local web server. While VS2003 IDE and .NET Framework were used, these are not essential for creating a web service. In fact, language neutrality is one of the main attributes of web services.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |