Transforming Business Logic into Web Services Using DB2 9.5 and IBM Data Studio - Page 4

November 17, 2008

What about wrapping my stored procedures as Web services?

Earlier in this article, I mentioned that you could wrap Web services around stored procedures or SQL statements. In “DB2 9.5 and IBM Data Studio Part 10: Building Stored Procedures” I showed you how to create and deploy a stored procedure using the FEMALEPERSONNEL SQL statement built earlier in this series. The method by which you build and deploy a Web service that wraps a stored procedure is the same as shown earlier in this article for an SQL statement; the obvious difference is that you drag a stored procedure instead of an SQL statement.

If you completed all the steps in Part 10, when you expand the SAMPLE database in the Database Explorer view, the Stored Procedures folder should include the SP_FEMALEPERSONNEL stored procedure:

when you expand the SAMPLE database in the Database Explorer view, the Stored Procedures folder should include the SP_FEMALEPERSONNEL stored procedure

If you want to expose the SP_FEMALEPERSONNEL stored procedure through a Web service, just drag the stored procedure to the same folder you used for the SQL statement in Step 3 of this article. In this case, since you are working with a routine that has been deployed to a data server, expand that data server’s connection object and locate the stored procedure in the Stored Procedures folder within the Data Project Explorer view:

expand that data server's connection object and locate the stored procedure in the Stored Procedures folder within the Data Project Explorer view

To add this stored procedure to your Web service, you would simply drag the stored procedure to the SOA_FEMALEPERSONNEL folder, and then build and deploy the Web service in the same manner (and using the same options) as you did in Step 7.

Upon the successful redeployment of the Web service, you can now see that both the SQL statement and the stored procedure (which return the same result) are now part of the Web service and part of the Web Services Explorer:

you can now see that both the SQL statement and the stored procedure (which return the same result) are now part of the Web service and part of the Web Services Explorer

You can see that the Navigator pane in the Web Services Explorer now includes the SP_FEMALEPERSONNEL stored procedure. If you wanted to test the Web service invocation of the stored procedure, you would simply follow the instructions in Step 8.

Wrapping it all up

In this article, I showed you how to take the FEMALEPERSONNEL SQL statement that you built earlier in this series and turn it into a Web service using mere clicks of a button. Did you notice that you didn’t have to write a single line of code? In my opinion, IBM Data Web Services is truly unique in its capability and ease of use when trying to pursue a service-oriented architecture development paradigm.

I only showed you the most basic way to test a single (SOAP) invocation of your newly created Web service. In the next parts of this series, I’m going to take you through the different test clients provided by IBM Data Studio for you to test your Web services, and explain how to test a RESTful invocation of your Web service directly using a Web browser.

» See All Articles by Columnist Paul C. Zikopoulos

Trademarks

IBM, DataPower, DB2, DB2 Universal Database, i5/OS, Informix, WebSphere, and z/OS are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both.

Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.

Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.

Microsoft is a trademark of Microsoft Corporation in the United States, other countries, or both.

UNIX is a registered trademark of The Open Group in the United States and other countries.

Other company, product, or service names may be trademarks or service marks of others.

Copyright International Business Machines Corporation, 2008.

Disclaimers

The opinions, solutions, and advice in this article are from the author’s experiences and are not intended to represent official communication from IBM or an endorsement of any products listed within. Neither the author nor IBM is liable for any of the contents in this article. The accuracy of the information in this article is based on the author’s knowledge at the time of writing.








The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers