Criando, Populando e Consumindo Advanced Queue com BPEL – Parte 1/3

Este post irá mostrar como você pode fazer uso das filas do banco de dados Oracle – Oracle Advanced Queue.
No cenário apresentado, é sugerida a integração entre dois sistemas, sendo que o Sistema A irá enfileirar as informações para que o serviço da camada Middleware faça o consumo e dispare os dados para o Sistema B.

A seguir você poderá criar uma nova fila com um tipo de dado definido, em seguida ela será populada com dados fixos utilizando PLSQL e por fim, em um processo BPEL assíncrono fazer o dequeue (consumo).

Construindo

Os passos a seguir são para construção da fila e definição da mensagem que será entregue ao consumidor.
Conecte no banco de dados Oracle e execute os scripts na sequência, no final deste artigo você poderá fazer download dos scripts.

Tipo que define a estrutura da mensagem que será adicionada a fila.

--
CREATE TYPE XXAR_KEY_INVOICE AS OBJECT (
    INVOICE_NUM         NUMBER(10),
    SOURCE_NAME         VARCHAR2(200),
    TOTAL_AMOUNT        NUMBER(15,2),
    DESCRIPTION         VARCHAR2(500))
/

Criação da Queue Table, associada ao tipo (estrutura da mensagem).

--
Begin
 DBMS_AQADM.create_queue_table( queue_table => 'XXAR_INVOICE', -- nome da QTable
                                queue_payload_type => 'XXAR_KEY_INVOICE' -- tipo mensagem da QTable
                              );
End;
/

Criação da fila vinculada com a tabela controladora dos registros que serão adicionados a fila.

--
Begin
 DBMS_AQADM.create_queue(queue_name => 'XXAR_INVOICE_QTAB', -- nome da Queue
                         queue_table => 'XXAR_INVOICE' -- Tabela controladora da Queue
                         );
End;
/

Iniciando a fila.

--
Begin
  DBMS_AQADM.start_queue( queue_name => 'XXAR_INVOICE_QTAB' );
End;
/
CREATE OR REPLACE TYPE XXAR_KEY_INVOICE_T AS TABLE OF XXAR_KEY_INVOICE;
/

Pronto, agora conseguimos criar a AQ com um tipo de dado complexo definido.
Como você deve ter percebido toda a criação da fila faz uso da API core DBMS_AQADM. Para o nosso próximo passo que é o envio de mensagens para a fila (enqueue), será necessário a DBMS_AQ.

Downloads

[]‘s

Instalando Oracle Database 10.2 32bit no Windows 7 64bit

Este vídeo é muito util pra você que precisa instalar o Oracle Client (ou Enterprise) no Windows 7[bb] plataforma 64bit e utilizar como IDE o PLSQL Developer (versões 7 ou 8) e SQL Navigator 6.

Assista o vídeo até o final para entender que mesmo depois do banco de dados instalado é necessário configurar as IDEs.

 

 

Créditos ao senhor Alam.

PLSQL consuming Web Services

This is a simple sample, how to do to consuming Web Services from Oracle database using PL/SQL. This tutorial was tested in Oracle database versions 9i, 10g and 11g.

The Web Services used is avaliable in webservicex.net, see this link, there are more details.

declare
 soap_request  varchar2(30000);
 soap_respond  varchar2(30000);
 http_req      utl_http.req;
 http_resp     utl_http.resp;

 l_launch_url varchar2(240) := 'http://www.webservicex.net/geoipservice.asmx?WSDL';
 l_soap_action varchar2(240) := 'http://www.webservicex.net/GetGeoIP';
 l_ip varchar2(100) := '189.100.4.198'; // IP just for test

Now, second step you have to build the SOAP request it’s may be boring if you parameter list too long, so you can use the soapUI to test and prepared the string of requisition.

begin

soap_request :=
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webservicex.net/">
 <soapenv:Header/>
 <soapenv:Body>
 <web:GetGeoIP>
 <web:IPAddress>'|| l_ip || '</web:IPAddress>
 </web:GetGeoIP>
 </soapenv:Body>
</soapenv:Envelope>
';
 dbms_output.put_line(soap_request);
 HTTP_REQ:= UTL_HTTP.BEGIN_REQUEST(l_launch_url, -- web services url
 'POST',
 'HTTP/1.1');
 UTL_HTTP.SET_HEADER(HTTP_REQ,'Content-Type', 'text/xml'); -- since we are dealing with plain text in XML documents
 UTL_HTTP.SET_HEADER(HTTP_REQ,'Content-Length', length(soap_request));
 UTL_HTTP.SET_HEADER(HTTP_REQ,'SOAPAction' , l_soap_action); -- required to specify this is a SOAP communication
 UTL_HTTP.WRITE_TEXT(HTTP_REQ, SOAP_REQUEST);
 HTTP_RESP := UTL_HTTP.GET_RESPONSE(HTTP_REQ);
 UTL_HTTP.READ_TEXT(HTTP_RESP, SOAP_RESPOND);
 UTL_HTTP.END_RESPONSE(HTTP_RESP);

 dbms_output.put_line('-------------------------');
 dbms_output.put_line(soap_respond); -- here is the response
end;

Okay, that’s the cake recipe…

Enjoy it.

JDeveloper with Maven 2

The best IDE to development Java isn’t the JDeveloper, it’s a fact.
Sometimes we have using it same we don’t like it, whatever, if you are in this situation, I told you, use Maven.

Maven is a wonderful open-source tool, you can see more here.
Since Jdeveloper 11.1.1 version provide support to Maven, you just to install a extention. Some peoples wrote about it as Shay Shmeltzer and Aino Andriessen, two great names of Oracle’s world.

See into this link how to do to integrate Jdeveloper with Maven 2, it’s easy and fast.
Remember, you have setup application pom.xml file with that plugin, it’s very important, like this:

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.myfaces.trinidadbuild</groupId>
<artifactId>maven-jdev-plugin</artifactId>
</plugin>
</plugins>
</build>

Now, my two cents here. After install maven and jdeveloper setup you may know some commands.

To clean up project’s target.

mvn clean

To compile and build the target.

mvn install

And as last but very important. This command prepared the .jpr files with pom.xml configuration to work with JDeveloper.

mvn -Djdev.release=11.1.1.3.0 org.apache.myfaces.trinidadbuild:maven-jdev-plugin:jdev

I think it’s will fix your problem between Maven and Jdev.
Have fun.

Startup error Weblogic running on Windows 7 64bit

Hello there, this is my first post in english so I will try keep the same content but now writing in english, just for fun, I hope this work and I can talk with you fine… well that’s all.

Since last week I trying deploy an application in Weblogic Server 10.3.3 using Spring + CXF + Hibernate, I found many problems, the most of problems is incompatibility between classpath Weblogic and libraries application. My intention is make a post about this problem and how I fixed it…t

Well, Weblogic Server running in Windows 7 64bit after instalation and creation of domain, I found this error message in command prompt when I try start Weblogic:

QTJava.zip was unexpected at this time.
\user_projects\domains\base_domain>

I think this is a common problem in 64bit platform, I don’t why, however easily I fixed it go to domain directory in Weblogic installation, and edit startWebLogic.cmdC:\Oracle\Middleware\user_projects\domains\base_domain – see:

set DOMAIN_HOME=C:\Oracle\Middleware\user_projects\domains\base_domain
set CLASSPATH=
call “%DOMAIN_HOME%\bin\startWebLogic.cmd” %*

Only setting CLASSPATH like null.

But, this isn’t enough, again I don’t why, but you have change CLASSPATH system setting up QTJava.zip see link below to understand.

http://forums.oracle.com/forums/thread.jspa?threadID=922895

See image with my CLASSPATH system.

If same after you did this and the link “Start Admin Server for Weblogic Server Domain” from start menu not work, go to domain directory and execute startWebLogic.cmd file from there, it’s will work.