Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Oracle Service Bus 11g Development Cookbook

You're reading from   Oracle Service Bus 11g Development Cookbook

Arrow left icon
Product type Paperback
Published in Jan 2012
Publisher Packt
ISBN-13 9781849684446
Length 522 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (19) Chapters Close

Oracle Service Bus 11g Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1. Creating a basic OSB service 2. Working Efficiently with OSB Artifacts in Eclipse OEPE FREE CHAPTER 3. Messaging with JMS Transport 4. Using EJB and JEJB transport 5. Using HTTP Transport 6. Using File and Email Transports 7. Communicating with the Database 8. Communicating with SOA Suite 9. Communication, Flow Control, and Message Processing 10. Reliable Communication with the OSB 11. Handling Message-level Security Requirements 12. Handling Transport-level Security Requirements Index

Testing the proxy service through soapUI


In the previous recipe, we used the OSB console for testing the proxy service. This is ok to just quickly see, if the service is working. But for automatic and repeatable tests, the OSB console is not the right tool.

One advantage of using standards such as the web service standard and the SOAP-based web services is the fact that we can mix and match products from different vendors. The web service standards are vendor-neutral.

Especially for testing web services, there exists a lot of specialized products from different vendors. soapUI is such a specialized tool, which offers both a free as well as a pro version. The free version supports the testing web services with a lot of convenient functionalities. In this recipe, we will show how to test our simple proxy service through soapUI.

Getting ready

To perform this recipe, soapUI needs to be downloaded and installed. We can get it from here: http://www.soapui.org.

In order to test the service from soapUI, we need to know the WSDL URL of the deployed proxy service. The URL is constructed by the OSB at deployment time, based on the location of the OSB server (http://[OSBServer]:[Port]) and the endpoint URI specified in the proxy service (that is, /basic-osb-service/proxy/CustomerService). We need to concatenate the two and add the suffix ?wsdl to get the WSDL URL of the OSB proxy service:

http://localhost:7001/basic-osb-service/proxy/CustomerService?wsdl.

How to do it...

In soapUI, perform the following steps:

  1. In the File menu, select New soapUI Project.

  2. Enter the URL of the WSDL, for the service to be tested (http://localhost:7001/basic-osb-service/proxy/CustomerService?wsdl) into the Initial WSDL/WADL field.

  3. Enter CustomerService into the Project Name field.

  4. Click on the OK buton.

    SoapUI will analyze the WSDL and creates a project with some initial requests for all operations defined by the WSDL. Still in soapUI, perform the following steps:

  5. Expand the project in the Navigator on the left.

  6. Double-click on the Request 1 entry of the RetrieveCustomerByCriteria operation.

  7. A new window for the Request 1 will open in the details section.

  8. Replace the ? character in the request message on the left by the input parameter values for the test. The following screenshot shows the request with the ? characters replaced:

  9. Click on the green arrow to start the test.

  10. Check that a valid customer is returned in the response window on the right.

  11. Save the soapUI project so that it is available to use later.

How it works...

Thanks to the standardization through web services, a tool such as soapUI can create the right requests for a service just by analyzing the provided WSDL of the service. SoapUI creates requests for each operation of the service. These requests are persisted in the soapUI project and they can be combined into a test suite. This allows them to be automatically executed, that is, they can be used together with continuous integration.

There's more...

SoapUI is very powerful and it's worth checking the online documentation available on their website (http://www.soapui.org). In any real-live project work, we suggest you to look at the pro version as well. It simplifies a lot of the service testing even further.

Validate that the response is correct

In soapUI, perform the following steps to validate the response from the proxy service against the XML schema in the WSDL:

  1. Right-click on the response message window and select Validate.

  2. Either a pop-up window will appear indicating that the XML message is valid or the validation errors will be displayed in a window below the response message, as shown in the following screenshot:

Creating another request for the same operation

SoapUI supports more than one request per operation, so that a request can be created for each test case to be executed. It's recommended to properly name the different requests in order to be able to identify them later and to clearly indicate the case tested by a given request.

To rename a request, just right-click on the request and select Rename.

An existing request can also be cloned. This reduces the amount of work necessary to correctly set up all the information in the request message. To create a copy of a request, right-click on the request and select Clone Request.

To create a new request from scratch, right-click on the operation and select New request.

See also

To learn more about soapUI check their website: http://www.soapui.org/. There is also a pro version available, which has a lot more interesting features, a lot of them simplifying the use of soapUI for web service testing.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime