Executing ASP.NET Web Services from Internet Explorer

The .NET Framework's ASP.NET Web services default to document/literal format; .NET doesn't support rpc/literal format directly. ZipCodeResolver is an ASP.NET Web service developed with Visual Studio .NET that includes documentation for each Web method. ASP.NET automatically generates a Web service help page when you open a file with an .asmx extension in a browser. As an example, http://webservices.eraserver.net/zipcoderesolver/zipcoderesolver.asmx displays the help page shown in Figure 31.1. Web service help pages let you determine quickly whether the service is operational and has the potential to fulfill your needs.

Figure 31.1. ASP.NET Web services created with Visual Studio .NET provide Web service help pages with a list of Web methods and optional service documentation.

graphics/31fig01.jpg

Note

The .asmx file extension identifies an ASP.NET Web service; ASP.NET Web pages use the .aspx extension.


If the Web method has simple parameters, clicking a Web method link opens a page with a test form in which you type required parameter values. ZipCodeResolver has five Web methods, each of which opens a test form. The VersionInfo method doesn't require parameters, so its test form only has an Invoke button. The other services require the parameters shown in Figure 31.2. When you click the Invoke button, an HTTP GET operation returns the SOAP body elements to IE (see Figure 31.3).

Figure 31.2. This test form for the ZipCodeResolver's CorrectedAddressXML method lets you send required parameters to a service that supports the HTTP GET protocol.

graphics/31fig02.jpg

Figure 31.3. The response message from a service port that implements HTTP GET contains the inner XML elements of the SOAP response message.

graphics/31fig03.gif

By default, ASP.NET 1.0 WSDL documents include HTTP GET and POST as well as SOAP operations (called ports). Following is the <service> node of ZipCodeResolver's WSDL document that defines the three ports:

 <service name="ZipCodeResolver">  <documentation>Given a valid street address, city,   and state, this service returns the proper ZIP code,   ZIP code+4, or  USPS corrected  address. NOTE: This   service is meant for non-commercial, personal use only.  </documentation>  <port name="ZipCodeResolverSoap"    binding="s0:ZipCodeResolverSoap">   <soap:address location="http://webservices.eraserver.net/    zipcoderesolver/zipcoderesolver.asmx" />  </port>  <port name="ZipCodeResolverHttpGet"    binding="s0:ZipCodeResolverHttpGet">   <http:address location="http://.../zipcoderesolver.asmx" />  </port>  <port name="ZipCodeResolverHttpPost"    binding="s0:ZipCodeResolverHttpPost">   <http:address location="http://... /zipcoderesolver.asmx" />  </port> </service> 

XMethods operates one of the earliest and most popular public Web services lists at http://www.xmethods.net. About a third of the listed services are ASP.NET document/literal and provide Web service help pages. For the complete list of services, click the FULL LIST link.

Note

ASP.NET Web services whose request messages include complex types don't support test forms. Developers of commercial Web services often remove the HTTP GET and POST entries from their services' WSDL files. Thus, you might find that some of the ASP.NET Web services you explore don't provide a test form.




Special Edition Using Microsoft Office Access 2003
Special Edition Using Microsoft Office Access 2003
ISBN: 0789729520
EAN: 2147483647
Year: 2005
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net