• Web Services Developers Guide


  •   
  • FileName: web_services_developers_guide.pdf [read-online]
    • Abstract: W e b S e r v i c e s D e v e l o p e r ’ s G u i d e. D e v e l o p e r s u p p o r t a n ... W e b S e r v i c e s D e v e l o p e r ’ s G u i d e. W e b s e r v i c e s s t a n d a r d s. of rules for how the information is made available. A ...

Download the ebook

Web Services
Developer’s Guide
Borland ®
®
VERSION 8 JBuilder
Borland Software Corporation
100 Enterprise Way, Scotts Valley, CA 95066-3249
www.borland.com
Refer to the file deploy.html located in the redist directory of your JBuilder product for a complete list of files that
you can distribute in accordance with the JBuilder License Statement and Limited Warranty.
Borland Software Corporation may have patents and/or pending patent applications covering subject matter in this
document. Please refer to the product CD or the About dialog box for the list of applicable patents. The furnishing of
this document does not give you any license to these patents.
COPYRIGHT © 2001–2002 Borland Software Corporation. All rights reserved. All Borland brand and product names
are trademarks or registered trademarks of Borland Software Corporation in the United States and other countries.
All other marks are the property of their respective owners.
For third-party conditions and disclaimers, see the Release Notes on your JBuilder product CD.
Printed in the U.S.A.
JBE0080WW21002websvcs 1E0R1002
0203040506-9 8 7 6 5 4 3 2 1
PDF
Contents
Chapter 1 Examining the WebApp node . . . . . . . . . . . 3-5
Starting the web services server . . . . . . . . . . 3-5
Introduction 1-1 Setting build options . . . . . . . . . . . . . . . . 3-6
Documentation conventions . . . . . . . . . . . 1-3
Developer support and resources . . . . . . . . 1-5
Contacting Borland Technical Support. . . . 1-5
Chapter 4
Online resources . . . . . . . . . . . . . . . . 1-5 Monitoring SOAP messages 4-1
World Wide Web . . . . . . . . . . . . . . . . 1-6 Using the TCP Monitor. . . . . . . . . . . . . . . 4-2
Borland newsgroups . . . . . . . . . . . . . . 1-6 Creating a new TCP/IP Monitor . . . . . . . 4-3
Usenet newsgroups . . . . . . . . . . . . . . 1-6 Monitoring a service’s SOAP messages. . . . 4-4
Reporting bugs . . . . . . . . . . . . . . . . . 1-7 Using the WebLogic Web Services Home Page . 4-5
Chapter 2 Chapter 5
Introducing web services 2-1 Working with WSDL 5-1
Web services architecture . . . . . . . . . . . . . 2-2 WSDL terms . . . . . . . . . . . . . . . . . . . . . 5-2
Web services standards . . . . . . . . . . . . . . 2-3 WSDL samples . . . . . . . . . . . . . . . . . . . 5-3
Simple Object Access Protocol (SOAP) . . . 2-3
Web Services Description Chapter 6
Language (WSDL) . . . . . . . . . . . . . . 2-4 Developing EJBs as web services 6-1
Universal Description, Discovery
and Integration (UDDI) . . . . . . . . . . . 2-5 Chapter 7
Web Services Inspection Language Using the Apache Axis toolkit 7-1
(WSIL) . . . . . . . . . . . . . . . . . . . . . 2-5 Exporting a class as a web service. . . . . . . . . 7-1
Java APIs for XML-based Remote Importing a WSDL . . . . . . . . . . . . . . . . . 7-5
Procedure Call (JAX-RPC) . . . . . . . . . . 2-6 Exporting EJBs as web services . . . . . . . . . . 7-9
JBuilder and web services. . . . . . . . . . . . . 2-7 Importing services as EJB applications . . . . . 7-10
Consuming and creating web Importing services as EJB applications
services with JBuilder wizards . . . . . . . 2-8 in the Web Services Explorer . . . . . . . . 7-12
Web services samples . . . . . . . . . . . . . 2-8 Deploying web services . . . . . . . . . . . . . 7-13
Supported enterprise application servers . . 2-8 Understanding WSDD files . . . . . . . . . 7-13
deploy.wsdd . . . . . . . . . . . . . . . . . . 7-13
Chapter 3 Editing WSDD files for EJBs . . . . . . . 7-14
Configuring projects for server-config.wsdd . . . . . . . . . . . . . . 7-16
web services 3-1 Editing server-config.wsdd . . . . . . . . 7-16
Working with the Web Services
Configuration wizard . . . . . . . . . . . . . . 3-1
Chapter 8
Naming the WebApp . . . . . . . . . . . . . 3-3 Using the WebLogic toolkit 8-1
Selecting an EAR . . . . . . . . . . . . . . . . 3-3 Exporting a class as a web service. . . . . . . . . 8-2
Selecting a web services toolkit . . . . . . . . 3-3 Exporting multiple classes as
Apache Axis toolkit. . . . . . . . . . . . . 3-3 a web service . . . . . . . . . . . . . . . . . . 8-5
WebLogic toolkit . . . . . . . . . . . . . . 3-4 Importing a WSDL or an EAR as
Apache SOAP 2 toolkit . . . . . . . . . . . 3-4 a web service. . . . . . . . . . . . . . . . . . . . 8-6
Defining a runtime configuration Importing an EAR as a web service . . . . . . 8-6
for the web services server . . . . . . . . . 3-5 Importing a WSDL as a web service . . . . . 8-7
i
Testing deployed services . . . . . . . . . . . . . 8-8 Searching for services . . . . . . . . . . . . .11-12
Writing a test client. . . . . . . . . . . . . . . 8-10 Searching for tModels. . . . . . . . . . . . .11-13
Exporting EJBs as web services. . . . . . . . . . 8-11 Searching by name. . . . . . . . . . . . .11-13
Deploying web services . . . . . . . . . . . . . . 8-13 Examining UDDI query results . . . . . . . . .11-14
Understanding WLDU files . . . . . . . . . . 8-13 UDDI Detail pages . . . . . . . . . . . . . .11-14
Editing WLDU files for EJBs . . . . . . . . . 8-14 Details page . . . . . . . . . . . . . . . .11-15
Modifying the EJB deployment Business Details page . . . . . . . . . . .11-15
node properties . . . . . . . . . . . . . . 8-14 Service Details page . . . . . . . . . . . .11-15
Editing the WLDU and modifying Binding Details page . . . . . . . . . . .11-15
the element. . . . . . 8-15 TModel Instance Details page . . . . . .11-15
web-services.xml . . . . . . . . . . . . . . . . 8-15 TModel Details page . . . . . . . . . . .11-15
Manually deploying services Searching an Axis server for web services . . .11-16
with web-services.xml . . . . . . . . . . 8-16 Displaying services . . . . . . . . . . . . . .11-16
Setting service naming defaults . . . . . . . . . 8-17 Importing a WSDL and publishing
Axis web services . . . . . . . . . . . . . .11-17
Chapter 9 Accessing remote Axis servers. . . . . . . .11-18
Using the Apache SOAP 2 toolkit 9-1 Searching web services with WSIL
Exporting a class as a web service . . . . . . . . 9-2 documents . . . . . . . . . . . . . . . . . . . .11-19
Importing a WSDL. . . . . . . . . . . . . . . . . 9-2 Services node . . . . . . . . . . . . . . . . .11-19
Links node . . . . . . . . . . . . . . . . . . .11-20
Chapter 10 Executing a search with a WSIL
Modifying enterprise application document . . . . . . . . . . . . . . . . . . .11-21
Publishing web services to a UDDI registry . .11-22
server settings for web services 10-1 Registering at the UDDI site through
Borland Enterprise Server 5.0.2-5.1.x . . . . . . 10-1 a web browser . . . . . . . . . . . . . . . .11-22
WebLogic Server 7.0 (with and without SP1) . . 10-2 Creating and deploying a service . . . . . .11-22
WebSphere Application Server 4.0 AE/AES . . 10-2 Publishing businesses and services . . . . .11-23
Publishing tModels . . . . . . . . . . . . . .11-24
Chapter 11 Publishing web services from an Axis server .11-24
Browsing and publishing Creating and deploying web services
web services 11-1 hosted on an Axis server . . . . . . . . . .11-24
Web Services Explorer overview . . . . . . . . . 11-1 Displaying Axis-hosted web services . . . .11-25
UDDI overview . . . . . . . . . . . . . . . . . . 11-3 Publishing from the Axis server . . . . . . .11-25
UDDI terms and definitions. . . . . . . . . . 11-4 Monitoring UDDI messages . . . . . . . . . . .11-26
Axis overview . . . . . . . . . . . . . . . . . . . 11-5 Generating Java classes from
WSIL overview . . . . . . . . . . . . . . . . . . . 11-5 WSDL documents . . . . . . . . . . . . . . . .11-26
Adding and deleting nodes in the
Explorer’s tree . . . . . . . . . . . . . . . . . . 11-6 Chapter 12
Searching a UDDI registry . . . . . . . . . . . . 11-7 Web services tutorials 12-1
Searching for businesses . . . . . . . . . . . . 11-8 Axis web services tutorials. . . . . . . . . . . . 12-1
Searching by name . . . . . . . . . . . . . 11-8 WebLogic web services tutorials . . . . . . . . 12-2
Searching by category . . . . . . . . . . . 11-9 General web services tutorials. . . . . . . . . . 12-2
Searching by identifier . . . . . . . . . . 11-11
ii
Chapter 13 Chapter 17
Tutorial: Creating a simple Tutorial: Creating a simple
web service with Axis 13-1 web service with WebLogic 17-1
Step 1: Creating a sample JavaBean . . . . . . . 13-2 Step 1: Creating a sample JavaBean . . . . . . . 17-2
Step 2: Exporting the sample bean as Step 2: Exporting the sample bean as
a web service and configuring the a web service. . . . . . . . . . . . . . . . . . . 17-2
project for web services . . . . . . . . . . . . . 13-2 Step 3: Running the server and
Step 3: Deploying, running, and deploying the service . . . . . . . . . . . . . . 17-5
testing the web service. . . . . . . . . . . . . . 13-5 Step 4: Testing the deployed service . . . . . . 17-5
Step 5: Writing a client to test the service. . . . 17-6
Chapter 14
Tutorial: Generating a web service Chapter 18
from a WSDL document 14-1 Tutorial: Creating a web service
Step 1: Configuring the project for from an EJB application
web services . . . . . . . . . . . . . . . . . . . 14-2 with WebLogic Server 18-1
Step 2: Importing the WSDL document . . . . . 14-3 Step 1: Setting up the project. . . . . . . . . . . 18-2
Step 3: Looking at the deployment descriptors . 14-4 Step 2: Configuring the project for
Step 4: Implementing the service. . . . . . . . . 14-5 web services . . . . . . . . . . . . . . . . . . . 18-2
Step 5: Creating the Public web application . . 14-6 Step 3: Deploying the EJB as a web service . . 18-3
Step 6: Creating a JSP that invokes the Step 4: Generating client-side code
web service . . . . . . . . . . . . . . . . . . . . 14-6 from the WSDL . . . . . . . . . . . . . . . . . 18-4
Step 7: Implementing the bean . . . . . . . . . . 14-9 Step 5: Writing the client and consuming
Step 8: Invoking the web service and the service locally . . . . . . . . . . . . . . . . 18-4
monitoring SOAP messages . . . . . . . . . 14-11
Chapter 19
Chapter 15 Tutorial: Browsing UDDI
Tutorial: Creating a web service web services 19-1
from an EJB application Step 1: Browsing web services at the
with Borland Enterprise Server 15-1 XMethods site . . . . . . . . . . . . . . . . . . 19-2
Step 1: Setting up the sample project . . . . . . 15-2 Step 2: Browsing tModels . . . . . . . . . . . . 19-4
Step 2: Creating a web services server and Step 3: Finding software publishers
deploying to the application server . . . . . . 15-2 at the Microsoft UDDI site . . . . . . . . . . . 19-5
Step 3: Generating client and server code Step 4: Generating Java classes . . . . . . . . . 19-7
from the WSDL . . . . . . . . . . . . . . . . . . 15-4
Step 4: Testing the service . . . . . . . . . . . . . 15-5 Index I-1
Step 5: Writing the client and consuming
the service . . . . . . . . . . . . . . . . . . . . . 15-6
Chapter 16
Tutorial: Importing a web service
as an EJB application 16-1
Step 1: Adding a WSDL document to
the project . . . . . . . . . . . . . . . . . . . . . 16-2
Step 2: Creating an EJB application
from the WSDL . . . . . . . . . . . . . . . . . . 16-2
Step 3: Testing the EJB application . . . . . . . . 16-3
iii
Tutorials
Creating a simple web service with Axis . . . . 13-1 Creating a simple web service
Generating a web service from a with WebLogic. . . . . . . . . . . . . . . . . . 17-1
WSDL document, Axis . . . . . . . . . . . . . 14-1 Creating a web service from
Creating a web service from an EJB application with WebLogic Server . . 18-1
an EJB application, Axis . . . . . . . . . . . . . 15-1 Browsing UDDI web services . . . . . . . . . . 19-1
Importing a web service as an
EJB application, Axis. . . . . . . . . . . . . . . 16-1
iv
Chapter
1
Introduction
Chapter1
This is a feature of The Web Services Developer’s Guide explains how to use the JBuilder web
JBuilder Enterprise services features to create, browse, consume, and publish web services.
The Web Services Developer’s Guide contains the following chapters:
• Chapter 2, “Introducing web services”
Provides an overview of web services and the web services features
available in JBuilder.
• Chapter 3, “Configuring projects for web services”
Explains how to create a web services server to host a web service using
the Web Services Configuration wizard and how to run the web
services server in the JBuilder IDE.
• Chapter 4, “Monitoring SOAP messages”
Describes how to monitor SOAP messages using tools provided by the
web services toolkits.
• Chapter 5, “Working with WSDL”
Gives an overview of the Web Services Description Language (WSDL)
and how it’s used in web services.
• Chapter 6, “Developing EJBs as web services”
Provides an overview of how JBuilder develops Enterprise JavaBeans
as web services.
• Chapter 7, “Using the Apache Axis toolkit”
Describes how to use the Apache Axis toolkit to develop web services.
Support for the Apache Axis toolkit is not provided with the JBuilder
WebLogic Edition.
Introduction 1-1
Introduction
• Chapter 8, “Using the WebLogic toolkit”
Describes how to use the WebLogic toolkit to develop web services.
• Chapter 9, “Using the Apache SOAP 2 toolkit”
Describes how to use the Apache SOAP 2 toolkit to develop web
services.
• Chapter 10, “Modifying enterprise application server settings for web
services”
Describes the enterprise application servers supported by JBuilder for
web services and provides information on custom settings for various
servers.
• Chapter 11, “Browsing and publishing web services”
Describes how to use the Web Services Explorer to browse and publish
web services.
• Web services samples
Web services samples are available in the following JBuilder
directories:
• samples/webservices/axis
• samples/webservices/weblogic
• thirdparty/apache-soap/samples
• thirdparty/xml-axis/java/samples
• Axis tutorials:
Support for the Apache • Chapter 13, “Tutorial: Creating a simple web service with Axis”
Axis toolkit is not
provided with the JBuilder
Explains how to use the Export As A Web Service wizard to export a
WebLogic Edition JavaBean as a web service with the Axis toolkit, exposing selected
methods to the web service consumer.
• Chapter 14, “Tutorial: Generating a web service from a WSDL
document”
Explains how to use the Import A Web Service wizard to generate Java
classes for a web service with the Axis toolkit, then implement the
classes to provide access to AltaVista’s BabelFish translation service.
• Chapter 15, “Tutorial: Creating a web service from an EJB
application with Borland Enterprise Server”
Explains how to create a web service from an Enterprise JavaBean
application using Borland Enterprise Server.
1-2 Web Services Developer’s Guide
Introduction
• Chapter 16, “Tutorial: Importing a web service as an EJB
application”
Describes how to import a WSDL as an EJB application using the
Axis toolkit and Borland Enterprise Server.
• WebLogic tutorials:
• Chapter 17, “Tutorial: Creating a simple web service with
WebLogic”
Explains how to use the Export As A Web Service wizard to publish
a JavaBean as a web service, exposing selected methods to the web
service consumer.
• Chapter 18, “Tutorial: Creating a web service from an EJB
application with WebLogic Server”
Explains how to create a web service from an EJB application using
WebLogic Server.
• General tutorials:
• Chapter 19, “Tutorial: Browsing UDDI web services”
Explains how to use the Web Services Explorer to browse web
services and generate Java classes from a WSDL document.
Introduction 1-3
Documentation conventions
Documentation conventions
The Borland documentation for JBuilder uses the typefaces and symbols
described in the following table to indicate special text.
Table 1.1 Typeface and symbol conventions
Typeface Meaning
Monospaced type Monospaced type represents the following:
• text as it appears onscreen
• anything you must type, such as “Type Hello World in the
Title field of the Application wizard.”
• file names
• path names
• directory and folder names
• commands, such as SET PATH
• Java code
• Java data types, such as boolean, int, and long.
• Java identifiers, such as names of variables, classes, package
names, interfaces, components, properties, methods, and
events
• argument names
• field names
• Java keywords, such as void and static
Bold Bold is used for java tools, bmj (Borland Make for Java), bcj
(Borland Compiler for Java), and compiler options. For example:
javac, bmj, -classpath.
Italics Italicized words are used for new terms being defined, for book
titles, and occasionally for emphasis.
Keycaps This typeface indicates a key on your keyboard, such as “Press
Esc to exit a menu.”
[] Square brackets in text or syntax listings enclose optional items.
Do not type the brackets.
Angle brackets are used to indicate variables in directory paths,
command options, and code samples.
For example, may be used to indicate where you need
to supply a file name (including file extension), and
typically indicates that you must provide your user name.
When replacing variables in directory paths, command options,
and code samples, replace the entire variable, including the
angle brackets (< >). For example, you would replace
with the name of a file, such as employee.jds, and omit the angle
brackets.
Note: Angle brackets are used in HTML, XML, JSP, and other
tag-based files to demarcate document elements, such as and . The following convention describes
how variable strings are specified within code samples that are
already using angle brackets for delimiters.
1-4 Web Services Developer’s Guide
Documentation conventions
Table 1.1 Typeface and symbol conventions (continued)
Typeface Meaning
Italics, serif This formatting is used to indicate variable strings within code
samples that are already using angle brackets as delimiters. For
example,
... In code examples, an ellipsis (...) indicates code that has been
omitted from the example to save space and improve clarity. On
a button, an ellipsis indicates that the button links to a selection
dialog box.
JBuilder is available on multiple platforms. See the following table for a
description of platform conventions used in the documentation.
Table 1.2 Platform conventions
Item Meaning
Paths Directory paths in the documentation are indicated with a
forward slash (/).
For Windows platforms, use a backslash (\).
Home directory The location of the standard home directory varies by platform
and is indicated with a variable, .
• For UNIX and Linux, the home directory can vary. For
example, it could be /user/ or /home/
• For Windows NT, the home directory is C:\Winnt\Profiles\

• For Windows 2000 and XP, the home directory is
C:\Documents and Settings\
Screen shots Screen shots reflect the Metal Look & Feel on various
platforms.
Introduction 1-5
Developer support and resources
Developer support and resources
Borland provides a variety of support options and information resources
to help developers get the most out of their Borland products. These
options include a range of Borland Technical Support programs, as well as
free services on the Internet, where you can search our extensive
information base and connect with other users of Borland products.
Contacting Borland Technical Support
Borland offers several support programs for customers and prospective
customers. You can choose from several categories of support, ranging
from free support on installation of the Borland product to fee-based
consultant-level support and extensive assistance.
For more information about Borland’s developer support services, see our
web site at http://www.borland.com/devsupport/, call Borland Assist at (800)
523-7070, or contact our Sales Department at (831) 431-1064.
When contacting support, be prepared to provide complete information
about your environment, the version of the product you are using, and a
detailed description of the problem.
For support on third-party tools or documentation, contact the vendor of
the tool.
Online resources
You can get information from any of these online sources:
World Wide Web http://www.borland.com/
FTP ftp://ftp.borland.com/
Technical documents available by anonymous ftp.
Listserv To subscribe to electronic newsletters, use the online
form at:
http://info.borland.com/contact/listserv.html
or, for Borland’s international listserver,
http://info.borland.com/contact/intlist.html
1-6 Web Services Developer’s Guide
Developer support and resources
World Wide Web
Check www.borland.com/jbuilder regularly. This is where the Java Products
Development Team posts white papers, competitive analyses, answers to
frequently asked questions, sample applications, updated software,
updated documentation, and information about new and existing
products.
You may want to check these URLs in particular:
• http://www.borland.com/jbuilder/ (updated software and other files)
• http://www.borland.com/techpubs/jbuilder/ (updated documentation and
other files)
• http://community.borland.com/ (contains our web-based news magazine
for developers)
Borland newsgroups
You can register JBuilder and participate in many threaded discussion
groups devoted to JBuilder. The Borland newsgroups provide a means for
the global community of Borland customers to exchange tips and
techniques about Borland products and related tools and technologies.
You can find user-supported newsgroups for JBuilder and other Borland
products at http://www.borland.com/newsgroups/.
Usenet newsgroups
The following Usenet groups are devoted to Java and related
programming issues:
• news:comp.lang.java.advocacy
• news:comp.lang.java.announce
• news:comp.lang.java.beans
• news:comp.lang.java.databases
• news:comp.lang.java.gui
• news:comp.lang.java.help
• news:comp.lang.java.machine
• news:comp.lang.java.programmer
• news:comp.lang.java.security
• news:comp.lang.java.softwaretools
Note These newsgroups are maintained by users and are not official Borland
sites.
Introduction 1-7
Developer support and resources
Reporting bugs
If you find what you think may be a bug in the software, please report it in
the Support Programs page at http://www.borland.com/devsupport/namerica/.
Click the “Reporting Defects” link to bring up the Entry Form.
When you report a bug, please include all the steps needed to reproduce
the bug, including any special environmental settings you used and other
programs you were using with JBuilder. Please be specific about the
expected behavior versus what actually happened.
If you have comments (compliments, suggestions, or issues) for the
JBuilder documentation team, you may email [email protected] This is
for documentation issues only. Please note that you must address support
issues to developer support.
JBuilder is made by developers for developers. We really value your
input.
1-8 Web Services Developer’s Guide
Chapter
Introducing web services
Chapter2
2
This is a feature of A web service is a software module performing a discrete task or set of
JBuilder Enterprise tasks that can be found and invoked over a network including and
especially the World Wide Web. The developer can create a client
application that invokes a series of web services through remote
procedure calls (RPC) or a messaging service to provide some or most of
the application’s logic. A published web service describes itself so that
developers can locate the web service and evaluate its suitability for their
needs.
As an example, a company could provide a web service to their customers
to check inventory on products before they order. Another example is the
Federal Express package tracking service that customers can use to track
their shipments.
Web services use SOAP (Simple Object Access Protocol) for the XML
payload and uses a transport such as HTTP to carry the the SOAP
messages back and forth. SOAP messages are actually XML documents
that are sent between a web service and the calling application.
Web services can be written in any language and run on any platform. A
client of a web service can also be written in any language and run on any
platform. So, for example, a client written using Delphi and running on
Windows could call a web service written in Java and running on Linux.
Introducing web services 2-1
Web services architecture
Web services architecture
The web services architecture permits the development of web services
that encapsulate all levels of business functionality. In other words, a web
service can be very simple, such as one that returns the current
temperature, or it can be a complex application. The architecture also
allows multiple web services to be combined to create new functionality.
The web services architecture has three distinct roles: a provider, a
requestor, and a broker. The provider creates the web service and makes it
available to clients who want to use it. A requestor is a client application
that consumes the web service. The requested web service can also be a
client of other web services. The broker, such as a service registry,
provides a way for the provider and the requestor of a web service to
interact.
The three roles of provider, requestor, and broker interact with each other
through the operations of publish, find, and bind. A provider informs the
broker about the existence of the web service by using the broker’s publish
interface to make the service accessible to clients. The information
published describes the service and specifies where the service is located.
The requestor consults the broker to locate a published web service. With
the information it gained from the broker about the web service, the
requestor is able to bind, or invoke, the web service.
This diagram summarizes how the provider, requestor, and broker
interact with each other:
Figure 2.1 Web service roles and operations
BIND
Service Service
Provider Requestor
PUBLISH FIND
Service
Registry
2-2 Web Services Developer’s Guide
Web services standards
Web services standards
The standards on which web service development is based are evolving
technologies. The primary players are SOAP (Simple Object Access


Use: 0.4183