1 2 XML Web Services Professional Projects..................................................................11 Introduction......................................................................................................................13 How to Use this Book................................................................................................14 Chapter 1: Basics of XML.............................................................................................15 Overview......................................................................................................................15 Origin of Markup Languages....................................................................................15 SGML.......................................................................................................................15 HTML........................................................................................................................16 XML..........................................................................................................................17 Overview of DTD....................................................................................................21 Components of an XML Document.....................................................................23 Creating a Simple XML Document..........................................................................28 XML Namespaces......................................................................................................31 Declaring XML Namespaces................................................................................33 Using XML Namespaces.......................................................................................33 XML Schemas............................................................................................................34 Defining XML Schemas.........................................................................................34 Validating XML Documents..................................................................................34 Comparing DTDs with XML Schemas................................................................35 Summary.....................................................................................................................35 Chapter 2: Basics of Web Services.............................................................................36 Highlights.....................................................................................................................36 Overview of Web Services........................................................................................37 Defining Web Services..........................................................................................37 Accessing Web Services.......................................................................................37 Web Service Architecture.........................................................................................38 Layers of a Web Service.......................................................................................38 Working of a Web Service....................................................................................39 The Web Services Model......................................................................................40 Components of a Web Service................................................................................43 XML..........................................................................................................................44 XSD..........................................................................................................................44 SOAP.......................................................................................................................50 WSDL.......................................................................................................................50 UDDI.........................................................................................................................50 Summary.....................................................................................................................51 Chapter 3: Introduction to SOAP.................................................................................51 Defining SOAP............................................................................................................51 Architecture of SOAP................................................................................................53 The SOAP Message..............................................................................................54 The SOAP RPC......................................................................................................61 The SOAP Encoding Rules..................................................................................62 Processing of SOAP Messages...............................................................................64 The SOAP Message Exchange Model...............................................................64 Summary.....................................................................................................................65 3 Chapter 4: Introduction to UDDI..................................................................................65 Overview......................................................................................................................65 Defining UDDI.............................................................................................................66 Working with the UDDI Business Directories........................................................67 Registering a Web Service with the UDDI Business Directories....................67 Finding Information in the UDDI Business Directories.....................................68 The UDDI SDK.......................................................................................................68 UDDI Specifications...................................................................................................69 The UDDI Replication Document........................................................................70 The UDDI Operators Document..........................................................................71 The UDDI Programmer's API Document............................................................71 The UDDI Data Structures Document................................................................71 UDDI Scenarios..........................................................................................................73 Summary.....................................................................................................................74 Chapter 5: Introduction to WSDL.................................................................................74 Highlights.....................................................................................................................74 Overview of WSDL.....................................................................................................74 A Sample WSDL Document.................................................................................75 Summary.....................................................................................................................90 Part IV: Professional Project 1—Creating the Product Details Web Service.......91 Chapter List.................................................................................................................91 Project 1 Overview.................................................................................................91 Chapter 6: Creating a Web Service using the Microsoft SOAP Toolkit.................91 Overview......................................................................................................................91 Product Details Web Service....................................................................................91 Project Life Cycle.......................................................................................................92 Microsoft SOAP Toolkit 2.0.......................................................................................93 Creating a Web Service by Using the Soap Toolkit 2.0...................................95 Handling Recordsets and Other Custom Data Types in SOAP Messages 104 Testing the Web Service.....................................................................................108 Setting Up the Web Service...............................................................................110 Securing the Web Service..................................................................................113 Summary...................................................................................................................121 Part V: Professional Project 2—Creating the News Web Service using Visual Studio .NET...................................................................................................................122 Chapter List...............................................................................................................122 Project 2 Overview...............................................................................................122 Chapter 7: Building Web Applications on the .NET Platform................................122 Overview....................................................................................................................122 Introduction to ASP.NET.........................................................................................122 Features of the ASP.NET Technology..............................................................123 Architecture of ASP.NET Applications..............................................................125 Types of Web Pages...............................................................................................126 Static Web Pages.................................................................................................126 Dynamic Web Pages...........................................................................................129 Creating ASP.NET Applications in Visual Studio .NET......................................131 4 Creating a Sample ASP.NET Application........................................................131 Introduction to ADO.NET........................................................................................140 Advantages of ADO.NET....................................................................................141 Architecture of ADO.NET....................................................................................141 Creating a Sample ADO.NET Application............................................................144 Adding the Programming Logic to the DataGrid Control...............................144 Adding the Programming Logic to the Button Control....................................147 Testing the Application........................................................................................148 Summary...................................................................................................................148 Chapter 8: Creating an ASP.NET Web Service......................................................149 Case Study for NewsShop Web Service..............................................................149 Project Life Cycle.....................................................................................................149 Creating a Sample ASP.NET Web Service.........................................................151 Creating a Web Service Using Visual Studio .NET........................................151 The NewsShop Database.......................................................................................161 Creating a Web Service for NewsShop................................................................163 Customizing SOAP Faults..................................................................................165 SOAP Header.......................................................................................................166 Accessing Web Services from Client Applications.........................................169 Summary...................................................................................................................177 Part VI: Professional Project 3—Creating the Exchange Rate Web Service.....178 Chapter List...............................................................................................................178 Project 3 Overview...............................................................................................178 Chapter 9: Creating a Web Service From an Interface..........................................178 Overview....................................................................................................................178 The ABCFinances Web Service............................................................................179 Project Life Cycle.....................................................................................................179 Analyzing the Requirements..............................................................................180 Creating the Design of the Application.............................................................180 Constructing the Application...............................................................................180 Creating the WSDL Document by Using .NET SDK..........................................180 The Components of the WSDL Specification..................................................180 Creating the definitions Element...............................................................181 Creating the types and message Elements..................................................182 Creating the portTypes Element....................................................................184 Creating the binding Element.........................................................................185 Creating the service Element.........................................................................186 Creating the Web Service from the WSDL Document...................................191 Accessing Data from a Database..........................................................................200 Accessing Data by Using the SQL Server .NET Data Provider....................200 Testing the Web Service.........................................................................................204 Testing Web Services by Using the Web Service Behavior..........................210 Summary...................................................................................................................215 Part VII: Professional Project 4—Creating a Web Service for Gizmo Wrap using the ATL Server Library................................................................................................216 Chapter List...............................................................................................................216 5 Project 4 Overview...............................................................................................216 Chapter 10: Introduction to the ATL Server.............................................................216 Evolution of the ATL Server....................................................................................216 Overview of the ATL Server...................................................................................217 Advantages of the ATL Server...........................................................................217 Features of ATL Server Applications................................................................219 Architecture of ATL Server Applications...........................................................219 Default Class.........................................................................................................221 Processing of the ATL Server Applications......................................................222 Creating a Sample ATL Server Application.........................................................223 Project Settings.....................................................................................................226 Server Options......................................................................................................226 Application Options..............................................................................................227 Developer Support Options................................................................................228 Deploying ATL Server Applications.......................................................................228 Summary...................................................................................................................229 Chapter 11: Creating a Web Service using the ATL Server Library....................229 Case Study................................................................................................................229 Project Life Cycle.................................................................................................230 Advantages of Creating a Web Service by Using the ATL Server Library......232 Creating a Web Service for GW by Using the ATL Server Library...............232 Summary...................................................................................................................253 Part VIII: Professional Project 5—Creating a Knowledge Share Web Service..253 Chapter List...............................................................................................................254 Project 5 Overview...............................................................................................254 Chapter 12: Design and Creation of the Knowledge Share Web Service..........254 The Knowledge Share Web Service.....................................................................254 The Database Design for the Kshare Application...............................................255 Tables in the Kshare Database..........................................................................255 Stored Procedures in the Kshare Database....................................................258 Creating the Kshare Web Service.........................................................................259 Securing ASP.NET Web Services.........................................................................264 Securing a Web Service by Using Windows Authentication.........................264 Securing Web Services by Using a Custom Solution....................................270 Deploying the Kshare Web Service......................................................................275 Testing the Kshare Web Service...........................................................................278 Create an Application That Accesses the Kshare and Login Web Services .................................................................................................................................278 Adding Code to the Button Control....................................................................280 Summary...................................................................................................................280 Part IX: Professional Project 6—Creating a Web Service using Java Technologies.................................................................................................................280 Chapter List...............................................................................................................280 Project 6 Overview...............................................................................................281 Chapter 13: Introduction to Java XML Technologies.............................................281 Overview of Java Web Services............................................................................281 6 Web Services and the Java Platform................................................................281 Java Service Model..................................................................................................282 Features of the Java Service Model..................................................................282 Components of the Java Service Model...........................................................284 Life Cycle of Web Services in the Java Service Model..................................288 Working of the Java Service Model...................................................................289 Value Chain of the Java Service Model............................................................290 Components of Java Web Services......................................................................291 Java Servlets........................................................................................................291 Java Server Pages...............................................................................................292 JAXP.......................................................................................................................295 Java API for XML Binding...................................................................................298 Java API for XML Messaging.............................................................................299 JAX-RPC...............................................................................................................302 Java APIs for XML Registries.............................................................................305 Summary...................................................................................................................307 Chapter 14: Developing Java Web Services...........................................................307 Highlights...................................................................................................................307 Overview of JWSDP................................................................................................308 JSTL.......................................................................................................................309 JWSDP Registry Server......................................................................................310 Working with Service Registries by Using JAXR............................................312 Processing XML Documents by Using JAXP..................................................314 Tomcat Administration Tool....................................................................................317 Running the Admintool........................................................................................317 Authenticating Users to Access Web Services...............................................320 Web Application Deployment Tool........................................................................322 Creating a Sample Application by Using the Application Deployment Tool...323 Interest_calc.htm File...........................................................................................324 Interest_calc.jsp File............................................................................................325 Deploying the Interest Calculator Application..................................................326 Running the Interest Calculator Application.....................................................332 Ant Build Tool............................................................................................................333 Sample Message Web Service..............................................................................336 build.xml File.........................................................................................................337 build.properties File..............................................................................................339 Configuration File.................................................................................................340 Using the xrpcc Tool............................................................................................341 Creating the Deployment Descriptor for the Apache Tomcat Server..........344 Packaging Service in a WAR File......................................................................345 Deploying the Packaged File..............................................................................346 Testing the Deployment......................................................................................346 Creating a Client Application..................................................................................347 The Hello Web Service............................................................................................348 The HelloIF Interface.......................................................................................348 build.xml File.........................................................................................................349 7 build.properties File..............................................................................................350 Compiling the Interface.......................................................................................351 Configuration File.................................................................................................351 Packaging the Service.........................................................................................352 Developing a Java Web Service by Using Sun ONE Studio.............................352 The Currency Converter Web Service..................................................................353 Creating the Directory..........................................................................................353 Creating the Web Service...................................................................................355 Creating and Implementing the Class...............................................................357 Adding the XML Operation.................................................................................359 Adding a Reference to the Web Service..........................................................362 Compiling the Java Files.....................................................................................363 Adding a Client to the Web Service..................................................................363 Executing the Web Service.................................................................................364 Running the Web Service...................................................................................364 Summary...................................................................................................................365 Part X: Professional Project 7—Design and Creation of a Web Service using the IBM Toolkit.....................................................................................................................366 Chapter List...............................................................................................................366 Project 7 Overview...............................................................................................366 Chapter 15: Design and Creation of a Web Service using the IBM Toolkit........366 Overview....................................................................................................................366 Case Study of the Credit Card Validation Web Service.....................................366 Project Life Cycle.....................................................................................................367 The Project Execution Phase.............................................................................367 Software Required for the Web Service...............................................................368 Installing Tomcat..................................................................................................368 Installing the WSTK.............................................................................................369 Installing the Axis SOAP Toolkit........................................................................374 The Luhn Algorithm..................................................................................................376 Creating the Web Service by Using Axis..............................................................376 Deploying a Java Class as a Web Service..........................................................377 Testing the Web Service by Using a Client Application.....................................377 Creating a Web Service from a Class File...........................................................379 Testing the Web Service.....................................................................................380 Creating a Client Application by Using Axis Tools..........................................381 Creating a Web Service by Using the WSTK......................................................388 Creating the Web Service...................................................................................389 Using the Websphere Studio Application Developer..........................................395 Creating a Web Project.......................................................................................395 Importing the Java File........................................................................................399 Creating the Web Service...................................................................................403 Interoperability Between Java and .NET Web Services....................................411 Creating a Visual Basic .NET Client Application.............................................411 Adding Code to the Button Control....................................................................416 Summary...................................................................................................................416 8 Part XI: Professional Project 8—Creating the Rent-a-Car Web Service and Mobile Application........................................................................................................416 Chapter List...............................................................................................................416 Project 8 Overview...............................................................................................417 Chapter 16: Introduction to Mobile Applications......................................................417 Introducing Mobile Web Applications....................................................................417 The Microsoft Mobile Internet Toolkit................................................................418 The Transfer Protocols for Accessing Mobile Web Applications..................423 Components of a Mobile Web Application...........................................................425 The Mobile Web Forms.......................................................................................425 Mobile Web Form Controls.................................................................................426 Creating a Sample Mobile Web Application ........................................................427 Working of the Mobile Web Application............................................................429 Creating the XML File..........................................................................................429 Adding Controls to the Mobile Web Form........................................................434 Adding Controls to Form1...................................................................................435 Adding Code to the Controls..............................................................................436 Testing the Application............................................................................................440 Summary...................................................................................................................441 Chapter 17: Creating a Mobile Application that Consumes a Web Service..........441 Case Study for the Rent-a-Car Internet Services...............................................441 Project Life Cycle.....................................................................................................442 The Project Execution Phase.............................................................................442 Web Services and Mobile Applications................................................................443 Issues with Web Services...................................................................................444 Devices and the .NET Framework.....................................................................445 Creating the Web Service for Rent-a-Car............................................................447 Database of Rent-a-Car......................................................................................447 Creating the ASP.NET Web Service.................................................................449 Building the Web Service....................................................................................454 Creating the Mobile Application That Consumes the Web Service.................455 The MakeReservations Page.............................................................................457 The CancelReservation Page............................................................................462 The ModifyReservation Page.............................................................................465 The ViewReservation Page................................................................................469 Testing the Mobile Application...............................................................................472 Summary...................................................................................................................483 Part XII: Professional Project 9—Web Service Development with JDeveloper .....................................................................................................................................483 Chapter List...............................................................................................................483 Project 9 Overview...............................................................................................483 Chapter 18: Web Services Development with JDeveloper......................................484 Overview....................................................................................................................484 The Case Study........................................................................................................484 Project Life Cycle.....................................................................................................485 The Project Execution Phase.............................................................................485 9 Installing OC4J and JDeveloper........................................................................486 Oracle9i JDeveloper and Web Services...........................................................486 Oracie9i AS Web Services Architecture...........................................................486 Developing and Deploying Java Class Web Services.......................................487 Creating the Reminder Web Service ....................................................................489 The ReminderService Database........................................................................489 Creating the Java Class......................................................................................491 Creating and Deploying the Web Service........................................................499 Testing the Web Service.....................................................................................513 Creating Client Applications by Using CapeStudio.........................................521 Summary...................................................................................................................531 Part XIII: Beyond the Labs......................................................................................531 Chapter List...............................................................................................................531 Chapter 19: Creating Web Services using Perl.........................................................531 Case Study................................................................................................................532 Project Life Cycle.....................................................................................................532 The Project Execution Phase.............................................................................532 Required Software...................................................................................................533 A Brief Introduction to Perl......................................................................................533 Writing a Simple Program in Perl.......................................................................534 Operators in Perl..................................................................................................534 Programming Constructs in Perl........................................................................535 Receiving Keyboard Input...................................................................................536 Reading and Writing to Files..............................................................................536 Terminating a Program........................................................................................537 Matching a Pattern...............................................................................................537 Subroutines...........................................................................................................538 Formatting the Output of a Script......................................................................538 An Introduction to Packages..............................................................................539 Introduction to SOAP::Lite..................................................................................540 Sample Web Service...........................................................................................540 Constructing the InSys Catalog Web Service......................................................542 Summary...................................................................................................................555 Chapter 20: Integration of XML Web Services with the Office XP and SQL Server 2000 Toolkits.................................................................................................................556 Overview....................................................................................................................556 The Case Study for JB Book Sellers.....................................................................556 Integrating Web Services and SQL Server 2000................................................556 Introduction to SQLXML 3.0...............................................................................557 Accessing SQL Server Data Through the Web...............................................557 Creating the Inventory Web Service.....................................................................571 Creating the Database ........................................................................................571 Creating the Web Service for JB Book Sellers................................................571 Integrating Web Services and Office XP..............................................................572 Constructing the JB Book Seller's Application.....................................................573 Calling Web Services from an Office XP Application.....................................573 10 Summary...................................................................................................................583 Part XIV: Appendixes...............................................................................................583 Appendix List ............................................................................................................583 Appendix A: Creating COM Components by using Visual Basic 6.0....................583 Overview of the COM Component........................................................................584 Creating the COM Component..............................................................................584 The Database Design..........................................................................................584 Creating a COM Component by Using Visual Basic 6.0................................584 Summary...................................................................................................................589 Appendix B: Introduction to Visual Basic .NET........................................................589 Overview of the .NET Framework.........................................................................589 Features of the .NET Framework......................................................................589 Languages of the .NET Framework..................................................................592 Overview of VB.NET................................................................................................593 Differences Between VB.NET and VB 6.0.......................................................593 Overview of an Object-Oriented Language......................................................595 Features of an Object-Oriented Language......................................................595 Components of VB.NET..........................................................................................596 Classes in VB.NET...............................................................................................596 Namespaces.........................................................................................................598 Interfaces...............................................................................................................599 Variables................................................................................................................600 Constants...............................................................................................................603 Operators...............................................................................................................603 Arrays.....................................................................................................................604 Procedures............................................................................................................604 Creating a Sample Application in VB.NET...........................................................605 Adding Controls to the Web Form.....................................................................606 Adding Code to the Web Form..........................................................................610 Testing the Web Application...................................................................................612 Summary...................................................................................................................614 Appendix C: Introduction to Visual C# .NET.............................................................614 Overview....................................................................................................................614 Create a Web Application in C#.............................................................................615 Creating a Web Application by Using the Web Application Template.........615 Templates That C# Provides..............................................................................615 Default Code That Visual Studio .NET Creates..............................................616 Adding Controls to a Web Form........................................................................624 Changing Properties of Controls in a Web Form............................................624 Adding Code to a Web Form..............................................................................626 Testing the Web Application...................................................................................627 Appendix D: Introduction to Microsoft .NET My Services.......................................627 Overview of .NET My Services..............................................................................628 Advantages That .NET My Services Offers.....................................................628 Scenarios in Which .NET My Services Web Services Are Used..................629 The .NET My Services Architecture..................................................................630
Description: