Solved

Web Service in Stored Procedure

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

628 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