new features for web service developers in beta 1 of the .net framework 2.0
elliot rapp
yasser shohoud
matt tavis
microsoft corporation
june 2004
applies to:
microsoft .net framework 2.0
microsoft visual studio 2005
summary: check out the new improvements in productivity, performance, extensibility, and standards
support in microsoft .net framework 2.0. (12 printed pages)
introduction
the .net framework 2.0 beta 1 release represents a significant milestone for the web services and xml
serialization stack in the .net framework. the enhancements in this release are centered on delivering
a mature platform that makes it even easier to develop connected systems with web services.
developers who have built web services using previous versions of the framework will be happy to find
this version delivers many of the features and enhancements they've asked for. these new features fall
into four categories:
1. productivity enhancements. there are a number of features that provide a better developer
experience when consuming web services. for example, the new event-based asynchronous
programming model provides an intuitive way for invoking web services asynchronously.
2. extensibility. many web services developers want to take full control over the web service
schema, the wire message, and the proxy types generated by wsdl.exe or add web reference.
developers will find what they're looking for in the new schema importer extensions and the
improved ixmlserializable interface.
3. performance. two new features lower client start-up time and network utilization, in addition to
other xml serialization performance improvements.
4. commitment to interoperability and standards. out-of-the-box support makes it even easier to
build web services that conform to the ws-i basic profile 1.0. in addition, version 2.0 of the .net
framework supports the w3c soap 1.2 standard.
productivity enhancements
data binding and event-based asynchronous programming
a major focus of our efforts in the .net framework 2.0 has been enhancing developer productivity. our
goal is to make .net the most productive platform for web service application development. to that end,
we have listened to your feedback and introduced a suite of three new features that we hope will provide
an immediate improvement to your productivity. these features include enabling data binding to data
returned from a web service, a new event-based asynchronous programming model, and type sharing
between services.
many developers have asked for the ability to automatically bind to data returned from web services.
version 2.0 of the .net framework enables this scenario by generating properties on client proxy types
rather than fields making auto-generated proxy types suitable for data binding by default.
the second feature concerns the use of asynchronous method calls. the new event-based asynchronous
programming model simplifies the task of invoking a web service asynchronously. in addition to using an
event paradigm instead of begininvoke/endinvoke, the new programming model also takes care of
thread synchronization automatically so that event handlers are invoked on the same thread that made
the asynchronous call. here is a code example that shows how to use the new event-based asynchronous
programming model. the searchcompleted function also shows how to bind the returned data to a ui
data grid.
private void btnsearch_click(object sender,
eventargs e)
{
//application code omitted for brevity
...
//hookup async event handler
proxy.searchcompleted +=
new searchcompletedeventhandler(this.searchcompleted);
//call the search method asynchronously
proxy.searchasync(criteria, currentsearchtoken);
btncancel.enabled = true;
}
void searchcompleted(object sender, searchcompletedeventargs args)
{
//bind returned results to the ui data grid
gridsongs.datasource = args.result;
}
private void btncancel_click(object sender, eventargs e)
{
//by clicking on the cancel button users
//can cancel the asynchronous search operation
proxy.cancelasync(currentsearchtoken);
}
type sharing
in many real-world scenarios, you may want to factor your application's functionality into individual
services that group methods that logically fit together. this typically leads to sharing one or more data
types between those web services. for example, you may have an order entry service that returns an
order object and an order status service that takes in an order object. today, a client that wants to
consume both of these services ends up with two different order classes, making it cumbersome to take
the output of the first service and pass it to the second.
version 2.0 of the .net framework introduces a feature that provides the client with one order class