Thursday, August 21, 2008

FAQs at some of my presentations

This year the student's presentation I'm delivering as part of the DB2 on Campus program is titled "Web 2.0 and DB2 demos". I first explain in simple terms the concepts of SOA, Web 2.0, XML, and pureXML technologies. Then I mention two approaches of free application development. One of them uses a J2EE approach with free (and some open source) software like Linux/Eclipse/DB2 Express-C/WAS-CE. These are used to develop Web Services. The other free application development approach is to use open source languages like RoR or PHP with DB2 Express-C.

For the first approach, I show a live demo to create data web services using IBM Data Studio (an Eclipse-based tool), which connects to a DB2 Express-C database, deploying the Web service on a WAS-CE app server (that comes as separate install image in IBM Data Studio). This demo was created by the team led by Michael Schenker (IBM Data Web Services and SOA Team Lead) and it's recorded on a video in channeldb2.com. I'm including below answers to some of the typical questions I encounter when showing this demo live. Thanks again to Michael for helping out with this information!:

Q1.
The data Web Services created with IBM Data Studio and deployed to WAS-CE were invoked from a browser for the REST version. How about the SOAP version?

A1.
Web Browsers do not support SOAP right away - however - you could (under certain circumstances) use some JavaScript (e.g. the XmlHttpRequest object) to call the Web Service using SOAP. You need to be aware of the browser's cross-host-scripting security issues - the JavaScript which executes the XmlHttpReuqest against the service needs to be hosted at the same Web-/Application server as the Web Service itself - otherwise the browser will block the request.

Q2.
How about invoking the Web Service from an application?

A2.
There are several different ways how you can call (consume) a Web Service. You can use simple HTTP calls from different programming languages. For example, a Java program can simply use the plain Java HTTP API to call the service. You could also use some tool you feed the WSDL with and which generates you some Web service client skeleton code (e.g. wsdl2java - Axis 2 or wsdl.exe - MS .NET). You can also use some pre-build tools like curl. Also for this tool you would need to know how the request XML document has to look like.

There are also Web Service consumer UDFs you can use in DB2 as documented here. You could invoke these UDFs from an application. If you plan to use these UDFs, ensure you work with them starting with DB2 9.5 fixpack 2 (to be available soon). Prior to this fixpack the UDFs were broken in DB2 9.5.

Q3.
How do you call the stored procedure operation in the Web service from a browser directly from the URL? I think for the REST version is just like passing parameters in Http-post/get. How is it done in SOAP?

A3.
As soon as you made the SQL statement or stored procedure call a Web service operation there is no distinction between an operation with an SQL statement behind or one which has a stored procedure call. In both cases input values (which are host variables in case for SQL statements and in or in/out parameters in case of stored procedures) you either provide them as key/value pairs (when using HTTP/GET or POST) or inside the SOAP request.

Q4.
What about security issues with Data Web Services?

A4.
You can enable security when invoking Data Web Service operations using a J2EE security scheme, which is transport-level security. It requires application server-specific extensions inside the Data Web Services application.You can set up security using WAS (or the app server you use). If using WAS take a look at the following tutorials. Security is covered in part 2 and 3:

- Data Web Services on WAS - part 1
- Data Web Services on WAS - part 2
- Data Web Services on WAS - part 3

Cheers, Raul.

No comments: