Home > Store

Creating and Consuming Web Services in Visual Basic

Register your product to gain access to bonus material or receive a coupon.

Creating and Consuming Web Services in Visual Basic

Premium Website

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2002
  • Edition: 1st
  • Premium Website
  • ISBN-10: 0-672-32156-4
  • ISBN-13: 978-0-672-32156-6

Get on the fast track of what is becoming a required skill for software developers--the ability to create Web Services and clients that consume them. Web Services leverage standards such as XML, XSD, SOAP, and WSDL to enable interoperability across programming languages and platforms. They work well to integrate applications on an intranet and on the Internet. Visual Basic .NET, coupled with the .NET Framework, is an attractive environment for Web Services architecture because it provides for rapid development and easy maintenance.

This book explains each of the standard protocols needed for Web Service interaction on the client or server. These protocols include SOAP, Web Services Description Language (WSDL), and Universal Description Discovery and Integration (UDDI).

Creating and Consuming Web Services in Visual Basic® also includes

  • Information on how to shape SOAP messages and the data they contain
  • Explanations of how to create applications that consume Web Services
  • Detailed case studies that explore how to use Web Services to help solve real-world B2B and B2C problems
  • Thorough coverage of development concerns such as security and availability
  • Instructions for how to create and consume Web services in earlier versions of VB and convert legacy applications to a Web Services platform


0672321564B06072002

Downloads

Source Code

Click to download the Source Code related to this title.

Sample Content

Online Sample Chapter

Security Issues with Web Services

Table of Contents

(NOTE: Each chapter concludes with Summary.)

Introduction.

Applications of Web Services.

What You Will Need.

Who Is This Book For?

I. THE BASICS.

1. Creating Your First Web Service.

The “Hello World” Operation.

Other Files in the Project.

Passing Complex Types.

Returning Arrays of Simple Types.

Returning Arrays of Structures.

2. Consuming Your Web Service.

Attaching a Web Reference.

Command-Line Interface Applications.

Graphical User Interface (GUI) Applications.

Web Applications.

Web Services Calling Other Web Services.

3. SOAP, WSDL, and UDDI Explained

SOAP.

SOAPAction.

Envelope.

Header.

Body.

Fault.

WSDL.

Document Parts.

Supported Message Patterns.

SOAP Extensibility Elements.

UDDI.

tModels.

Registering with UDDI.

Query Patterns.

4. Shaping the WSDL, XML, and SOAP Message.

Shaping the WSDL File.

definitions.

types.

message, portType, and binding.

service.

Using SOAP Headers.

Changing the Location of WSDL Elements.

Creating a Custom SOAP Extension.

Custom SOAP Extension Basics.

An Example SOAP Extension.

Creating a Server Based on a WSDL File.

Using Visual Studio to Register Your SOAP Endpoint in UDDI.

5. Troubleshooting Web Services/Consumers.

Viewing SOAP Message Exchanges.

Debugging a Web Service at the Server.

Debugging a Web Service Remotely.

Debugging Web Services Under Load.

Items to Include in Your Test Plan.

A Simple Example.

II. GOING DEEPER.

6. Security Issues with Web Services.

Equipment Deployment.

Authenticating Users.

Application Level Authorization.

HTTP Basic and Digest Authentication.

X509 Client Certificates.

Guarding Data.

Tracking User Activity.

7. Looking at the “Abilities”.

Availability.

Clustered Servers.

Multiple Deployment Locations.

Reporting.

Administrator Communication.

Scalability.

Stateless Web Service and Using a Web Farm.

Scalable Components.

Manageability.

Performance Monitor.

Deployment Packages.

Reporting.

Performance.

I/O Bound.

Computation Intensive.

Memory Hog.

Long-Lived Web Method Calls.

8. Asynchronous Web Services.

Synchronous Versus Asynchronous Calls.

Design Pattern for Asynchronous Method Calls.

Calling a Web Service Asynchronously.

Using the Callback Function.

Using the WaitHandle Methods.

Handling Web Pages That Make Asynchronous Calls to WebMethods.

Server to Server Asynchronous Communications.

Server Web Service.

Client Web Service.

Console Application.

WinForm Application.

9. Stateful Services.

Benefits of Maintaining State: Performance and Scalability.

Improving Performance.

Enhancing Scalability.

Facilitating Web Farms.

Maintaining State with the Session Object.

ASP.NET Session State.

In-Process Session State.

Out-of-Process Session State.

Maintaining State with the Application Object.

Maintaining State with the Cache Object.

Custom State Management.

Managing State as a Web Service.

10. Microsoft SOAP SDK.

Using the SOAP Toolkit on the Server.

Generating the WSDL and WSML files.

Common Edits to the WSDL and WSML Files.

Deploying Your SOAP Web Service.

Using the SOAP Toolkit on the Client.

Using the High-Level Interface.

Using the Low-Level Interface.

11. Converting Legacy Applications to Web Services.

Adding Web Service Support to COM+ Applications.

Reusing an Existing COM Object Within a Web Service.

Migrating from Visual Basic 6 to Visual Basic .NET.

III. SOLVING REAL-WORLD PROBLEMS.

12. Business to Business XML Web Services.

Choosing the Right Technology.

Read-Only Access to Data.

Write-Only Access to Data.

Read/Write Access to Data.

Designing the Web Service.

Building the JLD Database.

Creating the Database Class.

Creating the SecurityToken Class.

Building the Web Service.

Building Elise's Emporium.

Creating the Database.

Building the Product List Page.

Determining Product Availability.

13. Business to Customer XML Web Services.

Designing the Database.

Designing the Application.

Referencing the External Web Service.

Creating the List Window.

Adding the List Window Code.

Designing the Stock Editing Window.

14. Platform Integration.

Assembling the Tools.

Building the Web Services.

Adding the Database Class.

Creating the Products Service.

Creating the Customers Service.

Creating the Orders Service.

Building the Mobile Application.

Creating the Main Menu.

Creating the Customer Viewer.

Creating the Order Viewer.

Creating the Product Catalog.

15. Portals.

Designing the Database.

Configuring the Application.

Adding the Business Objects.

Creating the Web User Controls.

Building the Web Pages.

Creating the Login Page.

Creating the Profile Editor.

Writing the Portal Page.

Building the Log Out Page.

16. Profiting From Your Web Services.

Creating Services that Fill a Need.

Decreasing Business Costs.

Revenue Models.

Flat-Fee Access.

Volume-Based Access Fee.

Creative Use of the Advertising Model.

A Middleman Model.

Marketing the Web Service.

APPENDIXES.

Appendix A. Additional Resources.

XML General.

General .NET Information.

General Web Service Information.

SOAP/XML Protocol.

Remoting.

UDDI.

WSDL.

Transactions.

Tools.

Security.

ebXML.

Sample Web Service.

Appendix B. Installing Visual InterDev.

Installing the Client Components.

Installing the Microsoft Visual InterDev Client.

Installing the Image Composer.

Installing the Music Producer.

Appendix C. Visual InterDev Architecture Components Overview.

Development Architecture.

Testing Architecture.

Deployment Architecture.

Index. 0672321564T06072002

Preface

One of the more confusing items about Web Services regards defining exactly what and why they are. Let's begin with why they exist.

Web Services exist to make it easier to integrate applications. Existing technologies include Java RMI, CORBA, and DCOM. All of these technologies work over networked environments and allow for application integration. This application integration is possible if all the components are reachable over a LAN. However, when going out to the public Internet, these networked applications start to break down. Another problem is that none of these technologies work well for cross platform, cross language integration. Often, working with one of these technologies ties you to a particular language, operating system, or toolkit that must be uniform across the solution. In today's world, the odds of having all systems being written in the same language or using the same operating system and interconnection libraries is fairly small. Add to this a desire to connect these applications across large distances using the Internet and you will find that almost all of these technologies come up short. The necessity of addressing these shortcomings gave birth to Web Services. So, what are they?

A Web Service is a programmatic interface that is accessible via the Internet. As such, it must rely on standardized protocols. You may be aware of the various technologies surrounding Web Services. SOAP (an abbreviation that does not really mean anything anymore), Web Services Description Language (WSDL), and Universal Description Discovery and Integration (UDDI) are just a few of the technologies that are a part of Web Services. To make Internet accessibility a reality, SOAP v1.1 and v1.2 rely on existing, widely deployed technologies. The de facto minimum requirements for Web Service interaction state that the platform, whether client or server, must understand the following standards:

  • Hypertext Transfer Protocol (HTTP)
  • Transmission Control Protocol/Internet Protocol (TCP/IP)
  • eXtensible Markup Language (XML)
  • XML Schema Definition (XSD)

Due to the wide adoption of the Internet and XML, it is extremely difficult to find an operating system or programming language that does not have some support for these standards. Because the interest in Web Services is building to a fever pitch, vendors and individuals are rallying to make additional Web Service-specific tools available. While not a silver bullet for interoperability woes, talking to other languages and platforms just got a lot easier to do.

For many people, the promise of interoperability drew them into learning more about Web Services. As a Visual Basic developer, this promise may have caused you to buy this book. One question probably remains: How real is this promise of interoperability? For any two implementations to work together, they typically have to agree on two items: what the WSDL for a particular interface looks like and how to represent the SOAP message for any given operation in XML. To this end, the many serious development teams and individuals are working together to make sure they all agree.

At XMethods, http://www.xmethods.com/ilab, you can see a list of all the participants. This page also describes what it means to pass or fail the set of tests, as well as the tests themselves. If an implementation is not a part of this effort, you should steer clear of it. Yes, the Microsoft implementations are active in this process.

Applications of Web Services

Before going too far into this book, you should understand some of the reasons for using a Web Service:

  • Interface between languages where a binary interface does not exist or is inappropriate to use--For example, you may want a Perl script to be able to talk to a Visual Basic interface.
  • Interface in between systems--For example, you may want to make a business application on a mainframe accessible to boxes scattered throughout the business.
  • You need to allow a wide, unknown array of clients to access your application--This is a common requirement in larger applications assembled using "best of breed" components.
  • You are exposing the functionality as a service for a fee--In this case, instead of inventing your own protocol, use what Web Services provide to you. Examples include stock trading services and access to research databases, among other things.

When creating a Web Service, make sure that the various APIs are stateless. If you must maintain a pseudo-state, that state information should be obtainable from data passed in the SOAP messages. For example, a Web Service may require that users be validated. To do so, they log in and receive an authentication token. Other Web Service calls will require that the token appear somewhere within the SOAP message. With this, you have state (the user is "logged in") and this state is maintained over transient connections. Maintaining state this way helps with scalability and will be covered in Chapter 6, "Security Issues with Web Services."

What You Will Need

While you could run most of these examples using the free Microsoft .NET Framework SDK, you will get the greatest benefit and productivity by using Visual Studio .NET. This book assumes that the reader has Visual Studio .NET installed. This book will still be valuable to users with only the SDK, but many things will be harder to do.

You should also have a copy of the Microsoft SOAP Toolkit v2 installed on your machine. Yes, install this even if all you do is program .NET applications. The toolkit comes with an application called MSSOAPT.EXE. This application allows you to review the SOAP messages going between the SOAP endpoints.

The machine that you are developing on must have Internet Information Server (IIS) installed. Without it, you will not be able to run the examples in the book or develop Web Services on your local machine. This is only available on Windows NT 4.0, Windows 2000, and Windows XP. The good news is that all versions of these operating systems can host IIS. On the Professional versions of XP and 2000, you need to explicitly install IIS. You can do this through the Add/Remove Programs Control Panel applet. Refer to your Windows documentation for instructions. NT 4.0 Workstation can host IIS 4.0. This is available through the Windows NT 4.0 Option Pack.

Finally, it would help to have a good book on Visual Basic .NET handy. Learn Visual Basic .NET in 21 Days by Kent Sharkey and Duncan MacKenzie is one text that would work nicely. Their book serves as an overview of the language.

Who Is This Book For?

Because Web Service development with Visual Basic will attract Internet-savvy developers, Visual Basic application developers, and hobbyists, a wide range of people will be picking up this text and reading it. You do not necessarily need a lot of experience with the latest version of Visual Basic. That said, you should know that the language has changed a bit and has become more flexible. If you have not made yourself familiar with the changes, you should plan on updating your knowledge on Visual Basic .NET specifics along with this book.

You probably bought this book for one of two reasons:

  • You want to learn how to write code that uses Web Services just to keep up to date.
  • You just found out that you need to expose your application to outside applications and you need to learn this stuff as fast as possible.

With these goals in mind, this book is organized into the following parts:

  • Part I: The Basics--Part I gets you programming right away. Almost everyone should, at a minimum, skim all of Part I before proceeding through other chapters.
    Keep in mind that the examples presented in Chapters 1, "Create Your First Web Service," and 2, "Consuming Your First Web Service," are appropriate for only one reason--they teach the concepts without burying you in special techniques. You would never offer these to internal applications or external partners, but they are very useful for getting you started learning the basics of Web Services. In subsequent chapters, you will tackle practical and realistic examples.
  • Part II: Going Deeper--Part II covers some of the more advanced Web Service topics. In it, we examine securing a Web Service and tradeoffs you can make to maximize the scalability, reliability, and manageability of a Web Service. With some of the Web Services, you will have a need to maintain some kind of state in between Web Service calls. Different techniques for maintaining that state are useful depending on the circumstances. This section closes out with a look at Web Service enabling existing applications written using Visual Studio 6.0 and the Microsoft Web Services Toolkit.
  • Part III: Solving Real-World Problems--Part III examines the uses of Web Services in real world situations. Web Services can be used to enable integration between business partners and customers. Within your own business, you can use Web Services to tie your heterogeneous computing environment together. The section closes out with a look at how this investment in Web Services can help improve your business's bottom line.

Now, let's jump right in and learn how to write Web Services!

Index

Click below to download the Index file related to this title:
Index

Updates

Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership