Solved

Web Service in Stored Procedure

Posted on 2013-01-22
4
964 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 35

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 35

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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

752 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