ASP+ enables clients to invoke web services using standard HTTP-GET requests (like those typed into a browser address bar), where the method name is identified using the PATHINFO of the request, and the method arguments are provided using URL Encoded querystring values.
http://servername/appname/servicename.asmx/methodname?param1=value1¶m2=value2
For example, the following URL would invoke the StockLookup method of the Investor web service, passing “MSFT” as the requested stock symbol:
http://www.msn.com/Investor.asmx/StockLookup?symbol=MSFT
Note that querystring values are not matched to method arguments using ordinal positioning, but rather by matching the querystring key to the parameter name (identified from NGWS runtime reflection metadata). This enables the querystring arguments to be positioned in any arbitrary order; they do not have to be fixed by position.
In the current release, ASP+ supports passing any primitive NGWS runtime datatype as a querystring argument (String, Double, Char, Bool, Int, DateTime, etc). ASP+ also supports passing arrays of scalar datatypes. This is represented on the querystring using the standard HTML format for passing multiple parameters (multiple keys with the same name).
For example, the belowASP+ Web Service:
<%@ WebService Language=”C#” %> using System.Web.Services; public class ArrayTest : WebService { [ WebMethod ] public int [] PassArray(string name, int [] numbers) { return numbers; } }
Could be invoked with the following URI:
http://www.msn.com/ArrayTest/PassArray?numbers=45&numbers=33&numbers=67&name=MyName
This would result in an array with 3 elements (45, 33 and 67) being passed to the Web Service class along with a string with the value “MyName”.
In the Beta1 timeframe, ASP+ will return the result of any HTTP-GET operation using an XML-encoded payload format. This XML by default contains only a single element tag – whose element name indicates the NGWS runtime datatype of the service’s return argument.
For example, our previous call to the Investor service:
http://www.msn.com/Investor.asmx/StockLookup?symbol=MSFT
Would return the following XML as a response:
<?xml version=”1.0” ?> <double>74.5</double>
Array values are wrapped within an outer element identifying the array type, and inner elements defining each object type.
For example, our previous call to the ArrayTest service:
http://www.msn.com/ArrayTest/PassArray?numbers=45&numbers=33&numbers=67&name=Scott
Would return the following XML as a response:
<?xml version=”1.0” ?> <ArrayOfInt> <int>45</int> <int>33</int> <int>67</int> </ArrayOfInt>
Note that unlike HTTP-SOAP arguments (which are limited to only scalar values and arrays of scalar values), HTTP-GET supports any NGWS runtime ype as a return value (structs, DataSets, arrays of structs, etc). DataSets are a particularly interesting type to return as an argument, as they their tables/rows as structured XML (with optional Schema if specified in the dataset). This makes them ideal for data driven services.