Utility Tools

CHAPTER 8

Generating Web Services

This chapter walks you through the basic steps and typical scenarios for using the Web Service Wizard to generate Web Services from a variety of sources. Topics include:

For more information    To learn about the steps and scenarios for using the wizard when you want a program to access Web Services, see Generating Web Service Consumers.

 
Top of page

Basics

You can use the Web Service Wizard of the Novell exteNd Director development environment to develop standard (SOAP-based) Web Services that are implemented as Java remote objects (using RMI). The wizard generates Java source files based on JAX-RPC (Java API for XML-based RPC) and the Novell exteNd Web Services SDK (the JAX-RPC implementation included with Novell exteNd). JAX-RPC is the J2EE specification that provides Web Service support.

The generated files include a servlet to handle access to your Web Service and its methods from HTTP SOAP requests. You can use the generated files as is or modify them when necessary. The advantage of this Java-oriented approach is that you can deal with Web Services using the familiar technologies of RMI and J2EE instead of coding lower-level SOAP APIs.

For more information    For an introduction to Web Service concepts, standards, and technologies, see Web Service Basics.

For more information    For detailed documentation on the wizard, see Web Service Wizard.

 
Top of page

Steps

The complete development process involves:

  1. Preparing to generate

  2. Generating Web Service files

  3. Examining the generated files

  4. Editing the generated files

  5. Using the generated files

 
Top of section

Preparing to generate

To prepare for using the Web Service Wizard, you:

  1. Set up a WAR project in the exteNd Director development environment.

    For each Web Service you generate, the wizard creates a servlet to handle access to that Web Service (from HTTP SOAP requests). As a result, a WAR is required to package your Web Services (one or more per WAR) for deployment to a J2EE server where they will run.

    A possible variation is to set up a JAR subproject in your WAR and use that JAR to contain the servlet and other classes for a Web Service. In any case, the servlet mapping will be in the WAR's deployment descriptor (web.xml).

    (Note that the approach of using a JAR subproject is not currently supported by the Web Service Wizard when you generate a Web Service from a WSDL file. In this situation, it only supports a WAR project.)

  2. Add these files to the project:

    Files

    Details

    Source files, classes, or archives from which your Web Services are to be generated

    You can generate a Web Service from any one of the following:

    • A JavaBean or other Java class

    • An EJB session bean

    • A Java remote interface

    • A WSDL file

    No matter which one you provide, it should (at minimum) declare the methods you want your generated Web Service to expose.

    Compile your Java files    If you provide any Java files, make sure you compile them in your project before starting the Web Service Wizard (because the wizard works from compiled classes).

    No overloaded methods    Overloaded method names are not allowed in Web Service interfaces (as of WSDL 1.2). If you're generating from:

    • A JavaBean or other Java class, the wizard lets you pick no more than one method with a given name

    • An EJB, remote interface, or earlier WSDL file, you must remove any overloaded method names defined in that file before you start the wizard

    Archives required by the Web Services SDK:

    • wssdk.jar, which contains the Web Services SDK API classes needed at runtime

    • jakarta-regexp-1.2.jar (when using a pre-1.4 JDK and XML Schema with patterns)

    • xercesImpl.jar (when using SilverStream eXtend Application Server 4.x)

    • xmlParserAPIs.jar (when using SilverStream eXtend Application Server 4.x)

    • xmlsec.jar (when using XML Signature)

    You'll find these JARs in the Novell exteNd tools\compilelib directory. Depending on your J2EE server configuration, you should do one of the following:

    • Add them to the WEB-INF/lib directory of your WAR project

    • Add them to the server classpath of your J2EE server

    For more information    For more information, see Deploying Web Services.

  3. Edit the classpath of your project so you can compile your Web Service classes once they're generated and edited. You'll need to include:

 
Top of section

Generating Web Service files

Once you've set up your WAR project, you're ready to use the Web Service Wizard. The wizard produces one Web Service at a time, so you'll need to use it multiple times if you have several to develop.

Each time you launch the wizard, it takes input from you about the kind of Web Service to produce. It then generates a set of source files that together make up the Web Service. Here's a summary of the process:

  1. Select File>New>File to display the New File dialog and go to the Web Services tab.

  2. Launch the Web Service Wizard by doing one of the following:

    To generate a Web Service from

    Select

    One of these:

    • A JavaBean or other Java class

    • An EJB session bean

    • A Java remote interface

    New Web Service

    A WSDL file

    Existing Web Service

    As its name suggests, this item is mainly used to generate Web Service consumers that access deployed Web Services (based on their WSDL files). But it can also be used to read WSDL files as blueprints and generate the matching Web Services themselves.

  3. When the wizard prompts you for project location information, specify:

    If you specify a JAR project to contain the generated Web Service files, the wizard will also ask you for a WAR project to map the Web Service's servlet.

  4. When the wizard prompts you, select the class or WSDL file to generate the Web Service from.

    The wizard then asks for additional information based on your selection:

    If you select

    The wizard prompts you to specify

    A JavaBean or other Java class

    • Which methods to expose in the generated Web Service (in contrast, when you generate from an EJB, remote interface, or WDSL file, all methods are automatically exposed)

    • Binding style (document or RPC)

    • Schema information (when appropriate)

    • Class-generation and SOAP options

    The home interface of an EJB session bean

    • Lookup information for the EJB

    • Binding style (document or RPC)

    • Schema information (when appropriate)

    • Class-generation and SOAP options

    The remote interface of an EJB session bean or the SessionBean class itself

    • The home interface of the EJB session bean

    • Lookup information for the EJB

    • Binding style (document or RPC)

    • Schema information (when appropriate)

    • Class-generation and SOAP options

    A Java remote interface

    • Binding style (document or RPC)

    • Schema information (when appropriate)

    • Class-generation and SOAP options

    A WSDL file

    • Namespace-to-package mappings (when there are multiple)

    • Web Service type mappings

    • Class-generation and SOAP options

  5. When the wizard prompts you for class-generation and SOAP options, you need to choose and configure the set of source files to generate for your Web Service.

    The most important choice is whether to generate skeletons to be tie-based or not. The answer depends on the architectural model you want the implementation of your Web Service to follow. See Choosing an implementation model.

    You can choose to generate stubs (which come with a simple client application) for testing your Web Service. When generating from a Java class, you can also request a WSDL file (for publishing the Web Service to a registry) as well as specify the service address (URL) for the Web Service. When generating from a WSDL file, you can override the default service address if necessary.

    NOTE:   Support for jBrokerTM Web 1.x applications is available via a backward-compatibility option. For more information, see If you choose jBroker Web 1.x compatibility.

  6. Click Finish when you're done specifying options for the Web Service.

 
Top of section

Examining the generated files

When you finish the wizard, it generates everything you've specified for your Web Service and updates other parts of your project with supporting changes:

What the wizard generates

Details

Java source file for remote interface

xxxWS.java    This file is automatically generated whenever your input to the wizard is not a remote interface (such as when you start from a JavaBean, Java class, EJB session bean, or WSDL file). That's because a remote interface (which extends java.rmi.Remote and declares the methods to expose) is required to construct your Web Service.

When you start from a WSDL file, the name of the generated remote interface is simply xxx.java.

Java source file for skeletons

xxx_ServiceSkeleton.java    Abstract servlet class that handles access to the Web Service (from HTTP SOAP requests).

In the tie model, xxx_ServiceTieSkeleton extends this class. In the skeleton model, you extend it yourself (with an implementation of your remote interface).

Java source files for tie-based skeletons

xxx_ServiceTieSkeleton.java    Abstract servlet class that extends xxx_ServiceSkeleton.

xxxTie.java    Servlet that's used in the tie model as the front end for the Web Service. It extends xxx_ServiceTieSkeleton to handle access to the Web Service (from HTTP SOAP requests). It delegates to one of the following to process method calls for the Web Service:

  • If you start with a JavaBean, Java class, or EJB session bean, xxxTie instantiates xxxDelegate and delegates to it.

  • If you start with a Java remote interface or WSDL file, you must edit the xxxTie.java file to specify a class of your own to instantiate and delegate to.

xxxDelegate.java    This file is generated if you start with a JavaBean, Java class, or EJB session bean that implements the methods for your Web Service. xxxDelegate instantiates that implementation class and calls those methods on it.

With an EJB session bean, xxxDelegate does a lookup and create to get the remote interface object. Then it uses that object to make the method calls.

Java source files for stubs

xxxService.java    Service interface used by JAX-RPC clients to obtain the stub for the target Web Service.

xxxServiceImpl.java    Service implementation class that handles instantiation of the stub (xxx_Stub). It also supports alternative ways of accessing the target Web Service, including dynamic (stubless) calls.

(Note that when you start from a WSDL file, the names generated for the service interface and implementation class depend on your WSDL and may omit the text Service.)

xxx_Stub.java    Facilitates method calls from a Java-based consumer to the target Web Service. xxx_Stub implements the remote interface corresponding to the Web Service by sending an appropriate HTTP SOAP request for each method call.

xxxClient.java    Simple client application that works as a consumer of the target Web Service. It obtains the stub (via the Service object), then uses the stub to call Web Service methods.

You can run xxxClient from the exteNd Director development environment (select Tools>Run Web Service Client Class) or from a command line.

WSDL file

xxx.wsdl    For use when publishing your Web Service to a registry. It describes the Web Service in a standard format.

Updates to deployment descriptor

In the tie model (when you generate tie-based skeletons), the wizard updates your WAR project's web.xml file to declare xxxTie as the servlet to handle HTTP SOAP requests for your Web Service.

In the skeleton model, you must edit web.xml yourself to declare the servlet to use (your class that extends xxx_ServiceSkeleton).

Updates to project contents

The wizard updates your project to add generated files (and other application-specific files) to it.

Updates to project classpath

The wizard updates your project classpath to include application-specific files as needed.

About generated file names

When generating file names, the Web Service Wizard follows the naming rules specified by JAX-RPC. If you start with a Java class, the resulting file names are based on the name of that class. If you start with WSDL, the resulting file names are based on the definitions in that WSDL.

For simplicity, this documentation uses xxx to represent the portion of a generated Web Service file name that's derived from a class name or WSDL definition.

Additional details of generation

Under the covers, the Web Service Wizard uses the Web Services SDK compilers when generating the Web Service files listed above. In some cases, these compilers may generate additional code or files to support requirements specific to your application, such as:

For more information    For more information, see the Web Services SDK help.

If you choose jBroker Web 1.x compatibility

The current version of the Web Services SDK provides a high degree of backward compatibility with earlier versions. However, some changes introduced to support the JAX-RPC standard may require you to modify code when upgrading an application that originated in jBroker Web 1.x. These changes involve the conventions used for:

Although it's recommended that you upgrade to the current Web Services SDK and JAX-RPC conventions, it's not required. By using the jBroker Web 1.x compatibility option in the Web Service Wizard, you can generate Web Service files according to the original jBroker Web conventions for file names and stub access. This enables you to take advantage of all the other improvements in the latest version of the Web Services SDK without altering your existing 1.x applications.

Generated 1.x-compatible files   The following table describes the files generated when you use the jBroker Web 1.x compatibility option:

With 1.x compatibility on, you get

With 1.x compatibility off, this is named

Details

xxx_REMOTE.java

Example:

  MyObject_REMOTE.java

xxxWS.java

Example:

  MyObjectWS.java

Generated remote interface

_xxx_ServiceSkeleton.java

Example:

  _MyObject_REMOTE_ServiceSkeleton.java

xxx_ServiceSkeleton.java

Example:

  MyObjectWS_ServiceSkeleton.java

Abstract servlet class

_xxx_ServiceTieSkeleton.java

Example:

  _MyObject_REMOTE_ServiceTieSkeleton.java

xxx_ServiceTieSkeleton.java

Example:

  MyObjectWS_ServiceTieSkeleton.java

Abstract tie servlet class

xxx_TIE.java

Example:

  MyObject_TIE.java

xxxTie.java

Example:

  MyObjectWSTie.java

Servlet for the Web Service (in the tie model)

xxx_SERVICE.java

Example:

  MyObject_SERVICE.java

xxxDelegate.java

Example:

  MyObjectWSDelegate.java

Delegate class for the tie servlet

xxxService.java

Example:

  MyObjectREMOTEService.java

xxxService.java

Example:

  MyObjectWSService.java

Service interface for the stub

This class is not used in 1.x-style stub access. It is generated in case you want to upgrade your client code to the JAX-RPC approach.

xxxServiceImpl.java

Example:

  MyObjectREMOTEServiceImpl.java

xxxServiceImpl.java

Example:

  MyObjectWSServiceImpl.java

Service implementation class for the stub

This class is not used in 1.x-style stub access. It is generated in case you want to upgrade your client code to the JAX-RPC approach.

_xxx_ServiceStub.java

Example:

  _MyObject_REMOTE_ServiceStub.java

xxx_Stub.java

Example:

  MyObjectWSBinding_Stub.java

Stub for the Web Service

xxx_CLIENT.java

Example:

  MyObject_CLIENT.java

xxxClient.java

Example:

  MyObjectWSClient.java

Client application for consuming the Web Service

The 1.x-compatible client obtains the stub directly via a JNDI lookup. In contrast, the JAX-RPC client obtains the stub indirectly via the Service object.

xxx.wsdl

Example:

  MyObject_REMOTE.wsdl

xxx.wsdl

Example:

  MyObjectWS.wsdl

WSDL file for the Web Service

 
Top of section

Editing the generated files

Follow these guidelines when editing the files generated by the Web Service Wizard:

Guideline

Details

File you may need to edit

File you must edit

Files you should not edit

  • xxx_ServiceSkeleton.java

  • xxx_ServiceTieSkeleton.java

  • xxxService.java

  • xxxServiceImpl.java

  • xxx_Stub.java

It's OK to edit any of the other generated files, but not typically required.

In some cases, completing the implementation of your Web Service may require you to add one or more manually coded files to work with the generated ones. See Creating additional files.

Editing the xxxTie.java file

The generated xxxTie.java file includes an init() method you may need to edit.

If you start with a JavaBean or Java class, init() is generated to call the setTarget() method of xxx_ServiceTieSkeleton and pass an instance of xxxDelegate (to delegate to it). If xxxDelegate provides an empty constructor, the generated code uses that constructor to do the instantiation.

But if no implicit or explicit empty constructor is available, you must modify the code to indicate which one to use. You may also want to modify it to use a constructor that expects an argument.

The wizard automatically generates calls to setTarget() for every public constructor of xxxDelegate. Each line is commented out—except the one that uses the empty constructor (if available). Uncomment the line with the constructor you want and make any related changes:

  //super.setTarget( new MyObjectWSDelegate(  java.lang.String arg0) );
  //super.setTarget( new MyObjectWSDelegate(  java.lang.String arg0, java.lang.String arg1) );
  super.setTarget( new MyObjectWSDelegate( ) );

If you start with a Java remote interface or WSDL file, init() is always generated with the setTarget() call commented out. In this case, you must provide a class of your own to instantiate and delegate to:

  //super.setTarget(new CONSTRUCT_YOUR_SERVICE_OBJECT_HERE);

If you start with an EJB session bean, you shouldn't need to edit the generated init() method.

Editing the xxxClient.java file

Before you can test your Web Service with xxxClient, you must edit the generated xxxClient.java file to call one or more methods of the Web Service. Look for the process() method in this file and you'll find comments listing all of the possible method calls:

  // System.out.println("Test Result = " + remote.getString());
  // System.out.println("Test Result = " + remote.setString(java.lang.String));
  // System.out.println("Test Result = " + remote.sayHello());

Uncomment the method call(s) you want to test and supply appropriate argument values, as needed:

  // System.out.println("Test Result = " + remote.getString());
  System.out.println("Test Result = " + remote.setString(args[0]));
  System.out.println("Test Result = " + remote.sayHello());

For more information    For additional changes you may want to make to the generated xxxClient.java file, see Generating Web Service Consumers.

Creating additional files

In many scenarios, once the wizard finishes generating, you'll have all of the Java source files you need for your Web Service. But there are cases where you must code additional classes yourself:

In this case

You must add

When using the skeleton model

A class that extends the generated servlet xxx_ServiceSkeleton and implements the remote interface for your Web Service. You'll use this manually coded class as the servlet for the Web Service.

When using the tie model and starting with a Java remote interface or WSDL file

A class that implements the remote interface for your Web Service. You must edit the generated xxxTie.java file to instantiate this manually coded class and delegate to it.

 
Top of section

Using the generated files

To use the Web Service files generated by the wizard, you:

  1. Update the deployment descriptor, if necessary.

    When you use the tie model, the wizard automatically updates the WAR project's web.xml file with the appropriate servlet mapping for your Web Service. But with the skeleton model, you must edit web.xml yourself to supply this information.

    In the following example, MyService is the servlet class that the developer has coded for the Web Service MyRemote:

      <servlet>
         <servlet-name>MyService</servlet-name>
         <servlet-class>com.exsamp.rem.MyService</servlet-class>
      </servlet>
      
      <servlet-mapping>
         <servlet-name>MyService</servlet-name>
         <url-pattern>/MyRemote</url-pattern>
      </servlet-mapping>
    

    Another reason to edit web.xml is to enable or disable the browser-based test environment for your Web Service.

    For more information    For details, see Testing your Web Service from a browser.

  2. Update the project, if necessary.

    As the wizard works, it automatically adds files to your project classpath and contents, as needed. But you should also check yourself to make sure the project has everything it requires to compile and run.

    For instance, if your Web Service accesses an EJB session bean, the EJB-client JAR file should be on your project's classpath.

    For more information    For details on setting up the required classpath and contents for your project (including what the Web Services SDK needs), see Preparing to generate.

  3. Build and archive the project.

    When you complete this step, you'll have a WAR file containing the Web Service(s) you've generated.

  4. Set up for deployment to your J2EE server.

    Prepare the server-specific deployment information required to deploy the WAR to your J2EE server. For example, if you're going to deploy to the Novell exteNd Application Server, create an exteNd deployment plan file.

    If you're going to deploy from the exteNd Director development environment, you should also set up a server profile for your J2EE server.

  5. Deploy the WAR to your J2EE server.

    When you complete this step, each Web Service in the WAR will be accessible as a servlet that can respond to standard HTTP SOAP requests for your exposed methods.

  6. Test your Web Service(s) running on the J2EE server.

    If you've generated, edited, and compiled the xxxClient class for a Web Service, you can use it for a quick test of your method calls. To run xxxClient from the exteNd Director development environment, select Tools>Run Web Service Client Class. The Web Service Wizard Client Runner displays, offering you a list of client classes from the current project to choose from.

    You can also run xxxClient from a command line (providing that you include the appropriate directories and archives on your system classpath).

    For more information    For further details on running xxxClient, see Generating Web Service Consumers.

Testing your Web Service from a browser

The Web Services SDK provides a feature to help you test your Web Services from a Web browser. Once you develop and deploy a Web Service, you can browse to the URL for that service to:

GWSwssdktest

Runtime availability of this testing feature is controlled via an environment entry named wssdk.test.disable in your WAR's deployment descriptor (web.xml). When you create a generic WAR project in the exteNd Director development environment, the New Project Wizard automatically includes wssdk.test.disable in web.xml and sets it to true. To enable the feature, you must set wssdk.test.disable to false before you deploy.

  <env-entry>
     <env-entry-name>wssdk.test.disable</env-entry-name>
     <env-entry-value>false</env-entry-value>
     <env-entry-type>java.lang.Boolean</env-entry-type>
  </env-entry>

 
Top of page

Choosing an implementation model

There are two basic implementation models you can choose from when developing with the Web Service Wizard. This section explores these choices to help you select the one that's most appropriate for the Web Services you generate:

 
Top of section

Tie model

Here's an overview of the tie model and when to use it:

Topic

Details

Typical use

The tie model is typically used when you have an implementation class to provide as input to the Web Service Wizard. That might be a JavaBean, Java class, or EJB session bean that already implements the methods you want to expose as a Web Service.

How it works

The tie model uses a delegation approach to hand off method calls from the generated Web Service classes (which handle the HTTP SOAP processing for your Web Service) to your implementation class (which handles the method processing).

Advantages

The tie model enables you to keep your implementation class (business logic) separate from the generated infrastructure classes that support your Web Service. A related benefit is that you can reuse existing implementation classes currently accessible via other protocols.

How to generate it

When you specify class-generation and SOAP options in the Web Service Wizard, check both of these items:

  • Generate skeletons

  • Tie-based

Files generated

If you start with a JavaBean, Java class, or EJB session bean, the wizard generates:

  • xxxWS.java (remote interface)

  • xxxDelegate.java

  • xxxTie.java

  • xxx_ServiceTieSkeleton.java

  • xxx_ServiceSkeleton.java

It's possible (but not as common) to use the tie model when you have only a Java remote interface or WSDL file to provide as input to the Web Service Wizard. In this case, the wizard output leaves the delegation part of the model for you to complete later. You'll then need to code an implementation class and edit the generated tie class to instantiate it and delegate to it.

 
Top of section

Skeleton model

Here's an overview of the skeleton model and when to use it:

Topic

Details

Typical use

The skeleton model is typically used when you know the methods you want to expose as a Web Service, but don't yet have an implementation of them. In this case, you tell the Web Service Wizard about these methods by providing a Java remote interface or WSDL file as input, then implement them later in the context of the generated Web Service files.

How it works

In the skeleton model, you implement your Web Service methods by subclassing the servlet that the wizard generates to handle HTTP SOAP processing. As a result, the same class that supports the logistics of your Web Service also processes the method calls.

Advantages

The skeleton model is relatively simple, involving fewer classes to understand and maintain. At runtime, having less object overhead may also offer performance benefits.

How to generate it

When you specify class-generation and SOAP options in the Web Service Wizard, check both of these items:

  • Generate skeletons

  • Not tie-based

Files generated

If you start with a Java remote interface, the wizard generates:

  • xxx_ServiceSkeleton.java

If you start with a WSDL file, the wizard generates:

  • xxx.java (remote interface)

  • xxx_ServiceSkeleton.java

File you add

When the wizard is done, you must code a class that extends the generated servlet xxx_ServiceSkeleton and implements the remote interface for your Web Service. You'll use this manually coded class as the servlet for the Web Service.

 
Top of page

Scenario: starting with a Java class

In this scenario, you'll see how the Web Service Wizard can be used to generate a Web Service based on an existing Java class that implements the methods to expose:

Implementation model   This scenario illustrates use of the tie model. For an overview of that architecture, see Choosing an implementation model.

 
Top of section

Project setup

The WAR project for this scenario is set up as follows:

 
Top of section

Input to the wizard

Here's the input provided to the Web Service Wizard for this scenario:

MyObject class

MyObject is an existing Java class from which the Web Service is to be generated. It implements the methods to expose. MyObject.java contains the following code (which must be compiled before you start the wizard):

  package com.exsamp.obj;
  
  public class MyObject {
  
      private String s;
  
      public MyObject() {
      }
  
      public MyObject(String xxx) {
      }
  
      public MyObject(String xxx, String yyy) {
      }
  
      public String getString() {
          return s;
      }
  
      public boolean setString(String s) {
          this.s = s;
          return true;
      }
  
      public String sayHello() {
          return "Hello there, I am on the server";
      }
  }

Project location panel

This wizard panel is completed as follows:

GWSs1projloc

Class selection panel

This wizard panel is completed as follows:

GWSs1objsel

Method selection panel

This wizard panel is completed as follows:

GWSs1methsel

Binding style panel

This wizard panel is completed as follows:

GWSs1binding

Class-generation and SOAP options panel

This wizard panel is completed as follows:

GWSs1objgen

 
Top of section

Generated files for the Web Service

Based on the input provided for this scenario, the Web Service Wizard generates these files to implement the Web Service:

Examining MyObjectWS.wsdl

Here's the generated WSDL for this new Web Service:

  <?xml version="1.0" encoding="UTF-8"?>
  <definitions name="MyObjectWSService"
   targetNamespace="urn:com.exsamp.obj.MyObject"
   xmlns="http://schemas.xmlsoap.org/wsdl/"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
   xmlns:tns="urn:com.exsamp.obj.MyObject"
   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <types/>
   <message name="setStringRequest">
    <part name="arg0" type="xsd:string"/>
   </message>
   <message name="setStringResponse">
    <part name="result" type="xsd:boolean"/>
   </message>
   <message name="getStringRequest"/>
   <message name="getStringResponse">
    <part name="result" type="xsd:string"/>
   </message>
   <message name="sayHelloRequest"/>
   <message name="sayHelloResponse">
    <part name="result" type="xsd:string"/>
   </message>
   <portType name="MyObjectWS">
    <operation name="setString" parameterOrder="arg0">
     <input message="tns:setStringRequest"/>
     <output message="tns:setStringResponse"/>
    </operation>
    <operation name="getString">
     <input message="tns:getStringRequest"/>
     <output message="tns:getStringResponse"/>
    </operation>
    <operation name="sayHello">
     <input message="tns:sayHelloRequest"/>
     <output message="tns:sayHelloResponse"/>
    </operation>
   </portType>
   <binding name="MyObjectWSBinding" type="tns:MyObjectWS">
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="setString">
     <soap:operation soapAction="urn:com.exsamp.obj.MyObject/setString"/>
     <input>
      <soap:body
       encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
       namespace="urn:com.exsamp.obj.MyObject" use="encoded"/>
     </input>
     <output>
      <soap:body
       encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
       namespace="urn:com.exsamp.obj.MyObject" use="encoded"/>
     </output>
    </operation>
    <operation name="getString">
     <soap:operation soapAction="urn:com.exsamp.obj.MyObject/getString"/>
     <input>
      <soap:body
       encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
       namespace="urn:com.exsamp.obj.MyObject" use="encoded"/>
     </input>
     <output>
      <soap:body
       encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
       namespace="urn:com.exsamp.obj.MyObject" use="encoded"/>
     </output>
    </operation>
    <operation name="sayHello">
     <soap:operation soapAction="urn:com.exsamp.obj.MyObject/sayHello"/>
     <input>
      <soap:body
       encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
       namespace="urn:com.exsamp.obj.MyObject" use="encoded"/>
     </input>
     <output>
      <soap:body
       encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
       namespace="urn:com.exsamp.obj.MyObject" use="encoded"/>
     </output>
    </operation>
   </binding>
   <service name="MyObjectWSService">
    <port binding="tns:MyObjectWSBinding" name="MyObjectWSPort">
     <soap:address location="http://localhost/WebServiceSampleDB/WebServiceSample/MyObject"/>
    </port>
   </service>
  </definitions>

 
Top of section

Generated files for testing

Based on the input provided for this scenario, the Web Service Wizard generates these files so you can test the Web Service once it's deployed:

Editing MyObjectWSClient.java

The process() method of MyObjectWSClient must be edited to uncomment the Web Service method call to be tested. Here's the change:

  // System.out.println("Test Result = " + remote.getString());
  // System.out.println("Test Result = " + remote.setString(java.lang.String));
  System.out.println("Test Result = " + remote.sayHello());

 
Top of section

Deployment descriptor

Because this scenario uses the tie model, the Web Service Wizard automatically updates the web.xml file to declare MyObjectWSTie as the servlet class to handle requests for the MyObject Web Service:

  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
                           "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
  <web-app>
     <servlet>
        <servlet-name>MyObject</servlet-name>
        <servlet-class>com.exsamp.obj.MyObjectWSTie</servlet-class>
     </servlet>
     <servlet-mapping>
        <servlet-name>MyObject</servlet-name>
        <url-pattern>/MyObject</url-pattern>
     </servlet-mapping>
  
     <env-entry>
        <env-entry-name>wssdk.test.disable</env-entry-name>
        <env-entry-value>true</env-entry-value>
        <env-entry-type>java.lang.Boolean</env-entry-type>
     </env-entry>
  </web-app>

Also note that, in this case, the developer has chosen to disable the Web Services SDK browser-based test environment for this Web Service. Instead, the Web Service will be tested by running the generated MyObjectWSClient application.

For more information    For more information on the browser-based test environment, see Testing your Web Service from a browser.

 
Top of section

Runtime test result

Once this project is built and the WAR file is created and deployed to the J2EE server, the MyObject Web Service is ready for a test run. Here's the result of using the Client Runner in the exteNd Director development environment to execute the MyObjectWSClient application:

GWSs1runner



Copyright © 2004 Novell, Inc. All rights reserved. Copyright © 1997, 1998, 1999, 2000, 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.  more ...