09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Deploying the AQ XML Servlet<br />

The AQ XML Servlet accepts requests with Content-Type "text/xml" or<br />

application/x-www-form-urlencoded. When the Content-Type request is set<br />

to application/x-www-form-urlencoded, you must set the parameter name<br />

to aqxmldoc and the value must be the URL-encoded AQ XML document.<br />

Creating the AQ XML Servlet Class<br />

The AQ servlet creates a JDBC OCI connection pool to connect to the <strong>Oracle</strong>9i<br />

server. The init() method of the servlet must specify an AQxmlDataSource<br />

object that encapsulates the database connection parameters and the username and<br />

password. See the <strong>Oracle</strong>9i Supplied Java Packages Reference for information on the<br />

AQxmlDataSource class.<br />

The user specified in the AQxmlDataSource is the AQ servlet super-user. This<br />

user must have CREATE SESSION privilege and EXECUTE privilege on the DBMS_<br />

AQIN package.<br />

Example:<br />

Create a user AQADM as the AQ servlet superuser as follows:<br />

connect sys/change_on_install as sysdba;<br />

grant connect, resource to aqadm identified by aqadm;<br />

grant create session to aqadm;<br />

grant execute on dbms_aqjms to aqadm;<br />

A sample servlet can be created using this superuser as follows:<br />

import javax.servlet.*;<br />

import javax.servlet.http.*;<br />

import oracle.AQ.xml.*;<br />

/**<br />

* This is a sample AQ Servlet.<br />

*/<br />

public class AQTestServlet extends oracle.AQ.xml.AQxmlServlet<br />

{<br />

/* The init method must be overloaded to specify the AQxmlDataSource */<br />

public void init()<br />

{<br />

AQxmlDataSource db_drv = null;<br />

try<br />

{<br />

Internet Access to <strong>Advanced</strong> <strong>Queuing</strong> 17-49

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!