Tuesday, May 31, 2016

How to Enqueue messages in Oracle B2B 10g

Login to B2B DB and Execure following SQL. Check instances in BPEL console..

DECLARE
enqueue_options dbms_aq.enqueue_options_t;
message_properties dbms_aq.message_properties_t;
msg_handle RAW(16);
ipmsg IP_MESSAGE_TYPE; /* xml_payload varchar2(30000); */
xml_clob clob;
msg_id number(10);
subscribers dbms_aq.aq$_recipient_list_t;
BEGIN
select message_seq.nextval into msg_id from dual; /* xml_payload :='<?xml version="1.0" encoding="UTF-8"?>'; */
xml_clob := '<Transaction-850 XDataVersion="1.0" Standard="X12" Version="V4010" CreatedDate="2015-11-04T13:10:05" CreatedBy="ECXEngine_837" GUID="{6FF097A6-8338-11E5-AD8F-005056927AFA}" xmlns="urn:oracle:integration:b2b:BE11ASDFDFGDFGDF$%9C4AC9ECD7CF09DF" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <Internal-Properties>
      <Data-Structure Name="Interchange">
         <Lookup Name="InterchangeSenderQual">12</Lookup>
         <Lookup Name="InterchangeSenderID">78254675</Lookup>
         <Lookup Name="InterchangeReceiverQual">ZZ</Lookup>
         <Lookup Name="InterchangeReceiverID">MYCOMP</Lookup>
         <Lookup Name="InterchangeControlVersion">00401</Lookup>
         <Lookup Name="Standard">X12</Lookup>
         <Property Name="InterchangeAuthorizationInfoQual">00</Property>
         <Property Name="InterchangeAuthorizationInfo"></Property>
         <Property Name="InterchangeSecurityInfoQual">00</Property>
         <Property Name="InterchangeSecurityInfo"></Property>
         <Property Name="InterchangeSenderQual">12</Property>
         <Property Name="InterchangeSenderID">3423423423</Property>
        <Property Name="InterchangeReceiverQual">ZZ</Property>
         <Property Name="InterchangeReceiverID">MYCOMP</Property>
         <Property Name="InterchangeDate">151104</Property>
         <Property Name="InterchangeTime">1312</Property>
         <Property Name="InterchangeControlStandard_RepeatingSeparator">U</Property>
         <Property Name="InterchangeControlVersion">00401</Property>
         <Property Name="InterchangeControlNumber">000000005</Property>
         <Property Name="InterchangeAckRequested">0</Property>
         <Property Name="InterchangeUsageIndicator">T</Property>
         <Property Name="InterchangeComponentElementSep">0x3e</Property>
         <Property Name="DecimalSeparator"/>
         <Property Name="ElementDelimiter">0x2a</Property>
         <Property Name="ReleaseCharacter"/>
         <Property Name="RepeatingSeparator"/>
         <Property Name="SegmentDelimiter">0x7e</Property>
         <Property Name="SubelementDelimiter">0x3e</Property>
         <Property Name="InterchangeChildCount">1</Property>
         <Property Name="InterchangeTrailerControlNumber">000000005</Property>
         <Data-Structure Name="Group">
            <Lookup Name="GroupSenderID">7097458884</Lookup>
            <Lookup Name="GroupReceiverID">MYCOMP</Lookup>
            <Lookup Name="GroupVersionNumber">004010</Lookup>
            <Property Name="GroupID">PO</Property>
            <Property Name="GroupSenderID">7097458884</Property>
            <Property Name="GroupReceiverID">MYCOMP</Property>
            <Property Name="GroupDate">20151104</Property>
            <Property Name="GroupTime">1312</Property>
            <Property Name="GroupControlNumber">5</Property>
            <Property Name="GroupAgencyCode">X</Property>
            <Property Name="GroupVersionNumber">004010</Property>
            <Property Name="GroupChildCount">1</Property>
            <Property Name="GroupTrailerControlNumber">5</Property>
            <Data-Structure Name="Transaction">
               <Lookup Name="TransactionID">850</Lookup>
               <Property Name="TransactionID">850</Property>
               <Property Name="TransactionControlNumber">0001</Property>
               <Property Name="TransactionImplementationReference"/>
               <Property Name="TransactionChildCount">11</Property>
               <Property Name="TransactionTrailerControlNumber">0001</Property>
            </Data-Structure>
         </Data-Structure>
      </Data-Structure>
   </Internal-Properties>
   <Segment-ST>
      <Element-143>850</Element-143>
      <Element-329>0001</Element-329>
   </Segment-ST>
   <Segment-BEG>
      <Element-353>00</Element-353>
      <Element-92>NE</Element-92>
      <Element-324>0108696</Element-324>
      <Element-328 xsi:nil="true"/>
      <Element-373>20151015</Element-373>
   </Segment-BEG>
   <Loop-N1>
      <Segment-N1>
         <Element-98>BT</Element-98>
         <Element-93 xsi:nil="true"/>
         <Element-66>9</Element-66>
         <Element-67>7097458884</Element-67>
      </Segment-N1>
   </Loop-N1>
   <Loop-N1>
      <Segment-N1>
         <Element-98>ST</Element-98>
         <Element-93>AMC Inc.</Element-93>
         <Element-66>9</Element-66>
         <Element-67>0000</Element-67>
      </Segment-N1>
      <Segment-N3>
         <Element-166>xyz Avenue, Suite 901</Element-166>
      </Segment-N3>
      <Segment-N4>
         <Element-19>Vera</Element-19>
         <Element-156>NL</Element-156>
         <Element-116>A1N 4S2</Element-116>
      </Segment-N4>
   </Loop-N1>
   <Loop-PO1>
      <Segment-PO1>
         <Element-350>1</Element-350>
         <Element-330>2</Element-330>
         <Element-355_1>EA</Element-355_1>
         <Element-212>1313.5</Element-212>
         <Element-639 xsi:nil="true"/>
         <Element-235_1>UP</Element-235_1>
         <Element-234_1>3428423423</Element-234_1>
      </Segment-PO1>
   </Loop-PO1>
   <Loop-PO1>
      <Segment-PO1>
         <Element-350>2</Element-350>
         <Element-330>1</Element-330>
         <Element-355_1>EA</Element-355_1>
         <Element-212>1391.68</Element-212>
         <Element-639 xsi:nil="true"/>
         <Element-235_1>UP</Element-235_1>
         <Element-234_1>23423423423</Element-234_1>
      </Segment-PO1>
   </Loop-PO1>
   <Loop-PO1>
      <Segment-PO1>
         <Element-350>3</Element-350>
         <Element-330>2</Element-330>
         <Element-355_1>EA</Element-355_1>
         <Element-212>857.13</Element-212>
         <Element-639 xsi:nil="true"/>
         <Element-235_1>UP</Element-235_1>
         <Element-234_1>234234234</Element-234_1>
      </Segment-PO1>
   </Loop-PO1>
   <Loop-CTT>
      <Segment-CTT>
         <Element-354>3</Element-354>
         <Element-347>5</Element-347>
      </Segment-CTT>
   </Loop-CTT>
   <Segment-SE>
      <Element-96>11</Element-96>
      <Element-329>0001</Element-329>
   </Segment-SE>
</Transaction-850>';
subscribers(1) := SYS.AQ$_AGENT('X12_4010_850_PO', null, null);
message_properties.RECIPIENT_LIST := subscribers;
ipmsg := IP_MESSAGE_TYPE
(msg_id, null, 'TP_XML','Mycomp','Process_850', '850', '4010', 1, xml_clob, null);
dbms_aq.enqueue(queue_name => 'IP_IN_QUEUE', enqueue_options => enqueue_options, message_properties => message_properties, payload => ipmsg, msgid => msg_handle);
commit;
END;
/
show errors;