This article shows you how to design, develop, test, and implement a client application that invokes an IBM® WebSphere® Service Registry and Repository V22.214.171.124 (hereafter called WSRR) runtime. The runtime has SOA metadata artifacts populated into it using predefined and persisted queries that are provided by WSRR. The article shows you how to create relationships between the various artifacts as you populate them into WSRR, so that you can test the client application. You can design and develop the client application using either an Eclipse workbench or IBM Integration Designer, and similarly, you can run and test the client application using either a Windows® command window or IBM Integration Designer.
The WSRR Java API lets you design and develop client applications to interact with the WSRR runtime from the client side using local or remote EJB interfaces, or to design and develop delegate applications to interact with WSRR runtime from the server side using local EJB interfaces in plug-ins. The WSRR Java API facilitates WSRR content encapsulation and Create, Retrieve/Query, Update, and Delete (CRUD) operations on WSRR content. WSRR stores its content in the form of Service Data Objects (SDOs), and the Java API uses the SDO Version 2 specification. WSRR allows two types of client applications to interact with it, using the same interfaces: an EJB client and a web services client. However, only an EJB client application can exploit additional method signatures that require passing in list type parameters to update and delete WSRR content.
The purpose of the standalone EJB Java client application described in this article is to exercise each method of the WSRR predefined persisted queries using the Java API in a secure environment. When taken together, the application described in this article, the application in the referenced developerWorks article, and the example code in the WSRR information center topic User-defined persisted queries provide everything you need to develop client and delegate-side EJB Java applications. Prior to invoking each of WSRR predefined persisted queries, you need to populate the WSRR with SOA artifacts.
The rest of this article consists of the following sections:
- Populating SOA artifacts into WSRR
- Developing the client application
- Executing the client application
Populating SOA artifacts into WSRR
First, define a named property query that retrieves content of any type from WSRR and saves it under the All Entities name, as shown in Figures 1 and 2:
Figure 1. All Entities named property query
Figure 2. All Entities named property query details
Run the query to confirm that WSRR has no content at the beginning:
Figure 3. All Entities named property query execution results
Populate WSRR with a set of related SOA artifacts consisting of XSD and WSDL documents packaged into a zip archive file document. The AddressDetailsProvider.zip archive contains a related set of XSD documents and WSDL documents capturing interface and implementation details. The abstract Address XML schema definition (XSD) is shown in Figure 4:
Figure 4. abstract Address XSD
One concrete HomeAddress XSD is derived from the abstract Address XSD:
Figure 5. Concrete HomeAddress XSD
One concrete WorkAddress XSD is derived from the abstract Address XSD:
Figure 6. Concrete WorkAddress XSD
One concrete Person XSD document can have a related HomeAddress and/or WorkAddress XSD specified:
Figure 7. Person XSD
Figure 8 shows the interface WSDL definition for the AddressDetails service:
Figure 8. AddressDetails.wsdl – interface WSDL
Figure 9 shows the implementation WSDL definition for the AddressDetails service:
Figure 9. AddressDetailsProvider.wsdl – implementation WSDL
Load AddressDetailsProvider.zip archive file document into WSRR with the following metadata specified, as shown in Figures 10, 11, and 12:
WSDL Document (AddressDetailsProvider.zip)
Address Details Provider Service Documents
Figure 10. AddressDetailsProvider.zip document loading
Figure 11. AddressDetailsProvider.zip document loading confirmation
Figure 12. AddressDetailsProvider.zip document loading success
wssecurity-policy document into WSRR with the following
metadata specified, as shown in Figures 13, 14, and 15:
WS-Security Policy Document
Figure 13. wssecurity-policy document loading
Figure 14. wssecurity-policy document loading confirmation
Figure 15. wssecurity-policy document loading success
Note.xml into WSRR with the following metadata specified,
as shown in Figures 16, 17, and 18:
Note XML Document
Figure 16. note.xml document loading
Figure 17. note.xml document loading confirmation
Figure 18. note.xml document loading success
You are now ready to load
RelChild.txt into WSRR with the
following metadata specified, as shown in Figures 19, 20, and 21:
Relationship Child Document
Figure 19. RelChild.txt document loading
Figure 20. RelChild.txt document loading confirmation
Figure 21. RelChild.txt document loading success
RelParent.txt other document into WSRR with the following
metadata specified, as shown in Figures 22, 23, and 24:
Relationship Parent Document
Figure 22. RelParent.txt document loading
Figure 23. RelParent.txt document loading confirmation
Figure 24. RelParent.txt document loading success
Perform four security policy attachments to
AddressDetails.wsdl – for security encoding and signing of
request and response flows, as shown in Figures 25, 26, and 27:
Figure 25. Policy Attachment
Figure 26. Policy Attachment confirmation
Figure 27. Policy Attachment success
Next, define two custom relationships to
as shown in Figure 28:
Custom-Relationship-Parent -- RelParent.txt
Custom-Relationship-Child -- RelChild.txt
Figure 28. Definition of custom relationships
Define a test environment for SOAP Service Endpoint, as shown in Figures 29 and 30:
Figure 29. Definition of SOAP service endpoint environment
Figure 30. Definition of SOAP service endpoint environment confirmation
Developing the client application
Table 1 shows the WSRR-populated SOA artifacts with the respective document bsrURIs. You need this information to develop the client application. When you download and run the client application sample, adjust the client application logic to reflect the bsrURIs generated in your instance of WSRR:
Table 1. WSRR populated SOA artifact details
|Artifact Name||Artifact Type||bsrURI|
Developing the client application requires adding the indicated JAR files
to the client-side classpath to resolve the imported packages at build
time and to run the client at run time. The required JAR files are
com.ibm.ws.webservices.thinclient_7.0.0.jar, as shown in
Figures 30 and 32. The client application features private static string
variables to hold information about userid, password, initial bootstrap
host/port, and location of security context setup files.
The client application class constructor method has two method calls to register governance and ontology SDO factory package instances. You need to register the three separate packages listed below prior to using SDO objects in the client application. One of the method calls implicitly registers the third package.
The client application program consists of one main static method, and two
public methods named
getMySRSession(.,.) method defines four system properties,
which are briefly explained below. For more details, see Resources at the bottom of the article.
- Specifies the namespace of bootstrap server for the initial context factory to construct initial context object. In this scenario, our bootstrap server happens to be running on localhost at Port 2811.
- Specifies a file URL that points to the ssl.client.props file. Client application configuration of Secure Sockets Layer (SSL) requires access to this file as this file contains SSL configuration property definitions.
- Java client application programs using JAAS for authentication need to invoke with the JAAS configuration file specified and this can be achieved by specifying system property. The specified system property is used to pass the appropriate JAAS configuration file to the Java virtual machine.
- In order for a standalone client application to access a secure
enterprise bean application running on a remote server, this system
property is required to be configured for message layer authentication
of client with a Secure Sockets Layer (SSL) transport. This system
property points to WebSphere Application Server's
The logic subsequently creates a login context using WSLogin login
configuration with a callback handler that makes use of userid and
password details passed in. A login is performed using this context object
and an authenticated subject is obtained, assuming a successful
authentication/authorization. This authenticated subject is then used to
set the invocation context for the rest of thread to execution under. The
logic sets up an EJB home reference pointing to the real JNDI name of
The Narrow method is used to get a reference to the implementation of the
ServiceRegistrySessionHome object that corresponds to the
passed-in remote stub object type of ejbHome. The ServiceRegistrySession
reference is created by calling the create() method on the
ServiceRegistrySessionHome object. Catch block logic detects
the type of exception caught and prints the stack trace.
If successful, the
getMySRSession(.,.) method returns a
ServiceRegistrySession object to the caller.
exerciseAPIs(.) method takes in a
ServiceRegistrySession object parameter and systematically
exercises each of WSRR's predefined, persisted query methods in turn.
Query methods can be categorized into:
- Methods that deal with the Document Programming Model (WSDLDocument, XSDDocument, PolicyDocument, and XMLDocument)
- Logical Object Programming Model (WSDL Programming Model, XSD Programming Model, and Policy Programming Model)
- Base Objects (GenericObject, DataObject, BaseObject, LogicalObject, and QueryObject)
- User-defined Metadata (Properties and Relationships)
You can also view query methods as follows:
- Methods that require no parameters to pass in
- Methods that require a
Stringto be passed in with a value of metadata type
- Methods that require a
Stringto be passed in with a quoted metadata type and quoted value of metadata type separated by a comma
- Methods that require list of quoted value of metadata type separated by a comma, followed by list of corresponding quoted metadata type separated by a comma
The sample code is set up to pass in possible and permitted combinations of parameters (alternate combinations in comments) when API method calls permit. The console output can be easily matched with the calls exercised for easy cross referencing, as shown in Figure 30 above.
By executing a saved
All Entities WSRR query, you can compare
and cross-reference console output with WSRR Web UI Filters categorization
output, to confirm the client application results (as shown above in
Figures 1, 2, 33, 34, and 35).
Executing the client application
You can execute the client application in IBM Integration Designer or in a Windows command window, as shown in Figures 31 and 37. To execute the client application in IBM Integration Designer, from the Java EE perspective, Select Run => Run configurations => Java application => WSRREJBQueryClient:
Figure 31. WSRREJBQueryClient development – IBM Integration Designer tool in Java EE Perspective
Figure 32. WSRREJBQueryClient development – Run Configurations – Main Tab
Figures 33 and 34 show the run configuration's Main and Classpath tabs, with appropriate configuration details specified:
Figure 33. WSRREJBQueryClient development – Run Configurations – Classpath Tab
Select Console view to confirm successful execution of the client application, as shown in Figure 34:
Figure 34. WSRREJBQueryClient development – Console View
Output in Figures 34, 35, and 36 should match, indicating that client application has exercised the API correctly.
Figure 35. WSRREJBQueryClient development – Filtered Console Output
Figure 36. WSRREJBQueryClient development – Filtered Web UI View
To execute the client application in a Windows command window, change
directory to the appropriate location in the file system and execute the
WSRREJBQueryClient.cmd, as shown in Figure 37.
Verify the output generated by reviewing the redirected output file.
Figure 37. WSRREJBQueryClient development – program execution from command window
This article showed you how to develop, test, and execute a standalone EJB Java client application using IBM Integration Designer to invoke the WSRR V126.96.36.199 predefined persisted queries using the Java API. In addition, the article showed you how to populate WSRR with the required SOA artifacts for the client application to execute against, and how to execute the client application from a Windows command window.
The author gratefully acknowledges the help he received from Anna Maciejkowicz, a Support Specialist on the IBM WSRR Level-3 Support Team in Hursley, UK, and from Kailash Peri, a Client Technical Resolution Specialist on the WebSphere Message Broker and WSRR Level-3 Support Team in Research Triangle Park, NC, USA.
|Code sample||ArticleExample.zip||13 KB|
- WebSphere Service Registry and
Repository information center topics
- Predefined persisted queries
- Creating a client to interact with WSRR
- Javadoc API reference: WSRR public API
- ssl.client.props client configuration file
- Configuring programmatic logins for Java Authentication and Authorization Service (JAAS)
- Example: Getting an initial context by setting the provider URL property
- Example: Configuring basic authentication, identity assertion, and client certificates
- Example: Using the WSLogin configuration to create a basic authentication subject
- Other WebSphere Service Registry
and Repository resources
- WebSphere Service Registry and Repository information
A single Web portal to all WebSphere Service Registry and Repository documentation, with conceptual, task, and reference information to help you install, configure, and use the product.
- Getting started with WebSphere Service Registry and
This developerWorks article shows you how to populate WebSphere Service Registry and Repository with existing Web services information.
- Customizing WebSphere Service Registry and Repository using
This developerWorks article shows you how to customize WebSphere Service Registry and Repository using its flexible Java APIs, via two scenarios for the common administrative task of removing duplicate WSDL files: using a standalone EJB client, and using a Java validator plug-in.
- IBM Redbook: WebSphere Service Registry and Repository
This IBM Redbook discusses the architecture and functions of Service Registry, along with sample integration scenarios that you can use to implement Service Registry in an SOA.
Service Registry and Repository product page
Product descriptions, product news, training information, support information, and more.
- WebSphere Service Registry and Repository Information
This wiki provides an alternative portal for quick access to a wide variety of WebSphere Service Registry and Repository resources, and also makes it easy for you to give feedback on the product.
- WebSphere Service Registry and Repository requirements
Hardware and software requirements.
- WebSphere Service Registry and Repository support
A searchable database of support problems and their solutions, plus downloads, fixes, and problem tracking.
- WebSphere Service Registry and Repository information center
- WebSphere resources
- developerWorks WebSphere developer resources
Technical information and resources for developers who use WebSphere products. developerWorks WebSphere provides product downloads, how-to information, support resources, and a free technical library of more than 2000 technical articles, tutorials, best practices, IBM Redbooks, and online product manuals. Whether you're a beginner, an expert, or somewhere in between, you'll find what you need to build enterprise-scale solutions using the open-standards-based WebSphere software platform.
- developerWorks WebSphere application integration developer
How-to articles, downloads, tutorials, education, product info, and other resources to help you build WebSphere application integration and business integration solutions.
- developerWorks WebSphere business process management
WebSphere BPM how-to articles, downloads, tutorials, education, product info, and other resources to help you model, assemble, deploy, and manage business processes.
- Most popular WebSphere trial downloads
No-charge trial downloads for key WebSphere products.
- WebSphere forums
Product-specific forums where you can get answers to your technical questions and share your expertise with other WebSphere users.
- WebSphere on-demand demos
Download and watch these self-running demos, and learn how WebSphere products and technologies can help your company respond to the rapidly changing and increasingly complex business environment.
- developerWorks WebSphere weekly newsletter
The developerWorks newsletter gives you the latest articles and information only on those topics that interest you. In addition to WebSphere, you can select from Java, Linux, Open source, Rational, SOA, Web services, and other topics. Subscribe now and design your custom mailing.
- WebSphere-related books from IBM Press
Convenient online ordering through Barnes & Noble.
- WebSphere-related events
Conferences, trade shows, Webcasts, and other events around the world of interest to WebSphere developers.
- developerWorks WebSphere developer resources
- developerWorks resources
downloads for IBM software products
No-charge trial downloads for selected IBM® DB2®, Lotus®, Rational®, Tivoli®, and WebSphere® products.
Join a conversation with developerWorks users and authors, and IBM editors and developers.
cloud computing resources
Access the IBM or Amazon EC2 cloud, test an IBM cloud computing product in a sandbox, see demos of cloud computing products and services, read cloud articles, and access other cloud resources.
- developerWorks tech briefings
Free technical sessions by IBM experts to accelerate your learning curve and help you succeed in your most challenging software projects. Sessions range from one-hour virtual briefings to half-day and full-day live sessions in cities worldwide.
- developerWorks podcasts
Listen to interesting and offbeat interviews and discussions with software innovators.
- developerWorks on
Check out recent Twitter messages and URLs.
- IBM Education Assistant
A collection of multimedia educational modules that will help you better understand IBM software products and use them more effectively to meet your business requirements.
- Trial downloads for IBM software products