NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Publishing HTML Contracts

When clients access an ASMX file using a standard HTTP GET request with no method extensions or querystring parameters, ASP+ dynamically reflects over the web service class and generates an HTML page describing the service capabilities, methods exposed, and protocols supported. The HTML page also contains a number of standard browser samples that enable browser clients to invoke and test out the various web methods within the service.

For example, the call to the http://www.msn.com/Investor.asmx example for the previous page would generate an HTML page that looked like:

Note that the HTML page generated can be completely customized by a web service developer (it is just a standard ASP+ Web Form that users can modify) – so it is possible for publishers of webservices to provide their own custom logos, UI, and designs.

Publishing XML Based Service Description Language (SDL) Contracts

In addition to describing web services using HTML UI, ASP+ enables clients to obtain more formal definitions of service capabilities, wire-formats, and marshaling support. These formal contracts are defined using the XML-based Service Description Language (SDL) grammar and are ideal for proxy generation tools capable of using them to generate client code that automatically invokes and marshals data to and/or from the service.

For example, the Investor web service previously discussed would return the following SDL in response to a request for the: http://www.msn.com/Investor.asmx?SDL

<serviceDescription xmlns:s0="http://tempuri.org/main.xsd" xmlns:s1="" name="Investor"
        targetNamespace="" xmlns="urn:schemas-xmlsoap-org:sdl.2000-01-25">

http://yannc1/project1/   <soap xmlns="urn:schemas-xmlsoap-org:soap-sdl-2000-01-25">
http://yannc1/project1/      <service>
http://yannc1/project1/         <addresses>
         <address uri="http://www.msn.com/investor.asmx" />
      </addresses>
http://yannc1/project1/         <requestResponse name="StockLookup" soapMessageName="http://tempuri.org/StockLookup">
         <request ref="s0:StockLookup" />
         <response ref="s0:StockLookupResult" />
      </requestResponse>
   </service>
   </soap>

http://yannc1/project1/   <httpget xmlns="urn:schemas-xmlsoap-org:get-sdl-2000-01-25">
http://yannc1/project1/      <service>
http://yannc1/project1/         <requestResponse name=" StockLookup " href=" http://www.msn.com/investor.asmx /StockLookup">
http://yannc1/project1/            <request>
               <param name="symbol" />
            </request>
http://yannc1/project1/            <response>
               <xmlMime ref="s1:int" />
            </response>
         </requestResponse>
      </service>
   </httpget>

http://yannc1/project1/   <schema targetNamespace=
"http://tempuri.org/main.xsd" xmlns="http://www.w3.org/1999/XMLSchema">
http://yannc1/project1/      <element name="StockLookup">
http://yannc1/project1/         <complexType>
            <element name="symbol" type="string" />
         </complexType>
      </element>
http://yannc1/project1/      <element name="StockLookupResult">
http://yannc1/project1/         <complexType>
            <element name="result" type="int" />
         </complexType>
      </element>
   </schema>

</serviceDescription>

ASP+ includes a utility for generating ASP+ Client Proxies called the WebServicesUtil.exe. This utility can use any SDL description to generate a strongly typed NGWS client proxy class. For example, when executed on the above SDL contract, the utility would create a NGWS proxy class named Investor that exposed a method StockLookup. A consumer of this proxy would then be able to invoke the code in the Investor.asmx web service with the following code:

Investor myStockService = new Investor();
Double stockPrice = myStockService.StockLookup(“MSFT”);

Full more information on the proxy generation utility, see Using the WebServiceUtil.exe Utility.