Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Create Web services with the WebSphere SDK

The fast path to interoperability

Mike Edwards (mike_edwards@uk.ibm.com), Java Strategic Planner, IBM
Mike Edwards is a Java Strategic Planner at IBM. You can contact Mike at mike_edwards at uk.ibm.com
Angel Diaz (aldiaz@us.ibm.com), Program Director, Web Services Product Management, IBM
Dr. Angel Luis Diaz is IBM's Program Director for Web Services Product Management. His team is responsible for driving the support of Web services technology across IBM’s entire product line and combined offerings. Before joining the IBM Software Group in 2003, Dr. Diaz was a member of IBM's Research staff and Senior Manager, where he led advanced technology projects related to XML and Web services. In 2002, Dr. Diaz initiated the world’s first two standards that make use of Web services, the Organization for the Advancement of Structured Information Standards (OASIS), Web Services For Remote Portals (WSRP), and OASIS Web Services For Interactive Applications (WSIA). As a result, Dr. Diaz was nominated to the OASIS Technical Advisory Board, a body that aims to help define the technical agenda for future OASIS standards work. In 1998 Dr. Diaz was co-chair and co-author of the first XML standard, the World Wide Web Consortium (W3C) Mathematical Markup Language (MathML). Since then, Dr. Diaz served on seven W3C activities including the Extensible Style Language (XSL), Cascading Style Sheets (CSS), and Document Object Model (DOM). Dr Diaz received his Ph.D. in computer science from Rensselaer Polytechnic Institute. You can contact Angel at aldiaz at us.ibm.com

Summary:  The WebSphere SDK for Web Services (WSDK for short) is a toolkit which is focused on the programming of Java-based Web services and on the creation of Web service clients. It is intended as a simple and easy-to-use path to learn about Web services, how to code them, and how to deploy and test them. The learning path leads on to the full WebSphere Application Server runtime and also to the fully-functioned application developer environment provided by WebSphere Studio. This article discusses how to create Web services using Java and .NET tools and the interoperability of Web services and the activities of the Web Services Interoperability Organization (WS-I).

Date:  29 Jul 2003
Level:  Introductory

Activity:  599 views
Comments:  

What's in the WSDK?

The main ingredients of the WSDK are:

  • A runtime server where Web services and client applications are run and tested. The server is a subset of the WebSphere Application Server capable of running J2EE components relevant to Web services.
    The server also has a UDDI Server which is used for publishing and discovering Web services.
  • A series of command line tools which deal with many of the common tasks associated with building and running Web services.
  • A graded series of Sample applications which provide examples of how Web services and Web service clients are coded, starting with the basics and moving on to more sophisticated aspects such as Security.
  • A comprehensive set of Documentation covering all aspects of the WSDK, including learning paths through Web services concepts, how to use the WSDK tools, and descriptions of the Sample applications.

The typical developer workstation, running either Windows or Linux, should be able to run WSDK, as WSDK makes only modest demands on the system. The download size is about 120 MB, which expands to about 200 MB on disk, including the Java SDK that it uses.

The WSDK is designed for ease-of-use. An installation wizard provides a quick install with minimum configuration. Simple command-line tools are provided to manage the runtime server and to install and control applications in the server.


Building Web services from existing Java components

One of the great features of Web services is that you can build them from existing Java components, without the need for lots of new programming, simply by using the tools provided by WSDK. The Java component can be a simple Java class (called a Bean) or a more complex piece of code such as a Stateless Session Enterprise Java Bean (EJB) component.

When run as a Web service, the code executes inside the runtime server. This applies not only for code originally designed to run in an Application Server, like an EJB component, but it can also be done for code that was originally designed to run stand-alone. The WSDK tools take care of packaging the code into a form (an EAR file) which can be deployed onto the server, including generating all the necessary additional files such as deployment descriptors and WSDL files.

The Sample applications, which are part of the WSDK, show how to expose an existing Java component as a Web service. The simplest sample is shown in Listing 1, which is really the Hello World of Web services. Here’s the code for the Hello.java class, which is in the C:\WSDK_v5\apps\Sample1\src\provider directory:


Listing 1. Hello.java
package com.ibm.wsdk.Sample1;

public class Hello {

    String msg="Hello";
	public String getGreeting(String name) {
		return msg+" "+name+"!";
	}
}

This class takes a name as a parameter -- and returns the name with Hello tacked onto the beginning of the name.

This simple Java class is made into a Web service using the Bean2WebService tool. Bean2WebService creates an EAR file containing the original Hello class, plus a set of other files necessary for the deployment of this class as a Web service. The tool also deploys the EAR file to the runtime server. All that is needed is to start the Web service application running using another command supplied with WSDK:

appserver startapp Sample1WebService

Listing 1, like most of the sample applications, also contains a ready-written client application which can call the Web service. This is conveniently provided in a pre-built form in the C:\WSDK_v5\apps\Sample1\classes\requester directory, but the source code and build commands for the client are also provided as a guide.

Other samples provided with WSDK deal with mode advanced Web services, including Web services built from EJB components and Web services which use Security between the client and the Web service. All the samples are covered in the WSDK documentation, covering how to run the samples and how to build the samples from scratch.


Creating Web services from WSDL definitions

So far, we have discussed how you can create Web services from some existing Java code. You can also create Web services in another way -- from a definition of the Web service interface held in a WSDL file. This second way of building Web services is important where the definition of the Web service is laid down in advance, for example by a business partner in a supply chain, or where a client is needed for a Web service written by another business.

WSDL files define Web services interfaces. WSDL stands for Web Services Description Language and is a standard defined by w3c.org. WSDL is a definition held in XML format of one or more Web services. Each service is described in terms of an operation which acts on an input message and produces an output message. The messages can be simple (the single text string in Listing 1, for example) or more complex (a document representing an Order, for example). The operations and the forms of the messages are all defined in the WSDL file, along with the location of the Web service on the Web (a URL like http://localhost:6080/Sample1WebService/services/Sample1).

When creating Web services from Java code, the Bean2WebService or EJB2WebService tools generate the WSDL file. Listing 2 shows the WSDL file for Listing 1, which defines the location of the service, the operations possible, and the input and output parameters:


Listing 2. WSDL for Hello.java
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://Sample1.wsdk.ibm.com" xmlns=
"http://schemas.xmlsoap.org/wsdl/"
  xmlns:apachesoap="http://xml.apache.org/xml-soap"
  xmlns:impl="http://Sample1.wsdk.ibm.com" xmlns:intf=
  "http://Sample1.wsdk.ibm.com"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <wsdl:types>
  <schema targetNamespace="http://Sample1.wsdk.ibm.com" xmlns=
  "http://www.w3.org/2001/XMLSchema">
   <element name="getGreeting">
    <complexType>
     <sequence>
      <element name="in0" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="getGreetingResponse">
    <complexType>
     <sequence>
      <element name="getGreetingReturn" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
  </schema>
 </wsdl:types>
   <wsdl:message name="getGreetingRequest">
      <wsdl:part element="intf:getGreeting" name="parameters"/>
   </wsdl:message>
   <wsdl:message name="getGreetingResponse">
      <wsdl:part element="intf:getGreetingResponse" name="parameters"/>
   </wsdl:message>
   <wsdl:portType name="Sample1Interface">
      <wsdl:operation name="getGreeting">
         <wsdl:input message="intf:getGreetingRequest" name=
         "getGreetingRequest"/>
         <wsdl:output message="intf:getGreetingResponse" name=
         "getGreetingResponse"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="Sample1SoapBinding" type="intf:Sample1Interface">
      <wsdlsoap:binding style="document" transport=
      "http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="getGreeting">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="getGreetingRequest">
            <wsdlsoap:body use="literal"/>
         </wsdl:input>
         <wsdl:output name="getGreetingResponse">
            <wsdlsoap:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="Sample1InterfaceService">
      <wsdl:port binding="intf:Sample1SoapBinding" name="Sample1">
         <wsdlsoap:address location=
         "http://localhost:6080/Sample1WebService/services/Sample1"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

WSDK contains a tool which helps build a Web service or a Web service client from a WSDL file of this type. This tool is called WSDL2WebService.

WSDL2WebService is used in two steps:

  1. WSDL2WebService is used with the -createService option and it reads the WSDL file and creates a skeleton implementation of the Web service and, optionally, the Web service client as a series of Java files. The skeleton provides all of the interface code necessary to expose the function as a Web service.
    Once the skeleton implementation files are created, the Java code that actually implements the service is added to the skeleton files -- a task for the programmer to provide the business logic.
  2. Once the Web service implementation is ready, WSDL2WebService is used for a second time, but with the -createEar option. This packages up the Web service code into an EAR file which is then deployed to the runtime server.

Sample 6 and Sample 7 in WSDK show the process of building Web services from WSDL definitions in this way.


Interoperability of Web Services and WS-I

One of the attractions of Web services is the promise of Interoperability -- the potential for one system to call on a Web service on a different system, without being concerned about the technology used to implement the Web service. Web services are independent of the programming language, independent of the operating system, and independent of the supplier of the application server used to run the Web service.

Web service interoperability is possible largely because Web services are defined in terms of the messages that flow between the clients and the Web service provider, rather than in terms of programming interfaces. The messages are defined in terms of XML -- a data format that is itself independent of programming languages and operating system considerations.

To ensure Web services interoperability between Web services implementations provided by different vendors on different platforms, the Web Services Interoperability Organization (WS-I.org) has been established. WS-I is an open industry organization supported by all of the major companies involved in Web services. WS-I does not define standards -- instead, WS-I defines Profiles which define how the various Web services standards (for example WSDL, SOAP, UDDI) should be used in order to guarantee interoperability.

WS-I is in the process of completing Basic Profile 1.0 -- the first profile which addresses standard Web services. At the time of writing (May 2003), Basic Profile 1.0 is at the Board Approval draft level, and is due to become the official published profile within a couple of months.

WSDK V5.0.1 provides support for the draft version of Basic Profile 1.0. The WSDK tools can generate conforming Web services, and the Sample applications are written to conform to the draft Basic Profile 1.0. This should help ensure interoperability with other conforming Web services implementations, which is an important and valuable goal.


Building Microsoft .NET clients to WebSphere Web Services

As a practical example of interoperability, WSDK V5.0.1 has built Sample Web Services which can be consumed by clients running on Windows, built using Microsoft .NET tools. This combination of a Microsoft .NET client calling on Web services running in a WebSphere server is chosen as it is likely to be a common configuration in many installations.

The WSDK documentation contains a guide to building a Microsoft .NET client using the Visual Basic .NET tools. A step-by-step process is shown for creating a client to the Listing 1 Web service, including both a graphical interface and also the underlying code for invoking the Web service and returning the results.

You can build similar .NET client applications for the more complex Web service samples in WSDK.


Taking the next steps

The WebSphere SDK for WebServices Version 5.0.1 is available for free download from the IBM Web site (see Resources for a link).

You can use the WSDK to develop and test Web services and is a great toolkit for learning all about Web services, but it is not intended for any type of production use. When you want to put your Web services into production use, you will need to run them on a production version of the WebSphere Application Server. For more information about WebSphere Application Server, see the Resources.

WSDK is a toolkit which focuses on Web services, based on command-line tools. For a development environment which addresses the complete range of development activities, including a graphical development environment with an extensive set of wizards and facilities for debugging code, try WebSphere Studio -- and in particular WebSphere Studio Application Developer.


Resources

About the authors

Mike Edwards is a Java Strategic Planner at IBM. You can contact Mike at mike_edwards at uk.ibm.com

Dr. Angel Luis Diaz is IBM's Program Director for Web Services Product Management. His team is responsible for driving the support of Web services technology across IBM’s entire product line and combined offerings. Before joining the IBM Software Group in 2003, Dr. Diaz was a member of IBM's Research staff and Senior Manager, where he led advanced technology projects related to XML and Web services. In 2002, Dr. Diaz initiated the world’s first two standards that make use of Web services, the Organization for the Advancement of Structured Information Standards (OASIS), Web Services For Remote Portals (WSRP), and OASIS Web Services For Interactive Applications (WSIA). As a result, Dr. Diaz was nominated to the OASIS Technical Advisory Board, a body that aims to help define the technical agenda for future OASIS standards work. In 1998 Dr. Diaz was co-chair and co-author of the first XML standard, the World Wide Web Consortium (W3C) Mathematical Markup Language (MathML). Since then, Dr. Diaz served on seven W3C activities including the Extensible Style Language (XSL), Cascading Style Sheets (CSS), and Document Object Model (DOM). Dr Diaz received his Ph.D. in computer science from Rensselaer Polytechnic Institute. You can contact Angel at aldiaz at us.ibm.com

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=SOA and Web services
ArticleID=87017
ArticleTitle=Create Web services with the WebSphere SDK
publish-date=07292003
author1-email=mike_edwards@uk.ibm.com
author1-email-cc=flanders@us.ibm.com
author2-email=aldiaz@us.ibm.com
author2-email-cc=flanders@us.ibm.com

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

For articles in technology zones (such as Java technology, Linux, Open source, XML), Popular tags shows the top tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), Popular tags shows the top tags for just that product zone.

For articles in technology zones (such as Java technology, Linux, Open source, XML), My tags shows your tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), My tags shows your tags for just that product zone.

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.

Special offers