Paul Mendoza C# blog
Thursday, January 04, 2007
  Testing web services made simple

With what we have now, this web service will actually work. You could right click the asmx file and click the “View in Browser” option and you’d get an interesting looking page with links that describe what the web service does and any functions it offers.

By default when we created the web service, the web service has a HelloWorld function that doesn’t take any parameters and just returns a string. This function is a useful way to check to make sure that you’re web service is actually working so you can view this in the browser and just make sure that it works. When the browser opens with the definition page of your web service, HelloWorld will be the first link on the page. Click the link. This will then give another page with a ton of XML and SOAP statements but near the top of the page, there should also be an “Invoke” button. The “Invoke” button will only appear if the web service is running locally. If you’re running this web service on a remote server, you won’t see the invoke button for security reasons because it probably wouldn’t be a good idea to expose this functionality to the outside world.

On the page with the invoke button, clicking the “Invoke” button will actually call the HelloWorld web service that you created and it will then return the result of it. If you have a simple web service that you’ve created, this is a great way to test it.

If you’ve added parameters to your web service that are primitives (ex. String, int…), you will be prompted to enter those in as well but since we’re using the default HelloWorld that doesn’t have any parameters, we don’t need to worry about those.






The result of the web service will be an XML return statement. You’ll notice that the return string is encapsulated in an XML node. The result of a web service is always XML but the hard part about web services is handling all the different XML return statements that can be generated. We’ll deal with that when we let a very cool tool generate all the code we’ll need for interfacing with the web services.

 
Comments: Post a Comment





<< Home
I am currently an ASP.NET, C# developer working on MangosteenNation.com, a XanGo website for helping people build their businesses. I am also pursuing a degree at CSU San Marcos in Southern California.

XanGo at Mangosteen Nation

Archives
October 2005 / November 2005 / December 2005 / January 2006 / February 2006 / March 2006 / April 2006 / May 2006 / June 2006 / July 2006 / August 2006 / September 2006 / October 2006 / November 2006 / December 2006 / January 2007 / April 2007 / May 2007 / June 2007 / August 2007 / February 2008 / August 2008 /


Powered by Blogger

Subscribe to
Posts [Atom]