Exposing Components as Web services

This section describes how to expose a component as a Web service.

Displaying parameter names

For the parameter names of an exposed component to display in the WST development tool:

  1. Verify the parameter names are correct in the component’s IDL file.

  2. Verify the stub classes are generated and compiled in debug mode before the component is exposed as a Web service.

Before generating stubs from EAServer Manager for the component you are exposing, use one of two ways to set the compiler to compile stubs using debug mode:

  1. Add -DSERVER_STUBS_DEBUG=true to the com.sybase.jaguar.server.jvm.options property in the server.props file, located in the /repository/Server subdirectory of your EAServer installation. server is the name of the EAServer you are modifying. For example, jaguar.props.

    Restart the server. This server-wide setting results in all classes being compiled with debug mode for the server.

  2. Add com.sybase.jaguar.component.javac.debug=true to the component.props file for the component you are exposing, located in the /repository/component/package_name subdirectory of your EAServer installation. package_name is the name of the package that contains the component you are modifying, and component is the name of the component within that package. For example, /repository/SurfSideVideoPB/n_store.props. This affects the modified component only, since code generation and compilation checks the property at the component level first. If the component.javac.debug is set to “false,” the classes are compiled with normal mode (non-debug) even though SERVER_STUBS_DEBUG is set to true in the server.props file.

StepsUsing the Expose wizard to expose a Web service

  1. From the Sybase Web Services view, highlight the component that you are exposing.

  2. Right-click the file and select Expose As Web Service.

  3. The Expose as a Web Service wizard displays. Table 4-6 describes the Expose as a Web Service properties. Complete the information and click next to move to the next window and Finish when done.

    Error messages are logged in the server’s log file and server’s servlet log file. Check these files for any error conditions. For example, if you see a non-unique context path error, verify that the exposed component does not share the same Web collection name and Web service name as another exposed component, and re-expose the Web service.

Table 4-6: Exposing and Deploying Web service wizard options and properties

Window

Property

Description

General Options

Collection Name

Name of the Web service collection to which this Web service is exposed.

Make sure the Web collection name and Web service name combination are unique when exposing the component as a Web service.

Web Service Name

Name of the Web service.

Location URL

The location where the Web service is available.

Target Namespace

A valid Uniform Resource Identifier (URI) for the location where the WSDL document is published. The target namespace should not include the file name; WST appends the appropriate file name when the WSDL document is generated. The target namespace can be a Uniform Resource Name (URN), which is a globally unique and persistent URI.

http://www.com.sybase.webservices is an example of a valid URI.

urn:simpleJavaClass.test is an example of a valid URN.

Port Type Name

Describes a collection of operation elements that define the abstract interface of the Web service. The port type name provides a unique name among all port types defined within the WSDL document. For example:

<portType name="SimplePortType">

Binding Name

Contains the details of how the elements of the port type name are converted to a concrete representation of the Web service by combining data formats and protocols:

<binding name="TestBinding"

Service Port Name

Indicates the Web service endpoint address. For example:

http://EAServer_1:8080/webservices/testPort or

testPort

Implementation Class

The implementation class file to which the Web service is mapped.

When you expose a component as a Web service a service implementation class file with a .java.new extension is created. Remove the .new extension and enter your business logic into the implementation file before deploying it as a Web service. Right-click the file and select Refactor | Rename to rename or remove the .new exention..

Type Mapping Version

The type mapping version. Valid options are 1.1 (the default) and 1.2.

Soap Action

The URI for the SOAPAction HTTP header for the HTTP binding of SOAP. The SOAPAction HTTP request header field can be used to indicate the intent of the SOAP HTTP request. The URI identifies the intent.

Binding Style

The SOAP binding style:

  • Document – indicates that the SOAP body contains an XML document.

  • RPC (remote procedure call) – indicates that the SOAP body contains an XML representation of a method/operation call.

  • Wrapped – a document literal variation, that wraps parameters as children of the root element.

Soap Use

The SOAP body use:

  • Literal – if using a document binding style.

  • Encoded – if using an RPC binding style.

Method Selection

Method Name

Select the methods/operations of the Web service for which the WSDL is to be generated.

Mapping

Package Name

The package to which this Web service maps.

Deployment

Deployment Scope

The scope of the Web service deployment defined in the server-config.wsdd; application, session, or request (the default). For example:

 <parameter name="scope" value="Application"/> 

If Set to:

  • request – a new service implementation instance is created for any request.

  • application – only one shared service object is created for all requests.

  • session – a new object for each session-enabled client is created.

If this is a Java class being deployed to EAServer there are two session classes/tables to store the objects; one for an application scoped service, and the other for a session scoped service. Once the object is created, it is saved in the appropriate table. When the next request arrives, the server checks the table for the object with the service name and reuses the object. If the object is not found, a new object for the class is created.

The session scope can have a timeout setup to remove an object from the table. You can define a handler to set the timeout in the service. You can not set a timeout paramter in the .wsdd file, since the runtime environment does not read the timeout option in the .wsdd file. The application scope service timeout is not currently implemented.

Destination

Server

Highlight the server to which this Web service is deployed and exposed from.

Web Service Collection

The Web service collection to where this Web service is contained.

Summary

Summary of your selections. Review and click Finish to deploy, or Back to make modifications.

If you are deploying a Java class, when you click Finish, the wizard creates a .wsdd (Web service deployment descriptor) which is an XML file that contains deployment information and location of the service implementation file, and all dependent JARs and classes. The JAR file’s format matches the format that the server uses to export Web services and expects on import.