Websvcs
Websvcs
Borland ®
™
P r ev i e w Web Services Kit for Java
Release 3
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 product for a complete list of files that you can
distribute in accordance with the product 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 product CD.
Printed in the U.S.A.
websvcsdg beta0602
0203040506-9 8 7 6 5 4 3 2 1
PDF
Contents
Chapter 1 Chapter 5
Introduction 1-1 Working with WSDL 5-1
Documentation conventions . . . . . . . . . . . 1-2 Working with WSDL in JBuilder . . . . . . . . . 5-2
Note to Macintosh users . . . . . . . . . . . . 1-4 Import WSDL wizard . . . . . . . . . . . . . . 5-2
Contacting Borland developer support . . . . . 1-4 Export Class As A Web Service wizard . . . . 5-3
Online resources . . . . . . . . . . . . . . . . 1-5
World Wide Web . . . . . . . . . . . . . . . . 1-5 Chapter 6
Borland newsgroups . . . . . . . . . . . . . . 1-5 The WSDD file 6-1
Usenet newsgroups . . . . . . . . . . . . . . 1-5
Reporting bugs . . . . . . . . . . . . . . . . . 1-6 Chapter 7
Developing EJBs as web services 7-1
Chapter 2 Customizing deployment . . . . . . . . . . . . . 7-4
Introducing web services 2-1 Modifying the deployment node
The architecture of web services . . . . . . . . . 2-1 properties. . . . . . . . . . . . . . . . . . . . 7-4
Web service standards . . . . . . . . . . . . . . . 2-2 Editing the WSDD file . . . . . . . . . . . . . 7-4
The Simple Object Access Protocol
(SOAP) . . . . . . . . . . . . . . . . . . . . . 2-2 Chapter 8
Web Services Description Language Browsing and publishing web
(WSDL) . . . . . . . . . . . . . . . . . . . . 2-3
Universal Description, Discovery and services 8-1
Integration (UDDI) . . . . . . . . . . . . . . 2-4 Web Services Explorer overview . . . . . . . . . 8-1
Web Services Inspection Language UDDI overview . . . . . . . . . . . . . . . . . . . 8-2
(WSIL) . . . . . . . . . . . . . . . . . . . . . 2-4 UDDI terms and definitions . . . . . . . . . . 8-3
The Borland Web Services Kit for Java . . . . . 2-4 Axis overview . . . . . . . . . . . . . . . . . . . . 8-5
WSIL overview . . . . . . . . . . . . . . . . . . . 8-5
Chapter 3 Adding and deleting nodes in the
Explorer’s tree . . . . . . . . . . . . . . . . . . . 8-5
Working with SOAP servers 3-1 Searching a UDDI registry . . . . . . . . . . . . . 8-7
Working with SOAP servers in JBuilder. . . . . 3-1
Finding a business. . . . . . . . . . . . . . . . 8-7
Working with the SOAP Server wizard . . . 3-2
Searching by name. . . . . . . . . . . . . . 8-7
Selecting a SOAP toolkit . . . . . . . . . . 3-3
Searching by category . . . . . . . . . . . . 8-9
Defining a runtime configuration
Searching by identifier . . . . . . . . . . 8-11
for the SOAP server. . . . . . . . . . . . 3-4
Finding a service . . . . . . . . . . . . . . . 8-11
Examining the WebApp node. . . . . . . . . 3-4
Finding a tModel . . . . . . . . . . . . . . . 8-12
Starting the SOAP server . . . . . . . . . . . 3-4
Searching by name. . . . . . . . . . . . . 8-12
Setting build options . . . . . . . . . . . . . . 3-5
Examining UDDI query results . . . . . . . . . 8-13
For more information . . . . . . . . . . . . . 3-5
Detail pages in the Web Services
Explorer. . . . . . . . . . . . . . . . . . . . 8-13
Chapter 4 Details page . . . . . . . . . . . . . . . . 8-14
Monitoring SOAP messages 4-1 Business Details page . . . . . . . . . . . 8-14
Creating a new TCP/IP Monitor . . . . . . . . . 4-1 Service Details page . . . . . . . . . . . . 8-14
Monitoring a service’s SOAP messages . . . . . 4-3 Binding Details page . . . . . . . . . . . 8-14
i
TModel Instance Details page . . . . . . . 8-14 Step 3: Importing the WSDL file . . . . . . . . 10-2
TModel Details page . . . . . . . . . . . . 8-14 Step 4: Implementing the service . . . . . . . . 10-4
Searching an Axis server for web services . . . 8-14 Step 5: Creating the Public web application . . 10-4
Displaying services. . . . . . . . . . . . . . . 8-15 Step 6: Creating a JSP that invokes the
Accessing remote Axis servers . . . . . . . . 8-16 web service. . . . . . . . . . . . . . . . . . . . 10-5
Searching web services with WSIL Step 7: Implementing the bean . . . . . . . . . 10-7
documents . . . . . . . . . . . . . . . . . . . . 8-17 Step 8: Invoking the web service . . . . . . . . 10-9
Services node . . . . . . . . . . . . . . . . . . 8-17
Links node . . . . . . . . . . . . . . . . . . . 8-18 Chapter 11
Executing a search . . . . . . . . . . . . . . . 8-19 Tutorial: Publishing a bean as a
Publishing web services in a UDDI registry . . 8-20
Publishing a web service . . . . . . . . . . . 8-20
web service 11-1
Step 1: Creating a new project . . . . . . . . . . 11-1
Publishing a tModel . . . . . . . . . . . . . . 8-21
Step 2: Creating a sample Java bean . . . . . . 11-2
Publishing a web service from an
Step 3: Exporting the sample bean as a
Axis server . . . . . . . . . . . . . . . . . . 8-22
web service. . . . . . . . . . . . . . . . . . . . 11-2
Monitoring UDDI messages . . . . . . . . . . . 8-23
Step 4: Creating a new SOAP server . . . . . . 11-3
Generating Java classes . . . . . . . . . . . . . . 8-23
Step 5: Running and testing the web service. . 11-4
Chapter 9 Chapter 12
Tutorial: Generating Java classes Tutorial: Using the Web Services
from a WSDL file 9-1 Explorer 12-1
Step 1: Creating a SOAP server. . . . . . . . . . 9-2
Overview . . . . . . . . . . . . . . . . . . . . . 12-1
Step 2: Generating the Java classes. . . . . . . . 9-3
About this tutorial . . . . . . . . . . . . . . . . 12-2
Step 3: Looking at the deployment descriptor . 9-5
Step 1: Browsing all web services at the
Step 4: Creating a test class . . . . . . . . . . . . 9-6
XMethods site . . . . . . . . . . . . . . . . . . 12-2
Step 2: Browsing tModels . . . . . . . . . . . . 12-5
Chapter 10 Step 3: Finding software publishers at
Tutorial: Generating a web service the Microsoft UDDI site . . . . . . . . . . . . 12-6
from a WSDL document 10-1 Step 4: Generating Java classes . . . . . . . . . 12-7
Step 1: Creating a new project . . . . . . . . . . 10-1
Step 2: Creating a new SOAP server . . . . . . . 10-2 Index I-1
ii
Chapter
1
Introduction
Chapter1
This is a feature of the The Web Services Developer’s Guide explains how to use the Borland Web
Borland Web Services Kit Services Kit for Java to create, browse, and publish web services.
for Java.
The Web Services Developer’s Guide contains the following chapters:
• Chapter 2, “Introducing web services”
Provides an overview of web services and the features of the Borland
Web Services Kit for Java.
• Chapter 3, “Working with SOAP servers”
Explains how to create a SOAP server using the SOAP Server wizard
and how to run the SOAP server in the JBuilder IDE.
• Chapter 4, “Monitoring SOAP messages”
Describes how to use the TCP Monitor to monitor the SOAP envelopes
as they’re transported between the client and the server.
• Chapter 5, “Working with WSDL”
Give an overview of WSDL and explains how to use the Import WSDL
wizard and the Export Class As A Web Service wizard.
• Chapter 6, “The WSDD file”
Discusses the deploy.wsdd file which is generated by the Import WSDL
wizard and the Export Class As A Web Service wizard.
• Chapter 7, “Developing EJBs as web services”
Describes how to publish Enterprise JavaBeans as web services.
• Chapter 8, “Browsing and publishing web services”
Describes how to use the Web Services Explorer to browse and publish
web services.
Introduction 1-1
Documentation conventions
• Tutorials:
• Chapter 9, “Tutorial: Generating Java classes from a WSDL file”
Explains how to use the Import WSDL wizard to generate the Java
classes for a simple web service from a WSDL file.
• Chapter 10, “Tutorial: Generating a web service from a WSDL
document”
Explains how to use the Import WSDL wizard to generate Java
classes for a web service, then implement the classes to provide
access to AltaVista’s BabelFish translation service.
• Chapter 11, “Tutorial: Publishing a bean as a web service”
Explains how to use the Export Class As A Web Service wizard to
publish a JavaBean as a web service, exposing selected methods to
the web service consumer.
• Chapter 12, “Tutorial: Using the Web Services Explorer”
Explains how to use the Web Services Explorer to browse and
publish web services.
For definitions of any unfamiliar Java terms, see “Java glossaries” in
Introducing JBuilder.
Documentation conventions
The Borland documentation for JBuilder uses the typefaces and symbols
described in the table below to indicate special text.
There are special considerations on the Macintosh platform. Please see
“Note to Macintosh users” on page 1-4 for more information.
Introduction 1-3
Contacting Borland developer support
Online resources
You can get information from any of these online sources:
Borland newsgroups
You can register JBuilder and participate in many threaded discussion
groups devoted to JBuilder.
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
Introduction 1-5
Contacting Borland developer support
• 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.
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) with the
JBuilder documentation, you may email jpgpubs@borland.com. 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, because it helps us to improve our product.
The SOAP specification defines the format of the XML message, but not its
content and how it is actually sent. SOAP does, however, specify how
SOAP messages are routed over HTTP.
Each SOAP document has a root <Envelope> element. Within the
“envelope” are two parts: a header and a body. The header contains
routing or context data. It can be empty. The body contains the actual
message. It too can be empty.
Here is an example of a simple SOAP message sent over HTTP that
requests the current stock price of Borland:
POST /StockQuote HTTP/1.1
Host: www.stockquoteserver.com
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn
SOAPAction: "urn:stock-quote-services"
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:GetLastTradePrice xmlns:m="Some-URI">
<symbol>BORL</symbol>
</m:GetLastTradePrice>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
For more information about SOAP, start with the SOAP documents on the
World Wide Consortium web site at http://www.w3.org/2002/ws/.
Also visit the Apache SOAP site at http://xml.apache.org/soap/.
The Borland Web Services Kit for Java can use either the Apache SOAP 2.2
or Apache Axis toolkits for its SOAP support. JBuilder can generate the
WSDL document for a web service you’ve created. It can also take an
existing WSDL for a web service and create the Java files so you can create
a client that invokes the web service. Another option is to use the
generated Java code to implement the web service yourself. It can also
quickly create a web application that hosts a SOAP server.
The Borland Web Services Kit for Java includes a Web Services Explorer
that you can use to search for web services that fit your needs, as well as
publish to a UDDI registry.
To see a sample JavaServer Page client that invokes a web service to
translate words from one language to another, open the Basic Web
Service.jpx project in the JBuilder samples/webservices/ directory.
Once the WebApp is created, the SOAP Server wizard is displayed. The
SOAP Server wizard generates the following nodes and files and adds
them to your WebApp:
• A SOAP toolkit node—the name of this node is dependent upon the
toolkit selected in the wizard—(<> brackets indicate it’s not really a
file). The Export Class As A Web Service and Import WSDL wizards
create a deploy.wsdd file which will appear under this node. For more
information on the deploy.wsdd file, see Chapter 6, “The WSDD file.”
• An EJB-SOAP toolkit node—the name of this node is dependent upon
the toolkit selected in the wizard—(<> brackets indicate it’s not really a
file). All stateless session beans in the project are autodeployed. The
deployment information is generated in one deploy.wsdd file per EJB
module. At build time the EJB classes in the deployment files are
deployed to the axis server.
• A Deployment Descriptors node—the wizard adds the appropriate
SOAP information to the web.xml file that describes the deployment
• A Root Directory node—the wizard adds contents to this node
according to the toolkit selected in the wizard
Application wizard before running the SOAP Server wizard. The SOAP
Server wizard only lets you select from existing WebApps.
On the first page of the SOAP Server wizard, you select the WebApp to
host the SOAP Server and select a SOAP toolkit.
If your project contains just a single WebApp, its name appears in the
WebApp field of the SOAP Server wizard. If more than one WebApp
exists, select the WebApp you want to host the SOAP server from the
WebApp drop-down list.
For more information about WebApps, see “Working with WebApps and
WAR files” in the Web Application Developer’s Guide.
Apache Axis
The Apache Axis toolkit is an open-source implementation of SOAP, the
next generation of Apache SOAP 2.0. Axis is a rewrite of Apache SOAP 2.0
that uses SAX instead of DOM. It’s a more modular, flexible, and a higher
performance implementation of SOAP than Apache SOAP 2.0.
See also
• Axis at http://xml.apache.org/axis/
• Apache Axis documentation in <jbuilder>/extras/xml-axis/java/docs/
index.html
Apache SOAP 2
The Apache SOAP 2 toolkit is an open-source implementation of SOAP
1.1 developed by the Apache SOAP community. This implementation of
SOAP uses DOM.
See also
• Apache SOAP at http://xml.apache.org/soap/
• Apache SOAP 2 documentation in the <jbuilder>/extras/apache-soap/
docs/index.html
toolbar and selecting your Server run configuration from the list. You can
view the server’s progress in the message pane.
If you chose to copy the Admin/console files to the WebApp node when
you created the SOAP server, you can now expand the Root Directory
node, right-click the index.html file and select Web Run from the context
menu to reach the admin UI for the Axis toolkit. The file to Web Run for
the Apache Soap 2 toolkit is admin/index.html. With the default IDE
settings, Web Run when the web server is already running will cause the
file to be accessed off the web server.
7 Click the Add button to add this new TCP/IP Monitor. A new page is
added.
8 Choose the new Port tab to monitor the messages.
9 Modify the client to send and receive its messages to the TCP Monitor
on the listen port. Change the address and port number in your code
but don’t remove the context and service target in the address. For
example, the context and service target in this address "http://
localhost:8082/soap/servlet/rpcrouter" is soap/servlet/rpcrouter and
should remain unchanged.
10 Rebuild the client to save the changes.
11 Run the application on the web server.
12 Interact with the web service and view the SOAP requests and
responses in the TCP Monitor. You can also make any necessary edits
to requests in the TCP Monitor and resend them, as well as save request
and response messages to disk.
See also
• Chapter 9, “Tutorial: Generating Java classes from a WSDL file”
• Chapter 10, “Tutorial: Generating a web service from a WSDL
document”
• Chapter 11, “Tutorial: Publishing a bean as a web service”
• Chapter 8, “Browsing and publishing web services”
Table 5.2 Files generated by the Export Class As A Web Service wizard
File name Description
<class name>PortType.java An interface for each portType in the WSDL.
You will use the implementation of this
interface to call the remote methods.
<class name>Service.java A service interface which defines a get
method for each port listed in the service
element of the WSDL. This service interface
defines a factory class to get a stub instance.
<class name>ServiceLocator.java A locator class which is the implementation of
the service interface.
<class name>ServiceTestCase.java An optional JUnit test case for testing the web
service.
Table 5.2 Files generated by the Export Class As A Web Service wizard (continued)
File name Description
<class A stub class which acts as a proxy for a remote
name>ServicePortSoapBindingStub.java web service. This allows you to call the web
service as if it were a local object. This class
implements the <class name>PortType.java
interface.
<class name>.wsdl The WSDL file which describes the web
service.
deploy.wsdd An XML file that provides deployment
information to the SOAP server.
The wizard generates a package name based on the package name of the
class with _generated appended to it.
The Export Class As A Web Service can optionally generate client stub
classes. If the Generate Client Stub option is selected on the first page of
the wizard, the wizard goes from three steps to five steps. The additional
two steps provide the same functionality as the Import WSDL wizard and
generate a client stub from a WSDL document.
The Export Class As A Web Service wizard is available on the Web
Services tab of the object gallery. You can also right-click any .java file in
the project pane and select Export Class As Web Service from the context
menu.
For a tutorial which uses the Export Class As A Web Service wizard to
publish a JavaBean as a web service, see Chapter 11, “Tutorial: Publishing
a bean as a web service.” For more information about SOAP, see
Chapter 3, “Working with SOAP servers.” For more information about the
deploy.wsdd file, see Chapter 6, “The WSDD file.”
Developing EJBs as
Chapter7
7
web services
This is a feature of the The Borland Web Services Kit is designed to assist you in building
Borland Web Services Kit enterprise class web services applications on the J2EE platform. The
for Java. solutions are standards-based and are portable across application servers.
The Borland Web Services Kit has been tested with Borland Enterprise
Server (BES) and WebLogic in particular.
The J2EE platform has evolved over the years and is currently the
platform of choice for enterprise Java development. EJB containers, which
provide a solid platform for business logic and enterprise data, in
conjunction with web containers, such as servlets and JSPs, have extended
the functionality of applications by leveraging the penetration of browsers
and HTML.
Web services extend the functionality of the J2EE platform still further in
providing cross-platform and language-independent solutions. In
addition, the J2EE platform can itself leverage web services built outside
of its domain. Web services are not confined to a browser environment
and can be embedded just as easily in other applications and in
application servers.
Typically, as is the case with web containers, coarse-grained business
methods are the right candidate and appropriate design for exposing
functionality. The Borland Web Services Kit makes this effortless by
automatically exposing the appropriate methods in the stateless session beans
in the project. You can also override this default behavior and select only the
EJB modules, beans, and methods that you want to expose as web services.
Important For configuration issues with application servers, see “Release Notes” in
the JBuilder directory before completing these steps: <jbuilder>/
webservices_release_notes.html.
Briefly, these are the steps involved in creating an EJB-based web service:
1 Use the Soap Server wizard and create the axis WebApp as you
normally would while creating a stand-alone web services application.
This creates a run configuration based on the application server for the
project. See Chapter 3, “Working with SOAP servers” for more
information on the Soap Server wizard.
2 Create one or more EJB modules and populate them with session and
entity beans. Implement them as you would with any EJB application.
You may already have coarse-grained stateless session beans. If you
don’t, you need to create one, as only stateless session beans are
exposed as web services. The stateless session beans must have at least
one valid method in the remote interface. This model parallels the
access of beans from a web container, such as Servlet/JSPs. For more
information on EJBs, see the Enterprise JavaBeans Developer’s Guide.
3 Build the project.
Note The Axis toolkit combines each deployment file (deploy.wsdd) in your
project into a server-config.wsdd. Any manual edits to the deployment
files are overwritten by the toolkit. If you edit server-config.wsdd, turn
off the SOAP build option on the Build page of Project Properties or
server-config.wsdd will be overwritten by the toolkit when you build the
project. See “Setting build options” on page 3-5 for more information.
4 Run the application server and the SOAP server using the Web Services
Server run configuration created by the JBuilder wizards.
Now that you’ve built and published your application as a web service,
you’ll build a client to use the service you just published. In the next few
steps, you’ll use the Web Services Explorer to browse all services available
on the server and to import the WSDL to build a client application.
1 Choose Tools|Web Services Explorer to open the Web Services
Explorer. See Chapter 8, “Browsing and publishing web services” for
information on the Web Services Explorer.
2 Expand the Axis node and select the Default Axis node in the tree.
3 Modify the URL field on the Details page with the WebApp context and
the server location of the web service. For example,
http://localhost:8080/axis/services or http://localhost:8080/axis/
servlet/AxisServlet, where http://localhost:8080 is the server location
and axis is the context.
4 Click the Display Services button on the Details page to display the
published EJB web services. Notice that beans are available in the list.
Note that the application server must be running before you can
display its services.
5 Pick the one of interest and click the Import WSDL toolbar button. For a
description of the files generated by the Import WSDL wizard, see
Chapter 5, “Working with WSDL.” For a tutorial, see Chapter 9,
“Tutorial: Generating Java classes from a WSDL file.”
6 Optional: Test the service as follows:
a Expand the new _generated package and notice the generated JUnit
test client, <BeanName>TestCase.
b Right-click <BeanName>TestCase in the _generated package and choose
Run Test. For a tutorial on how to run the <BeanName>TestCase file, see
“Step 5: Running and testing the web service” on page 11-4.
7 You can then publish the web service to a UDDI registry. See
“Publishing a web service from an Axis server” on page 8-22.
The previous steps complete the full cycle: building your typical EJB
application, publishing it as a web service, generating a client, and
consuming the web service.
Customizing deployment
You can customize the deployment of your web services in the following
two ways:
• Modify the deployment node properties
• Edit the WSDD file
2 Uncheck any EJB modules and/or beans that you don’t want exposed
as a web service.
See also
• “Adding and deleting nodes in the Explorer’s tree” on page 8-5
• “Web Services Explorer menus” in online help
• Chapter 5, “Working with WSDL”
• “Publishing a web service” on page 8-20
• Chapter 12, “Tutorial: Using the Web Services Explorer”
UDDI overview
The Universal Description, Discovery, and Integration (UDDI) framework
provides a mechanism for finding, describing, and registering web-based
services in a central business registry over the Internet. Through this
registry, industries can find business partners and dynamically connect to
their web services.
This XML-based framework uses Simple Object Access Protocol (SOAP)
and HTTP to discover a particular service in the registry using XML
messages to make remote procedure calls and send information to and
from the registry. XML, HTTP, and SOAP provide the added advantage of
language independent, cross-platform programming.
A UDDI registry doesn’t contain the actual specifications about how
businesses do things electronically to share their products and services.
Instead, it contains pointers or references that link to this information.
Some of these pointers may be WSDL (Web Services Description
Language) files, which describe a web service.
UDDI registries can be private, public, or even local on your own
computer. Some registries, such as the UDDI Business Registry, are
updated and replicated with the same information by several UDDI
operator sites. Other registries are public but do not replicate their data
with other sites.
The UDDI Business Registry is a universal UDDI registry that is
maintained and operated as a distributed service by several operator sites.
These operator sites, such as Microsoft and IBM, replicate data with each
other to synchronize the instances of the registry. They also have UDDI
test sites where you can test your web services thoroughly before you
publish them.
UDDI accepts and organizes three types of business information:
• Publish—white pages containing business information, such as contact
and address information.
• Find—yellow pages containing business service information, organized
by industrial categories and geographic location.
• Bind—green pages containing technical information and specifications
about services, necessary for interfacing programmatically.
See also
• “Searching a UDDI registry” on page 8-7
• “Publishing web services in a UDDI registry” on page 8-20
• The UDDI project at http://www.uddi.org
• Microsoft’s UDDI site at http://uddi.microsoft.com
• IBM’s UDDI site at https://www-3.ibm.com/services/uddi/protect/
registry.html
Axis overview
The Web Services Explorer allows you to browse network sites that run
Apache Axis-hosted web services. Searching these sites returns
information that describes the web services available in the form of a
WSDL file. JBuilder builds Axis servers with remote access disabled. To
browse services on Axis servers, remote access must first be enabled. See
“Accessing remote Axis servers” on page 8-16.
See also
• “Searching an Axis server for web services” on page 8-14
• “Publishing a web service from an Axis server” on page 8-22
WSIL overview
The Web Services Inspection Language (WSIL), like UDDI, provides a
method of service discovery for web services. Unlike UDDI, WSIL uses a
decentralized, distributed model, rather than a centralized model. WSIL
documents, which are essentially pointers to lists of services, allow
consumers of web services to browse available services on web sites
unlisted in the UDDI registries. The WSIL specification provides
standards for using XML-formatted documents to inspect a site for
services and a set of rules for how the information is made available. A
WSIL document gathers multiple references to pre-existing service
description documents in one document. The WSIL document is then
hosted by the provider of the service, so consumers can find out about
available services.
See also
• “Searching web services with WSIL documents” on page 8-17
Microsoft, IBM, and UDDI test sites. The WSIL Documents node also
contains a Default node. You can add nodes to the existing nodes and
delete nodes in the Explorer’s tree.
The contents of these three nodes in the Explorer are read from XML files
delivered in the JBuilder defaults directory. Once you make a change to a
node, the changes are saved to your <home>/<.jbuilder> directory. The file
names are as follows:
• Axis Servers node: AxisServers.xml
• UDDI Sites node: UDDIOps.xml
• WSIL Documents node: WSILDocs.xml
To add a new node to the Axis Servers, UDDI Sites, and WSIL Documents
nodes,
1 Choose the node in the tree view. A page displays on the right: Axis
Servers page, UDDI Sites page, or WSIL Documents page.
2 Create a new node using one of the following methods:
• Click the New button on the page to the right.
• Choose File|New.
• Right-click the node and choose New.
3 Enter any name you like for the new node in the Input dialog box and
click OK.
4 Select the new node in the tree to display the detail information on the
right.
5 Enter the appropriate information, such as Publish and Inquiry URL for
UDDI sites or location URL for an Axis server or WSIL document.
6 Choose the Save button.
Finding a business
You might want to find a particular business that you like to work with
and see what types of services they offer. Or you may want to find
businesses in a particular industry, such as software publishing. There are
several ways to search for a business using the Web Services Explorer:
• Search by business name
• Search by business category
• Search by business identifier
• Search by tModel
Searching by name
To search for a specific business by name in the Web Services Explorer,
complete the following steps:
1 Choose Tools|Web Services Explorer to open the Explorer.
2 Expand the UDDI Sites node in the tree on the left and double-click a
UDDI operator site node to expand it.
3 Select the Business List node to display the Query For Business page on
the right.
4 Enter the business name or the first few letters of the business name in
the Find By Name field on the Name tab. If you leave this field blank,
all the businesses at the site are found.
Note The Web Services Explorer supports the % symbol as a wildcard.
5 Execute the query with any of these methods:
• Choose Query|Execute.
• Click the Execute button on the toolbar.
• Click the Execute button on Query For Business page to the right of
the tree.
• Press Enter in the Find By Name field after entering the search name.
6 Expand the Business List node to see the query results and drill down
to find out more about a business and its services.
Searching by category
Another method of searching for a business is to search by business
category. There are several business classifications you can search by:
• ntis-gov:naics:1997 (North American Industry Classification System)
• unspsc-org:unspsc:3-1 (United Nations Standard Products and Services
Code System)
• unspsc-org:unspsc (Universal Standard Products and Services
Classification)
• uddi-org:iso-ch:3166-1999 (codes for geographic location)
• ntis-gov:sic:1987 (Standard Industrial Classification)
• uddi-org:types
• uddi-org:misc-taxonomy
Note Other classification systems can also be used. If a scheme is not available
in the drop-down list, you can paste the key for the scheme into the
tModelKey field. You can also add and remove search criteria using the
Add and Remove buttons.
Each of these business classification systems has its own codes for the
various categories. Large businesses that do a wide variety of business
may be classified in several of these systems and under several
classifications in each system. For example, a company might sell
computer hardware and software. In NAICS, this business might be listed
with several classifications, such as computer training, data processing
services, and software publishers. This same business could also be
classified in UNSPSC as computer programmed instructions, database
software, and mainframe computers.
These business classifications are listed in the KeyName drop-down list
on the Category page of the Web Services Explorer. For further
classification, a KeyValue is used to give a more specific description of the
business. Each business classification also has a corresponding
tModelKey.
Searching by identifier
Another method of searching for a business is to search by business
identifier. There are several built-in identifier schemes you can search by:
• Thomasregister-com:supplierID
• Dnb-com:D-U-N-S (Dun & Bradstreet Number Identifier System)
These IDs are listed in the KeyName drop-down list on the Identifier page
of the Web Services Explorer. Each of these classifications has a
corresponding tModelKey.
To search by business identifier,
1 Choose Tools|Web Services Explorer to open the Explorer.
2 Expand the UDDI Sites node in the tree.
3 Expand a UDDI operator site node and select the Business List node to
display the Query For Business page on the right.
4 Choose the Identifier tab on the Query For Business page.
5 Choose one of these business identifiers from the KeyName drop-down
list:
• Thomasregister-com:supplierID
• Dnb-com:D-U-N-S
6 Enter an appropriate code for the selected business identifier in the
KeyValue column.
For example, if you want to search for a business with a D-U-N-S ID of
00-136-8083 at a UDDI site, you would choose Dnb-com:D-U-N-S from the
KeyName drop-down list, and enter the ID number in the KeyValue
field: 00-136-8083. This is IBM’s D-U-N-S ID.
7 Press Enter to commit the KeyValue.
8 Click the Execute button to execute the query.
9 Expand the Business List node to see the business registered with the
selected ID.
Finding a service
Querying by service can only be done within a particular business. You
must first search for a business name and select the business node in the
tree on the left before querying for a service.
Finding a tModel
You can also search for tModels in the Web Services Explorer. TModels
represent a technical specification for a web service. When searching for
tModels you can search by tModel name, category, and identifier.
Searching by name
To search for tModels by name,
1 Choose Tools|Web Services Explorer to open the Explorer.
2 Expand the UDDI Sites node in the tree on the left and double-click a
UDDI operator site node to expand it.
3 Choose the tModel List node in the tree to display the Query For
tModel page on the right.
4 Enter the tModel name in the Find By Name field.
For example, if you wanted to find all tModels beginning with the
uddi-org name, you would enter uddi-org.
5 Click the Execute button to execute the query.
6 Expand the tModel List node to see the results of the query.
Details page only. Some of the details on these pages are required while
others are optional, so some fields may be blank.
Details page
The Details page displays when a UDDI operator site node is selected.
This page displays operator site information, such as name, inquire URL,
and publish URL.
page 8-16. In addition, you can publish an Axis web service to a UDDI
registry. See “Publishing a web service from an Axis server” on page 8-22.
You can also create Axis web services locally and browse them as follows:
1 Create a web service as described in Chapter 11, “Tutorial: Publishing a
bean as a web service.”
2 Right-click the WebApp index.html file in the project pane and choose
Web Run to run the web server.
3 Choose Tools|Web Services Explorer to open the Explorer.
4 Display the web service as described in “Displaying services” on
page 8-15.
Displaying services
When web services are deployed to an Axis server, you can browse those
services in the Web Services Explorer.
To display available services on an Axis server,
1 Expand the Axis Servers node and create a new Axis node for the
server you want to browse.
2 Choose the new Axis node and enter the URL for the server in the URL
field, including the web context of the service. For example, http://
localhost:8080/MyWebContext/servlet/AxisServlet.
3 Click the Display Services button on the Details page.
4 Expand the node to view the available services.
You can also publish Axis web services to a UDDI site in the Web Services
Explorer. See “Publishing a web service from an Axis server” on page 8-22
Note Remote access must be enabled on remote Axis servers in order to browse
their services. See “Accessing remote Axis servers” on page 8-16.
Services node
The Services node displays the <service> elements in the WSIL document.
The <service> element specifies the WSDL file for the service or it can refer
to a UDDI entry that specifies the WSDL. Expand the Services node to
display the available services on the site. Expand a web service and select
the Description node beneath it to display the Details page. This page
provides such information as the location of the WSDL document,
whether the service is an endpoint, and binding information.
If the reference is to a UDDI entry, you can search for services by two
methods:
• Service key and Location URI
• Service key and Discovery URL
Choose an option and click the Fetch button to get the information. The
search results are displayed in a temporary node, WSIL Reference
Temporary, in the UDDI tree.
Links node
If any <link> elements are contained in the WSIL document, they display
as nodes under the Links node. Links can be addresses to another WSIL
document or to a UDDI business entry. Expand the Links node to see the
<link> elements in the WSIL document and select a link to display the
Details page.
If the link is a reference to a UDDI business entry, the Details page
displays UDDI information you can fetch from the UDDI registry. The
search results are displayed in a WSIL Reference Temporary node under
the UDDI node.
If the link refers to another WSIL document, you can click the Execute
button on the Details page to display the list of services in the WSIL.
Executing a search
To search for available services at a web site,
1 Select the WSIL Documents node in the Explorer.
2 Click the New WSIL Location on the WSIL Documents page on the
right to create a new WSIL node.
Tip You can also right-click the node and choose New or choose File|New.
3 Enter a name for the node and click OK.
4 Enter the web site URL that you want to search. For example,
http://www.xmethods.net/inspection.wsil
5 Click Save to save the changes.
6 Expand the new node to see the available Services and Links nodes.
7 Do one of the following:
• Expand the Services node and choose a Description node under one
of the services to see the location of the WSDL document. You can
then use the Import WSDL wizard to import it and generate Java
classes to consume the service.
• Expand the Links node and choose a link to see what’s available on
the Details page.
If there’s a reference to a UDDI business entry, choose Fetch to
obtain the information. The results are displayed in a WSIL
Reference Temporary node under the UDDI node.
If the reference is to another WSIL document, you can also browse
those services and links. Choose the link with the WSIL reference
and click the Execute button on the Details page. Expand the link
node to display the services listed in the WSIL.
right-click the service node and choose New to create the binding node,
and so on.
8 Choose the UDDI operator node, the Business List node, or the
business node and choose File|Save Changes. This saves all the
changes and posts them to the UDDI site. You can also right-click a
node and choose Save Changes or use the toolbar button. If the UDDI
site requires a login, you’ll be prompted for a user name and password.
Note The changes that are saved are dependent upon the node selected. You
can choose a child of a node and only save changes to that node and
nodes beneath it. You can also select the UDDI operator node or the
Business List node and save all the changes.
Publishing a tModel
To add and publish a new tModel,
1 Complete steps 1 and 2 in “Publishing a web service” on page 8-20.
2 Right-click the tModel List node in the tree and choose New tModel. A
new tModel node is added to the tree.
3 Select the New tModel node and enter the appropriate information on
the tModel Details page on the right side. If the UDDI site requires a
login, you’ll be prompted for a user name and password.
4 Select the tModel node and choose File|Save Changes to save the new
tModel and post it to the UDDI site.
10 Click OK in the Publish Axis Service To UDDI dialog box to close it.
11 Log into the UDDI registry if it requires it. A dialog box appears
indicating that the service is published and the new nodes are created
for that service below the business node set as the publishing default.
example, if the tModel Details node is selected in the tree and a WSDL
document is in the Overview Document URL field, the Import WSDL
button is activated for you to select. The WSDL file name is automatically
entered in the wizard’s WSDL URL field.
See also
• Chapter 5, “Working with WSDL”
• Chapter 9, “Tutorial: Generating Java classes from a WSDL file”
11 Click Finish to close the wizard. If you expand the Root directory of the
axis node in the project pane and open index.html, you’ll see the admin/
console copied over from the toolkit.
Web Services page of the object gallery (File|New). The Import WSDL
wizard looks like this:
4 Accept the defaults in the wizard and click Finish. A package node
called org.soapinterop displays in the project pane. This package name
is based on the target namespace, http://soapinterop.org/. To see
where the package name came from, double-click InteropTest.wsdl in
the project pane to open it in the editor. Look for targetNamespace in the
structure pane and select it to highlight it in the editor:
targetNamespace="http://soapinterop.org/". This is what the wizard used
for the package name.
5 Open the package node to see the generated Java classes:
• InteropService.java—an abstract interface which defines a factory
class to get a stub instance.
• InteropServiceLocator.java—the implementation of the abstract
interface.
• InteropServiceTestCase.java—the JUnit test case for the service. For
more information about JUnit test cases, see “Unit Testing” in
Building Applications with JBuilder.
• InteropTestPortType.java—the service interface for each portType.
• InteropTestSoapBindingImpl.java—an implementation class for the
portType interface.
Element Description
service name The name of the published service, in this case
InteropPort.
parameter name="className" The name of the provider skeleton class that
encapsulates an implementation for the server.
The class generated by the wizard is called
org.soapinterop.InteropTestSoapBindingSkeleton.
parameter name ="allowedMethods" The published method(s).
import org.soapinterop.*;
import java.net.*;
4 Accept all the defaults and click Finish. The following files are
generated in the net.xmethods.www package:
• BabelFishBindingImpl.java is the service implementation. You write
your code in this class. This class implements BabelFishPortType.java.
• BabelFishBindingSkeleton.java is the server-side implementation of
the service, which delegates to an implementation class.
• BabelFishBindingStub.java is the client stub that serializes the Java call
and parameters into SOAP.
• BabelFishPortType.java is an abstract interface for the service.
• BabelFishService.java is an abstract interface which defines a factory
class to get a stub instance.
• BabelFishServiceLocator.java is the implementation of the abstract
service interface.
• BabelFishServiceTestCase.java is the JUnit test case for the service. For
more information about JUnit test cases, see “Unit Testing” in
Building Applications with JBuilder.
Expand the net.xmethods.www package node in the project pane to see the
generated files. The project pane looks like this:
2 Click the Web tab of the object gallery and select Web Application.
Click OK. The Web Application wizard appears.
3 Enter Public for both the web application name and directory.
4 Click OK.
7 Click Next.
8 Enter com.borland.demo.web for the sample bean’s package name.
9 Make sure the name of the bean is indexBean. The JSP wizard looks like
this:
10 Click Finish.
11 Make sure index.jsp is open in the editor.
12 Replace the contents of the <body></body> tags with the following JSP
code:
<h1>A simple JSP using a Web Service</h1>
<form method="post">
<table>
<tr>
<td>Enter the text to translate</td>
<td><input name="inputParam" value="<jsp:getProperty name="indexBeanId"
property="inputParam" />"></td>
</tr>
<tr>
<td>Choose the language to translate text to</td>
<td><select name="inputOption">
<option value="en_fr">English to French
<option value="en_de">English to German
<option value="en_it">English to Italian
<option value="en_pt">English to Portuguese
<option value="en_es">English to Spanish
<option value="fr_en">French to English
<option value="de_en">German to English
<option value="it_en">Italian to English
<option value="pt_en">Portuguese to English
<option value="ru_en">Russian to English
<option value="es_en">Spanish to English
</select>
</td>
</tr>
<tr>
<td>Select the server</td>
<td><select name="serverOption">
<option value="public">Publicly hosted service at XMethods
<option value="local">Locally hosted service you built
</select>
</td>
</tr>
</table>
<input type="submit" name="Submit" value="Submit"><input type="reset"
value="Reset"></br>
</form>
import net.xmethods.www.*;
import java.net.URL;
ws = new BabelFishServiceLocator().getBabelFishPort
(new URL("http://localhost:9090/axis/services/BabelFishPort"));
System.out.println(ws.babelFish("en_fr", "Hello"));
}
catch (Exception ex) {
ex.printStackTrace();
}
}
3 Accept all the defaults and click Finish. A WSDL file called
exportbean.wsdl file is generated. This file contains the WSDL
information which defines how to connect to the web service. The Java
files which make up the web service are also generated and placed in a
package called exportbean_generated. These include the following files:
• Bean1PortType.java is the interface for the service.
• Bean1Service.java is an abstract interface which defines a factory class
to get a stub instance.
• Bean1ServiceLocator.java is the implementation of the abstract
interface.
• Bean1ServiceTestCase.java is the JUnit test case for the service. For
more information about JUnit test cases, see “Unit Testing” in
Building Applications with JBuilder.
• Bean1ServicePortSoapBindingStub.java is the client stub that serializes
the Java call and parameters into SOAP.
4 Click OK to create the axis WebApp. The SOAP Server wizard displays.
The SOAP Server wizard looks like this:
5 Accept the defaults for the WebApp and the Apache Axis Toolkit and
click Finish to close the SOAP Server wizard.
default test runner. Here is how JBTestRunner looks after running the
test case:
The test case accesses the public methods of the JavaBean running as a
web service in the SOAP Server. For more information on unit testing,
see “Unit Testing” in Building Applications with JBuilder.
Congratulations! You’ve completed the tutorial, published a JavaBean as a
web service, and tested it. For more information about WSDL, see
Chapter 5, “Working with WSDL.” For more information about SOAP, see
Chapter 3, “Working with SOAP servers.” For more information on unit
testing, see “Unit Testing” in Building Applications with JBuilder.
See also
• uddi.org at http://www.uddi.org
3 Select the Business List node to display the Query For Business page on
the right.
4 Leave the Find By Name field blank to find all the businesses at the site
and choose the Execute button on the Query For Business page to
execute the query.
Tip You can also choose Query|Execute or use the Execute Query button
on the toolbar.
Important You can increase the timeout for the Web Services Explorer. Choose
UDDI|Connection Settings and enter the new timeout in the Timeout
field. Close the Explorer and reopen to apply the timeout value to any
connection. The server may also truncate your query results if it
determines that the results are too large.
5 Expand the XMethods Business List node to see all the services offered
by various companies at the XMethods site.
6 Search for the SQLData business as follows:
• Choose the Business List node again.
• Choose the Name tab on the Query For Business page.
• Enter SQLData in the Find By Name field.
• Press Enter or click the Execute button.
7 Select the SQLData node in the tree.
Notice that the Business Details page displays on the right with
overview information as well as contact, identifier, and category
information, if available. Also, the Query For Service tab displays on
the right. If you know the name of the service, you can narrow your
search even further by entering the name of the service in the Find By
Name field on the Query For Service page.
8 Expand the SQLData node and notice that there are several services
available.
9 Choose the SQLData Headline News node. Now the Service Details
page displays on the right with general information about the web
service, such as business name, description, and service key.
10 Expand the SQLData Headline News node and choose the next node
below it, SOAP Binding. The Binding Details page displays on the right
with a description of how to bind to the service, the access point to the
service, and the access point URL type. Some of these fields may be
blank if they aren’t required.
11 Expand the SOAP Binding node and choose the next node, <No
Description>. The TModel Instance Details page displays on the right
with details about the tModel, such as a description of the service,
tModel name and key, instance description, overview document
description and URL, and any instance parameters. Many of these
fields are blank because they are optional.
12 Navigate to the last SQLData node under the <No Description> node,
the tModel node. Examine the TModel details displayed to the right on
the Overview tab, such as name, description, TModel key, and
overview document description and URL. Some of the information is
the same as the TModel Instance Details page. The description field
describes what the web service does. The overview URL field contains
the URL that points to a WSDL file, which describes the specification
for the web service in the Web Services Description Language. The
WSDL file, written in XML, describes the service interface and the XML
messages that go in and out of the web service. By examining the
WSDL file, you can write programs that invoke and interact with the
web service.
Note At this point you could use the Import WSDL button on the toolbar to
open the Import WSDL wizard. This wizard generates Java classes
from the WSDL. See “Step 4: Generating Java classes” on page 12-7.
6 Click the Categories tab to see how this tModel is categorized. This
tModelType has a keyValue of transport.
7 Expand the Business List node to see the results of the query.
8 Select a business in the list and choose the Categories tab. One of the
categories should be software publisher with a KeyValue of 51121.
Notice that businesses often have multiple categories.
9 Expand the IBM Corporation node and select Buy From IBM.
10 Choose the Categories tab on the Business Details page to see how IBM
is categorized. Because IBM is such a large company with a wide range
of products, it’s registered under several categories called KeyNames.
Notice that many of the KeyNames begin with NAICS and UNSPSC
(Universal Standard Products and Services Classification), which are
different classification systems. Each KeyName has a corresponding
unique tModelKey and KeyValue.
is automatically entered in the WSDL URL field. The wizard inserts this
WSDL found in the Overview Document URL field in the tModel
details.
See also
• Chapter 5, “Working with WSDL”
• Chapter 10, “Tutorial: Generating a web service from a WSDL
document”
• Chapter 9, “Tutorial: Generating Java classes from a WSDL file”
Congratulations! You’ve completed the tutorial.
B F
BabelFish web service 10-1 fonts
Binding Details page 8-14 documentation conventions 1-2
Borland
contacting 1-4 I
Borland Online 1-5
identifier 8-4, 8-11
Borland Web Services Kit for Java 2-4
Import WSDL wizard 5-2
See also web services
Web Services Explorer 8-23
Build page, Project Properties
SOAP tab 3-5
Business Details page 8-14 J
businessKey 8-4 J2EE
web services 7-1
C Java classes
generating from WSDL 5-2, 9-1, 10-1
category 8-4, 8-9
publishing as web service 5-2, 5-3, 11-1
class file
JavaBean
publishing as web service 5-2, 5-3
publishing as web service 11-1
contacting Borland 1-4
JSEE
newsgroups 1-5
Web Services Explorer 8-1
World Wide Web 1-5
Copy Admin/Console To WebApp option 3-3
creating K
BabelFish web service 10-1 keyName 8-4
SOAP server 9-1, 10-1 keyValue 8-4
D M
deploy.wsdd file 5-2, 6-1 Macintosh
regenerating 3-5 support 1-4
deploying monitoring
to a SOAP server 6-1 SOAP messages 4-1
web service 6-1 UDDI SOAP messages 8-23
detail pages
Web Services Explorer 8-13
Index I-1
N T
newsgroups 1-5 TCP Monitor 4-1
Borland 1-5 technical support 1-4
Thomas Register 8-11
O TModel Details page 8-14
TModel Instance Details page 8-14
online resources 1-5 tModelInstance details 8-4
operator sites 8-4 tModelKey 8-4
overview document URL 8-4 tModels 8-4
publishing 8-21
P searching 8-12
toolkit node, SOAP 3-1
publishing
tutorials
Java class as web service 5-2, 5-3
creating BabelFish web services 10-1
services from Axis servers 8-22
creating web service 9-1, 10-1
tModels 8-21
export class as web service 11-1
web services 8-20
import WSDL 9-1, 10-1
publishing bean as web service 11-1
Q Web Services Explorer 12-1
queries
Web Services Explorer 8-13 U
UDDI 2-4
R JSEE 8-1
Regenerate Deployment At Build Time option 3-5 monitoring messages 8-23
runtime configurations operator sites 8-3, 8-4
for a SOAP server 3-4 overview 8-2
terms and definitions 8-3
S UDDI Business Registry 8-3
UDDI Message Monitor 8-23
server-config.wsdd file 3-5 UDDI registries 8-2
Service Details page 8-14 publishing from Axis servers 8-22
serviceKey 8-4 publishing services 8-20
Simple Object Access Protocol (SOAP) 2-2, 3-1 publishing tModels 8-21
See also SOAP searching with Web Services Explorer 8-7
SOAP 3-1 Universal Description, Discovery and Integration
Apache toolkit 3-3 (UDDI) 2-4
build option in Project Properties 3-5 See also UDDI
monitoring messages 4-1 Usenet newsgroups 1-5
monitoring UDDI messages 8-23
selecting a toolkit 3-3 W
server-config.wsdd file 3-5
toolkit node 3-1 web services 2-1
SOAP (Simple Object Access Protocol) 2-2 Borland Web Services Kit for Java 2-4
See also web services business categories 8-9
SOAP server 3-1 business identifiers 8-11
creating 9-1, 10-1 creating 9-1, 10-1
deploying to 6-1 deployment descriptor 5-2, 6-1
relationship to webapp 3-1 EJBs 7-1
runtime configuration 3-4 generating from WSDL 5-2, 9-1, 10-1
starting 3-4 J2EE 7-1
SOAP Server wizard 3-1, 3-2 overview 2-1
SOAP toolkit publishing 8-1, 8-20
selecting 3-3 publishing Java class as 5-2, 5-3
publishing tModels 8-21
Index I-3