Perl Cd Bookshelf [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Perl Cd Bookshelf [Electronic resources] - نسخه متنی

Mark V. Scardina, Ben ChangandJinyu Wang

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید






Using SOAP and the Oracle Database

Using the Oracle Database with SOAP as the underlying messaging protocol to queue and operate on messages from applications working on top of the database allows all the traditional features, such as performance, scalability, security, high reliability, and recoverability, to be associated with such messages. In addition, an Oracle Advanced Queuing (AQ) servlet allows clients to interpret and communicate with the back-end database to extract information and to retrieve, update, enqueue, and dequeue these messages, which are stored in message queue tables in the database.

Finally, allowing AQ messages in SOAP format and the XML-based Internet Data Access Presentation (iDAP) formats allows transformation, extraction, and other standards-based operations associated with XML to occur.


Oracle Streams AQ Support


Oracle’s AQ acts as the hub for either native XML or XML defined using iDAP, meaning that such messages can be sent over HTTP or SMTP protocols. In either case, clients such as browsers and servers such as Oracle can communicate through enqueue, dequeue, publish, and register functionality encapsulated by Oracle-specific tags such as AQXMLSend, AQXMLReceive, AQXMLPublish, AQXMLRegister, AQXMLReceiveResponse, AQXMLPublishResponse, AQXMLNotification, and along with other required elements. For example, a client can construct the following iDAP XML message and send it over HTTP to be processed by Oracle:

<?xml version="1.0"?>
<Envelope xmlns=http://www.oracle.com/schemas/IDAP/envelope>
<Body>
<AQXMLSend xmlns=http://www.oracle.com/schemas/AQ/access>
<!-- mandatory -->
<producer_options>
<!--mandatory -->
<destination>BOOKLIST.BOOK_QUEUE</destination>
</producer_options>
<!—- mandatory
<message_set>
<message>
<message_number>1</message_number>
<!—- mandatory -->
<message_header>
<correlation>BOOK</correlation>
<sender_id>
<agent_name>Juan</agent_name>
</sender_id>
</message_header>
<message_payload>
<Book>
<Title>Introducing XML</Title>
<Author_Lastname>Smith</Author_Lastname>
<ISBN>11-0342000123</ISBN>
</Book>
</message_payload>
</message>
</message_set>
</AQXMLSend>
</Body>
</Envelope>

In this manner, messages can be intelligently managed, so that data about them can be extracted at a later point to help in configuring the architecture and viewing the messages through SQL.


AQ Servlet


Oracle Advanced Queuing (AQ) is a database facility that provides an integrated message queuing capability, enabling and managing asynchronous communication between applications using Oracle messaging formats. The AQ servlet is simply a servlet that operates in the middle tier that acts on AQ messages in both SOAP format and the IDAP format, a format that uses XML for the data representation and HTTP and e-mail protocols as the transport mechanism. The servlet then can interpret the incoming message from the client and communicate back to it, and can connect to the Oracle database from the middle tier to perform operations on the message queues.


Enqueuing and Dequeuing Messages


To begin with, Oracle message queues can be created with messages that contain XML messages—these are encapsulated by the XMLType data type. To do this, a queue table is created using the dbms_aqadm.create_queue_table call, with the queue_payload_type as SYS.XMLType; the table can be populated via the dbms_aqadm.create_queue call. For example, a book order queue table and a queue with different priorities could be created in PL/SQL via the following code.

BEGIN

EXECUTE dbms_aqadm.create_queue_table (
queue_table => 'book_order_table',
sort_list => 'book_order, 'ship_book_order',
comment => 'book order message queue table',
multiple_consumers => TRUE,
queue_payload_type => 'SYS.XMLType',
compatible => '8.1',
primary_instance => 2,
secondary_instance => 1);

END;
BEGIN

EXECUTE dbms_aqadm.create_queue (
queue_name => 'book_order_queue',
queue_table => 'book_order_table');

END;

To enqueue a message using SOAP, the following could be an XML representation of the message:

<?xml version="1.0"?>
<Envelope xmlns=http://schemas.xmlsoap.org/soap/envelope/>
<Body>
<AQXmlSend xmlns=http://ns.oracle.com/AQ/schemas/access>
<producer_options>
<destination>book.book_order_queue</destination>
</producer_options>
<message_set>
<message_count>1</message_count>
<message>
<message_number>1</message_number>
<message_header>
<correlation>order1</correlation>
<priority>1</priority>
<sender_id>
<agent_name>JuanL</agent_name>
</sender_id>
</message_header>
<message_payload>
<BOOKORDER_TYPE>
<BOOKORDER>5</BOOKORDER>
<BOOKORDER_SHIP>5</BOOKORDER_SHIP>
<BOOKCUSTOMER>
<BOOKCUSTOMER_ID>99999999</BOOKCUSTOMER_ID>
<BOOKCUSTOMER_LASTNAME>Loaiza</BOOKCUSTOMER_LASTNAME>
<BOOKCUSTOMER_STREET>1 Oracle Parkway</BOOKCUSTOMER_STREET>
<BOOKCUSTOMER_CITY>Redwood Shores</BOOKCUSTOMER_CITY>
<BOOKCUSTOMER_STATE>California</BOOKCUSTOMER_STATE>
<BOOKCUSTOMER_ZIP>94065</BOOKCUSTOMER_ZIP>
<BOOKCUSTOMER_COUNTRY>USA</BOOKCUSTOMER_COUNTRY>
</BOOKCUSTOMER>
<BOOKTITLE>Oracle and XML</BOOKTITLE>
<BOOKID>3333333333333</BOOKID>
<BOOKPRICE>49.99</BOOKPRICE>
</BOOKORDER_TYPE>
</message_payload>
</message>
</message_set>
<AQXmlCommit/>
</AQXMlSend>
</Body>
</Envelope>

To dequeue a message using SOAP, the following could be an XML representation of the message:

<?xml version="1.0"?>
<Envelope xmlns=http://schemas.xmlsoap.org/soap/envelope/>
<Body>
<AQXmlReceive xmlns=http://ns.oracle.com/AQ/schemas/access>
<consumer_options>
<destination>book.book_order_queue</destination>
<consumer_name>JuanL</consumer_name>
<wait_time>0</wait_time>
<selector>
<correlation>order1</correlation>
</selector>
</consumer_options>
<AQXmlCommit/>
</AQXmlReceive>
</Body>
</Envelope>


Using SOAP from PL/SQL


PL/SQL Java stored procedures that encapsulate SOAP services are invoked in exactly the same manner as any other Java stored procedure. The SOAP JAVA jar file created during the translation/deployment of a PL/SQL package is also needed on the client side to compile application programs that invoke the SOAP service. As in the example given above, the basics are to declare a set of variables to represent the request and the response, and to declare the XMLType that would represent the message itself. Since this is more RPC-style, PL/SQL functions would be created to build a SOAP message body and envelope, build a SOAP request to invoke a web service, invoke the web service, process any SOAP faults or exceptions, and possibly extract information from the returned SOAP message.

/ 218