You can use the Jython or Jacl scripting language to query for
Web services properties with the wsadmin tool. Use the commands in the WebServicesAdmin
group to list all Web services and attributes, find attributes of a specific
Web service, determine the Web service endpoint, and determine the operation
name of a Web service.
Before you begin
The wsadmin administrative scripting program supports two scripting
languages, Jacl and Jython. The Version 6.1 release of WebSphere Application
Server represents the start of the deprecation process for the Jacl syntax
that is associated with the wsadmin tool. The Jacl syntax for the wsadmin
tool continues to remain in the product and is supported for at least two
major product releases. After that time, the Jacl language support might be
removed from the wsadmin tool. The Jython syntax for the wsadmin tool is the
strategic direction for WebSphere Application Server administrative automation.
This topic includes examples written only in the Jython scripting language.
Before
you can complete the procedure for the commands in the WebServicesAdmin group,
you must launch a scripting command.
About this task
Use the following commands to query for Web services and Web service
attributes. If you receive a NoItemFoundException error, the specified application,
module, service, or endpoint can not be found. Verify that all input parameters
are correct.
You can optionally specify the client parameter for any
command in the WebServicesAdmin command group. The client parameter indicates
whether to return service providers or service clients. Specify false to
request service providers and true to request service clients.
Procedure
- Query for all installed Web services.
Enter the following
command. You do not need to specify the application parameter for this command.
AdminTask.listWebServices()
This
command returns all installed Web services. The command also returns the application
name, module name, service name, and service type for each Web service.
Sample
output:
'[ [service {http://www.ibm.com}service1] [client false] [application
application1] [module webapp1.war] [type JAX-WS] ]'
- Query for all installed Web services for a specific application.
Enter the following command, and specify the name of the application
you want to query:
AdminTask.listWebServices('[–application application_name -client false]')
This
command returns all installed Web services for the
application_name that
you specify. The command also returns the application name, module name, service
name, and service type for each Web service.
Sample output:
'[ [service {http://www.ibm.com}service1] [client false] [application
application1] [module webapp1.war] [type JAX-WS] ]'
- Query for the Web service name and type.
Enter the
following command, and specify the application name, module name, and Web
service name. The
client parameter is optional.
AdminTask.getWebService('[–application application_name
-module module_name -service webservice_name -client false]')
The
command returns the Web service name and Web service type.
Sample output:
'[ [service {http://www.ibm.com}service1] [client false] [type JAX-WS] ]'
- Query for the Web service endpoints. The logical endpoint name
is the port name in the Web Services Description Language (WSDL) document.
Enter the following command, and specify the application name, module
name, and Web service name. The
client parameter is optional.
AdminTask.listWebServiceEndpoints('[–application application_name
-module module_name -service webservice_name -client false]')
This
command returns the port on which the Web service is installed.
Sample
output:
'[logicalEndpoint QuotePort01]'
- Query for the Web service operation names.
Enter
the following command, and specify the application name, module name, Web
service name, and endpoint name. The logical endpoint name is the port name
in the Web Services Description Language (WSDL) document. The
client parameter
is optional.
AdminTask.listWebServiceOperations('[–application application_name -module module_name
-service webservice_name -logicalEndpoint endpoint_name -client false]')
This
command returns all Web service operations.
Sample output:
'[operation ivt_app_op1] [operation ivt_app_op2]'