Solved

Web Service in Stored Procedure

Posted on 2013-01-22
4
938 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Change the sort Order 5 263
how to get the substring vaule in db2 11 302
Leveraging AD Groups in DB2 1 83
db2 != check 14 54
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

810 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