Lesson 5: Consuming XML Web Services
This lesson is a very brief overview of Web services support in the .NET Framework. The concept of the "Microsoft WebService Behavior" is introduced here.
- "XML Web services are business logic components that can be accessed over the Internet."
The above quote is listed here for 'posterity' as the use of the term "business logic" is by now threadbare!
- "XML Web services are made public over the Web using a Universal Description, Discovery, and Integration (UDDI) registry. Currently, Microsoft and IBM manage two UDDI nodes available for locating XML Web services."
As of this writing, IBM, Microsoft, NTT Communications, and SAP jointly own the registry. For more information, see:
http://uddi.org/find.html
- "Using an XML Web service is much the same as using a .NET or COM component: you establish a reference to the class, create an instance of an object from the class, and then use the object's properties and methods within your code."
The opinion here is that this a true Microsoft innovation. Adding a Web Reference in Visual Studio .NET, automatically creates WSDL (Web Services Description Language) for SOAP calls through a proxy class. For a Microsoft-centric understanding of WDSL, see "Understanding WSDL" at:
http://msdn.microsoft.com/library/en-us/dnwebsrv/html/understandWSDL.asp
The following is a SOAP call to Amazon.com:
com.amazon.soap.AmazonSearchService ws =
new com.amazon.soap.AmazonSearchService();
com.amazon.soap.AsinRequest req =
new MCSDWebAppsCS.com.amazon.soap.AsinRequest();
com.amazon.soap.ProductInfo info =
new MCSDWebAppsCS.com.amazon.soap.ProductInfo();
req.asin = "0782113273";
req.devtag = "XXXXXXXXXXXXXX";
req.tag = "thekintespacec00A";
req.type = "lite";
info = ws.AsinSearchRequest(req);
com.amazon.soap.Details product = info.Details[0];
body.InnerHtml = String.Format("Product Name: {0}",product.ProductName);
- "In some cases it makes more sense to call an XML Web service from client-side scripts than from server code."
The Microsoft WebService Behavior is one asynchronous solition to the problem of waiting on Web services. The sample code for this lesson includes a "WebService Behavior" HTC file that has over 2000 lines of code! For more information, see "Using the WebService Behavior" at:
http://msdn.microsoft.com/workshop/author/webservice/using.asp