Solved

Web Service in Stored Procedure

Posted on 2013-01-22
4
915 Views
Last Modified: 2013-01-23
Hi,

  I have a web service that takes an input variable and displays an output variable.
  Can i embed this webservice in a DB2 stored Procedure and do some manipulations on my side? I'm on DB2 9.7

Thanks!
0
Comment
Question by:pvsbandi
  • 2
  • 2
4 Comments
 
LVL 34

Expert Comment

by:Gary Patterson
ID: 38809590
DB2 UDB 9.7 supports external stored procedures, which means you can write stored procedures in C,C++, Java, .NET CLR languages,or COBOL.

So, yes, you can certainly create a stored procedure that calls a web service.

- Gary Patterson
0
 

Author Comment

by:pvsbandi
ID: 38810426
Thanks! Do you have any example you can share with me?
0
 
LVL 34

Accepted Solution

by:
Gary Patterson earned 500 total points
ID: 38810616
I usually work on DB2 on IBM i, and so things may be a little different on other platforms.  I looked at the DB2 UDB 9 Info Center, and the process looks very similar, though.

Basically you need two things:

1)  Write a program that consumes the web service.  Normally you would use an integrated development tool like NetBeans or Visual Studio to take the web service WSDL and generate a skeleton program.  You alter the skeleton to do what you want (at a minimum you will probably need to build a parameter interface so you can pass parms when calling as a stored procedure).

2) Once that is tested and working, you'll need to use the DB2 CREATE PROCEDURE statement to create a stored procedure interface for the external program (Java, .NET, whatever).

Here are tutorials on create a simple web service, and then how to consume that web service:

Java:

http://netbeans.org/kb/docs/websvc/jax-ws.html

C#.NET:

http://johnwsaunders3.wordpress.com/2009/05/17/how-to-consume-a-web-service/

Here is the DB2 UDB 9 Info Center topic on External Stored Procedures:

http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=%2Fcom.ibm.db2.udb.apdv.sql.doc%2Fdoc%2Fc0020569.htm

Hope that helps.

- Gary Patterson
0
 

Author Closing Comment

by:pvsbandi
ID: 38811343
Thanks! Great help!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now