Configure the scope of a Web service port with the wsadmin tool

 

+

Search Tips   |   Advanced Search

 

Overview

When a Web service application is deployed into WebSphere Application Server, an instance is created for each application or module. The instance contains deployment information for the Web or EJB module, including implementation scope, client bindings and deployment descriptor information. There are three levels of scope that can be set:

  • application
  • session
  • request

If you have not deployed the EAR file yet, we need to have it ready or already deployed into WebSphere Application Server.

The primary purpose of this task is to enable the configuration of the Web service port scope. The scope originally specified when the JavaBean object is enabled as a Web service during the development process can be changed with the WebServicesServerBindPort command. The scope attribute does not apply to Web services that use JMS transport or to enterprise beans.

Web Services for J2EE specifies that Web services implementations must be stateless. Therefore, to maintain specification compliance, the scope can remain at the application level because the state relevant to the individual sessions level or the requests level is not supposed to be maintained in the implementation. If you want to deviate from the specification and want to access a different JavaBean instance, because you are looking for information that is located in another JavaBean, the scope settings need to change.

The setting that you configure for the scope determines how frequently a new instance of a service implementation class is created for the Web service ports in a module. The application scope causes the same instance of the implementation to be used for all requests on the application. The session scope causes the same instance to be used for all requests in each session. The request scope causes a new instance to be used for every request. For example, with the scope set to application, every message that comes to the server accesses the same Java bean instance.

We can also configure the scope with the administrative console.

To change the scope setting through the wsadmin tool:

 

Procedure

  1. Start wsadmin command.

  2. At the wsadmin command prompt, enter the command syntax.

    $AdminApp install app_name {-usedefaultbindings -deployejb 
    -WebServicesServerBindPort {{<module_name> <Web_service> <port><scope_setting>}...}
    
    This example indicates that the scope of multiple ports can be changed using one WebServicesServerBindPort command, where:

    • app_name is the application name, for example WebServicesSample.ear

    • module_name is the module name, for example AddressBookW2JE.jar

    • Web_service is the name of the Web service, for example...

      AddressBookW2JEservice/WSLoggerService2

    • port is the name of the port, for example AddressBook

    • scope_setting is the level of setting for scope, for example Session

 

Result

The scope for a Web service port is configured.

 

Example

$AdminApp install WebServicesSamples.ear {-usedefaultbindings -deployejb -deployws 
-WebServicesServerBindPort {{AddressBookJ2WB.war AddressBookService AddressBook request} 
{AddressBookW2JB.war AddressBookService AddressBook application}}}

 

What to do next

Now one can finish any other configurations, start or restart the application, and verify expected behavior of the Web service.


 

Related Tasks


Web services implementation scope
Web services client port information
Web services client bindings
Configure Web service client-preferred port mappings with the wsadmin tool
Configure Web service client port information with the wsadmin tool

 

See Also


Options for the AdminApp object install, installInteractive, edit, editInteractive, update, and updateInteractive commands