
Pro CSharp And The .NET 2.0 Platform (2005) [eng]
.pdf
954 CHAPTER 25 ■ UNDERSTANDING XML WEB SERVICES
official UDDI website can be found at http://uddi.microsoft.com. The official website of UDDI (http://www.uddi.org) provides numerous white papers and SDKs that allow you to build internal UDDI servers.
Interacting with UDDI via Visual Studio 2005
Recall that the Add Web Reference dialog box allows you not only to obtain a list of all XML web services located on your current development machine (as well as a well-known URL) but also to submit queries to UDDI servers. Basically, you have the following options:
•Browse for a UDDI server on your company intranet.
•Browse the Microsoft-sponsored UDDI production server.
•Browse the Microsoft-sponsored UDDI test server.
Assume that you are building an application that needs to discover the current weather forecast on a per–zip code basis. Your first step would be to query a UDDI catalog with the following question:
• “Do you know of any web services that pertain to weather data?”
If it is the case that the UDDI server has a list of weather-aware web services, you are returned a list of all registered URLs that export the functionality of your query. Referencing this list, you are able to pick the specific web service you wish to communicate with and eventually obtain the WSDL document that describes the functionality of the weather-centric functionality.
As a quick example, create a brand-new console application project and activate the Add Web Reference dialog box. Next, select the Test Microsoft UDDI Directory link, which will bring you to the Microsoft UDDI test server. At this point, enter weather as a search criterion. Once the UDDI catalog has been queried, you will receive a list of all relevant XML web services. When you find an XML web service you are interested in programming against, add a reference to your current project. As you would expect, the raw WSDL will be parsed by the tool to provide you with a C# proxy.
■Note Understand that the UDDI test center is just that: a test center. Don’t be too surprised if you find a number of broken links. When you query production-level UDDI servers, URLs tend to be much more reliable, given that companies typically need to pay some sort of fee to be listed.
Summary
This chapter exposed you to the core building blocks of .NET web services. The chapter began by examining the core namespaces (and core types in these namespaces) used during web service development. As you learned, web services developed using the .NET platform require little more than applying the [WebMethod] attribute to each member you wish to expose from the XML web service type. Optionally, your types may derive from System.Web.Services.WebService to obtain access to the Application and Session properties (among other things). This chapter also examined three key related technologies: a lookup mechanism (UDDI), a description language (WSDL), and a wire protocol (GET, POST, or SOAP).
Once you have created any number of [WebMethod]-enabled members, you can interact with a web service through an intervening proxy. The wsdl.exe utility generates such a proxy, which can be used by the client like any other C# type. As an alternative to the wsdl.exe command-line tool, Visual Studio 2005 offers similar functionality via the Add Web Reference dialog box.



■I N D E X 957
form control declarations, 847 |
assemblies |
GET and POST, 837–38 |
Add Reference dialog box, 356, 359–60 |
HTML |
app.config file, 368 |
document structure, 833 |
binary code reuse, 347 |
form development, 833 |
CIL code, 351, 358 |
overview, 832 |
client application example, 359–60 |
web controls, 871 |
CLR file header, 350–51 |
HTTP |
code base config file element, 385, 387 |
overview, 829–30 |
code library, 347 |
Request members, 857 |
compared with legacy executables, 347 |
Request processing, 857–59 |
consuming shared assemblies, 376–77 |
Response members, 860 |
cross-language inheritance, 362 |
Response processing, 859–61 |
definition, 347 |
IIS virtual directories, 831 |
delayed digital signing, 375–76 |
incoming form data, 858–59 |
dependentAssembly config file element, 381–82 |
inheritance chain, page type, 855–56 |
download cache, 352 |
in-place editing example, 879–80 |
dynamic redirection to a specific version, |
Internet Information Server (IIS), |
381–82 |
description, 830 |
embedded resources, 352 |
inventory content page example, 877–78 |
example of version updating, 379–82 |
IsPostBack property in HTTP Request |
explicit load request, 366, 368 |
processing, 859 |
flow of CLR external reference resolution, 388 |
life cycle of web page, 861–63, 865 |
global assembly cache (GAC), 25, 348 |
master pages example, 872–73 |
ildasm exploration of manifest, 357 |
menu control example, 873 |
implicit load request, 366, 368 |
overview, 829 |
internal format, 349 |
page type inheritance chain, 855–56 |
language integration, 360, 362, 364–65 |
redirecting users, 861 |
manifest, 348, 351, 357 |
request/response cycle, HTTP, 829 |
manifest description, 11 |
round-trips (postbacks), 836 |
metadata description, 10 |
runat attribute, 847 |
module-level manifest, 364 |
script block, 847 |
modules, 11, 352 |
server-side event handling, 865 |
multifile, 352, 362–65 |
simple web controls, 871 |
.NET Framework Configuration utility, |
simple website example, 872–75, 877–83 |
369–70, 382 |
single file code model, 842–43 |
netmodule file extension, 352, 362–64 |
sorting and paging example, 878–79 |
overview, 10, 347 |
stateless, description, 830 |
private, 365–66, 368 |
submitting form data, 837–38 |
probing process, 366, 368 |
System.Web.UI.Control, 866–67, 869–70 |
publisher policy assemblies, 384–85 |
System.Web.UI.Page, 856 |
referencing external, 25 |
System.Web.UI.WebControls namespace, |
and resource files, 693 |
865–66 |
satellite assemblies, 352 |
System.Web.UI.WebControls.WebControl, |
self-describing, 348 |
870 |
shared assemblies, 371 |
user interface in HTML, 834–35 |
configuration, 378–79 |
using web controls, 865–66 |
and the GAC, 374 |
validating form data, 837 |
shared assembly manifest, 378 |
validation controls, 883, 885–88 |
single-file, 352 |
version 1.x benefits, 840 |
example, 354–56 |
version 2.0 benefits, 841 |
vs. multifile, 11 |
version 2.0 namespaces overview, 841 |
strong names, 348, 357, 371, 373–74 |
web application, description, 830 |
assigning using Visual Studio 2005, 374 |
web development server, 832 |
code example, 373 |
web page code model, 842–46 |
type metadata, 348, 351, 358 |
web server, description, 830 |
updating applications using shared |
WebControl base class properties, 870–71 |
assemblies, 378–79 |
website directory structure, 851 |
version number, 348 |
ASP.NET 2.0 namespaces, 842 |
Visual Studio 2005 configuration, 368 |
ASP.NET 2.0 subdirectories, 851–53 |
Win32 file header, 349 |



960 ■I N D E X
code-behind, description, ASP.NET, 842 |
mresources directive, 489 |
code-behind page model, ASP.NET, 847–49 |
vs. MSIL, 10 |
CodePage, ASP.NET <%@Page%> directive |
namespace directive, 489 |
attribute, 846 |
new keyword, 181 |
collections |
opcodes, 479, 495 |
ICollection interface, 248 |
overview, 11, 477 |
IDictionary interface, 248 |
peverify.exe tool, 487 |
IDictionaryEnumerator interface, 249 |
as programming language, 477 |
IList interface, 249 |
properties, 494–95 |
overview, 221 |
pushing and popping from the stack, 480 |
CollectionsUtil, System.Collections.Specialized, |
round-trip engineering, 481–85 |
253 |
saving CIL code using ildasm.exe, 481–83 |
colon operator, 111 |
stack-based programming, 480 |
color values, GDI+, 663 |
structures, 491 |
ColorDialog class, GDI+, 664–65 |
subsystem directive, 489 |
ColumnMapping property, ADO.NET |
token set of CIL, 478 |
DataColumn object, 796 |
type constructors, 494 |
ColumnName property, ADO.NET DataColumn |
using ILIDE#, 486 |
object, 796 |
using SharpDevelop, 486 |
Combine( ) method, |
variables, local, 498 |
System.MulticastDelegate/System |
virtual execution stack, 480 |
Delegate, 263 |
Common Language Runtime (CLR) |
ComboBox control, 716–17 |
file header in assemblies, 350–51 |
Command object, ADO.NET, 781–82 |
hosts |
Command object, ADO.NET data providers, 761 |
CLR versions, 446 |
CommandTimeout, DbCommand, ADO.NET, |
dotnetfx.exe, 444 |
782 |
multiple .NET Framework versions, 445 |
common intermediate language (CIL) |
.NET assembly activation under Windows |
advantages of learning, 477–78 |
XP, 444–45 |
assembly directive, 488 |
overview, 425 |
attributes, 479 |
requiredRuntime config specification, 446 |
benefits, 13 |
side-by-side execution, 445 |
binary opcodes, 479 |
specific CLR version specification, 446 |
C# vs. VB.NET, 11–12 |
mscoree.dll, 20 |
class directive, 489–90 |
mscorlib.dll, 21 |
code explained, 482–83 |
overview, 20 |
code labels, 483–84 |
Common Language Specification (CLS), 19–20 |
compiler flags, 485 |
Common Type System (CTS) |
compiling CIL code, 485–86 |
adornments, 18 |
compiling to specific platforms, 14 |
class types, 16 |
complete example program, 500–504 |
delegate types, 17 |
current object parameter, 499 |
enumeration types, 17 |
defining current assembly, 488 |
interface types, 17 |
directives, 478 |
intrinsic types, 18 |
enums, 491 |
overview, 15 |
externally referenced assemblies, 488 |
structure types, 16 |
field directive, 493 |
type members, 18 |
ilasm.exe compiler, 477 |
CompanyName property, Application class, |
interfaces, 490 |
609 |
iteration, 499 |
comparable objects (IComparable), 242–44 |
just-in-time (JIT) compiler, 14 |
CompareExchange( ) method, Interlocked type, |
locals directive, 498 |
multithreaded applications, 472 |
mapping C# types to CIL types, 492–93 |
CompareValidator control, ASP.NET, 884, 887 |
mapping parameters to variables, 498 |
compilation cycle, ASP.NET 2.0 |
maxstack directive, 497 |
multifile pages, 854–55 |
method parameters, 495 |
overview, 853 |
methods, 494–95 |
single-file pages, 853–54 |
mnemonics, 479 |
compilation element, Web.config, ASP.NET, 913 |
modifying CIL code, 481–85 |
CompilerOptions, ASP.NET <%@Page%> |
module directive, 488 |
directive attribute, 846 |

■I N D E X 961
compiling common intermediate language |
DefaultValue attribute, 747 |
(CIL), 485–87 |
Designer.cs file, 702–3 |
Component Object Model (COM), 5 |
Dock property, 755–56 |
concurrency, multithreaded applications, 450, |
dynamic positioning, 754 |
467–71 |
ErrorBlinkStyle properties, 730 |
conditional compile, 318–19 |
ErrorProviders, 729–31 |
configuration files, remoting, 584 |
events, 741 |
configuration inheritance, ASP.NET, 917–18 |
GroupBox, 711, 713 |
Configure( ) method, RemotingConfiguration, |
image processing, 739–41 |
580 |
InitializeComponent( ) method, 703 |
connected layer, ADO.NET, 778 |
Label, 704–5 |
Connection, DbCommand, ADO.NET, 782 |
ListBox, 715–16 |
Connection object, ADO.NET data providers, |
manually adding controls to forms, 700–701 |
761 |
MaskedTextBox, 707, 709 |
connection objects, ADO.NET, 779–80 |
mnemonic keys in Label, 704–5 |
ConnectionStringBuilder object, ADO.NET, |
MonthCalendar, 719–21 |
780–81 |
node images in TreeViews, 734, 736 |
connectionStrings element, ADO.NET |
overview, 699 |
application configuration, 774–75 |
Panel, 726–27 |
connectionStrings element, Web.config, |
properties, 741–44 |
ASP.NET, 913 |
RadioButton, 711, 713 |
ConnectionTimeout( ) method, DbConnection, |
tab order, 718 |
ADO.NET, 779 |
TabControl, 722–23 |
const keyword (constant data), 80 |
table and flow layout, 756–57 |
Constraints property, ADO.NET DataTable |
TabStop, TabIndex properties, 718 |
object, 800 |
TextBox, 705–7 |
ConstructorBuilder, System.Reflection.Emit |
ToolTip, 721–22 |
namespace, 505 |
TrackBar, 724–26 |
constructors, 70–71 |
TreeView, 731–36 |
containers for ToolStrips, Visual Studio 2005, |
UpDown, 727, 729 |
643, 645 |
UserControl Test Container, 743 |
Context property, WebService base class, 929 |
using custom controls, 744–45 |
context-agile, 441 |
WebControl, 736–37 |
context-bound, 441–42 |
Controls property, System.Web.UI.Control in |
Contraint, System.Data, ADO.NET, 764 |
ASP.NET, 867 |
contravariance, delegates, 276 |
cookies, ASP.NET, 909–10 |
control class properties, 730 |
coordinate systems, GDI+, 659–60 |
control state, state management in ASP.NET, 894 |
Copy( ) method, ADO.NET DataSet class, 795 |
ControlCollection, 702 |
CopyTo( ) method, FileInfo class, System.IO, 526 |
controls |
cordbg.exe command-line debugger, 40–41 |
adding, using Visual Studio 2005, 702–3 |
Count, ControlCollection, 702 |
animation, 743 |
Count property, ASP.NET HttpApplicationState |
ASP.NET, adding and removing, 869–70 |
members, 898 |
basic, 703–4 |
covariance, delegates, 275–76 |
Button, 709–10 |
Create( ) method |
CheckBox, 711, 713 |
DirectoryInfo class, 519, 522–23 |
CheckedListBox, 714–15 |
FileInfo class, System.IO, 526 |
ComboBox, 716–17 |
CreateDomain( ), System.AppDomain, 435, 437 |
ControlCollection, 701–2 |
CreateInstance( ), System.AppDomain, 436 |
custom, 737–43 |
CreateObjRef( ), System.MarshalByRefObject, |
appearance of, 746 |
572 |
design time attributes of, 746 |
CreateSubdirectory( ) method, DirectoryInfo |
hosts for, 744–45 |
class, 519, 522–23 |
icon, 748–49 |
CreateText( ) method, FileInfo class, System.IO, |
custom events, 741 |
526, 528–29 |
custom properties, 741–44 |
CreationTime property, FileSystemInfo class, |
DateTimePicker, 721 |
519 |
default input button, 719 |
csc.exe compiler, 33 |
DefaultEvent attribute, 748 |
@ symbol (response files), 39 |
DefaultProperty attribute, 748 |
command-line flags, 36 |


■I N D E X 963
DefaultValue property, ADO.NET DataColumn |
Directory type, System.IO, 523–24 |
object, 796 |
DirectoryInfo class |
DefaultValueAttribute, |
Create( ), CreateSubdirectory( ) methods, |
System.ComponentModel, 746 |
519, 522–23 |
DefaultWsdlHelpGenerator.aspx, 925–26 |
Delete( ) method, 519 |
DefineEnum( ) method, ModuleBuilder type, |
GetDirectories( ) method, 519 |
510 |
GetFiles( ) method, 520–22 |
DefineResource( ) method, ModuleBuilder type, |
MoveTo( ) method, 520 |
510 |
Parent property, 520 |
DefineType( ) method, ModuleBuilder type, 510 |
Root property, 520 |
delayed digital signing of assemblies, 375–76 |
DirectoryName, FileInfo class, System.IO, 526 |
delegates |
dirty windows, Paint event, GDI+, 656 |
asynchronous call, 260–61 |
DISCO web service UDDI directory, 921 |
CIL code for simple example, 264 |
disconnected layer, ADO.NET, 793 |
compared with C-style callbacks, 259 |
DispatchMessage( ) method, remoting |
complex example, 270–71 |
ChannelServices, 579 |
contravariance, 276 |
disposable objects |
covariance, 275–76 |
code example, 191 |
delegate keyword, 259 |
Dispose( ) method, 191 |
description, 259 |
IDisposable interface, 191–93 |
example, 266–68 |
disposing Graphics objects, GDI+, 658–59 |
information in, 259 |
dll, 485 |
multicast, 262, 268–70 |
DLL hell, 5 |
and multithreaded applications, 451, 453 |
DllImport attribute, 409 |
NullReferenceException, 267–68 |
/doc compiler flag, 177 |
overview, 255 |
Dock property, controls, 755–56 |
as parameters, 271–73, 275 |
DockStyles enumeration values, 755 |
simple example, 263–64 |
Document Object Model (DOM), ASP.NET, 836 |
synchronous call, 260 |
documentation of source code, with XML, |
type safe, 264–65 |
175–77 |
types, 17 |
DoEvents( ) method, Application class, 609 |
delegation, description, 160 |
DomainUnload event, System.AppDomain, |
Delete( ) method |
436, 439–40 |
ADO.NET DataRow object, 799 |
DomainUpDown, 728 |
DirectoryInfo class, 519 |
dot operator and references, 180 |
FileInfo class, System.IO, 526 |
dotnetfx.exe, .NET runtime deployment, 29 |
DeleteCommand property in updating, |
download cache, 352 |
ADO.NET, 815 |
DriveInfo class, System.IO, 517, 524–25 |
deleting |
dynamic assemblies |
records, ADO.NET, 787 |
code DOM provider, 513 |
rows, ADO.NET, 806–7 |
ConstructionBuilder example, 511–12 |
deployment, .NET runtime, 29 |
definition, 505 |
derived class, description, 146 |
emitting a method, 512 |
DescriptionAttribute, |
emitting type and member variables |
System.ComponentModel, 746 |
examples, 510 |
Designer.cs file, 702–3 |
overview, 477 |
detailed content page example, ASP.NET, |
vs. static assemblies, 504–5 |
881–83 |
using dynamically generated assembly, |
developing software, 3–5 |
512–13 |
device coordinates, GDI+ coordinate systems, |
dynamic loading, 402–3 |
659–60 |
dynamic positioning, controls, 754–55 |
dialog boxes, custom, 750–52 |
dynamic web service discovery using DISCO, |
differences, classes, objects, references, 179 |
921 |
digital signatures, and strong names, 371, 373 |
■E |
Direction property, ADO.NET DbParameter, 789 |
|
directives, compiler, 478 |
ECMA standardization, .NET Framework, 29 |
Directory |
edit processing members, ADO.NET DataRow |
DirectoryInfo types, input/output, |
object, 799 |
System.IO, 517–19 |
Eiffel .NET programming language, 8 |
FileInfo class, System.IO, 526 |
|