This chapter describes the utilities provided by Oracle B2B to send and receive business messages to and from Oracle B2B through the default AQ queue interface or the JMS queue interface.
Oracle B2B provides utilities to test and verify your installation and configuration before connecting to the host (back-end) applications. These utilities can be used to send and receive business messages to and from Oracle B2B through the default AQ queue interface or the JMS queue interface. Other AQ internal delivery channels can be handled in the same way. See the B2B samples for examples of how to implement these utilities (See Section 1.7, "Oracle B2B Samples and Cookbooks," for information about the samples.)
This chapter contains the following topics:
You can enqueue to and dequeue from an AQ queue using Java. IPEnqueue
and IPDequeue
must be executed in the Oracle B2B environment.
Table 23-1 lists the Java AQ enqueue utility (oracle.tip.b2b.data.IPEnqueue
) properties.
Table 23-1 IPEnqueue Properties
Name | Description |
---|---|
queue |
The outbound AQ queue name. If unspecified, the Java enqueue utility uses the default outbound queue |
replyToMsgID |
The message ID to which the sending message is replying, typically used for the response message type. |
from |
Trading partner that sends the message |
to |
Trading partner that receives the message |
doctypeName |
Document type name for the message |
doctypeRevision |
Document protocol revision for the message |
payload |
Payload file name |
attachment_name |
Attachment file name. Use this property to assign a name to the attachment file that is something other than the e-mail subject name. For a custom outbound message over e-mail with AQ do the following: actionName=ATTACHMENT_NAME:Sample.txt |
url |
The database URL format is |
user |
The database user |
password |
The database password |
eventName |
Action name |
msgID |
Message ID (optional). B2B generates its own message ID if it is not provided as part of an enqueue. |
msgType |
Provide an optional message type:
|
dateFormat |
Used to convert the date format used in e-mail delivery channel |
dynamicemail |
Provides the
actionName=DYNAMICEMAIL:email_id
|
dynamic_from_email |
Provides the
actionName=DYNAMIC_FROM_EMAIL:email_id
|
Example: ipenqueue.properties
queue = url = jdbc:oracle:thin:@host:1521:sid user = user1 password = password replyToMsgID = from = Acme to = GlobalChips doctypeName = 850 doctypeRevision = 4010 payload = Acme_850.xml attachment =
Note:
In Windows ja_JP locale instances, the VARCHAR/String values are not enqueued correctly to the queue. The INT and CLOB values are enqueued correctly. This causes some fields, such as the from
and to
fields, to be null when the IPEnqueue utility is used to enqueue a file. As a workaround, in ja_JP locales, orai18n.jar should be added to the classpath while using oracle.tip.b2b.data.IPEnqueue.
To dequeue messages, use the IPDequeue
utility.
Table 23-2 lists the Java AQ dequeue utility (oracle.tip.b2b.data.IPDequeue
) properties.
Table 23-2 IPDequeue Properties
Name | Description |
---|---|
queue |
The inbound AQ queue name. If unspecified, the Java dequeue utility uses the default inbound queue |
count |
The number of messages to dequeue. If unspecified, only one message is dequeued. |
output |
Output file name |
url |
The database URL format is |
user |
The database user |
password |
The database password |
Example: ipdequeue.properties:
queue = count = 1 output = t1.trc url = jdbc:oracle:thin:@host:1521:sid user = user1 password = password
You can enqueue to and dequeue from a JMS destination (queue or topic) using utilities. If a user name and password are not provided, the local JNDI is used, including in a clustered environment, provided that the destinations are distributed. Oracle B2B does not support javax.jms.ObjectMessage.
Use the JMS enqueue utility, oracle.tip.b2b.data.JMSEnqueue
, to send a message to a JMS destination (queue or topic). This utility expects a property file to be provided as a command-line argument where it reads the details to be sent.
Table 23-3 lists the properties that can be configured in the file.
Table 23-3 JMS Enqueue Properties
Name | Description |
---|---|
destination |
JNDI name of queue or topic to send message to |
cf |
JNDI name of connection factory to use |
factory |
Factory provider class |
isTopic |
Indicator for topic (optional) |
url |
The JNDI URL format is |
user |
The application server administrator userID. |
password |
The application server administrator password |
from |
From party |
to |
To party |
eventName |
Action name |
doctypeName |
Document type name |
doctypeRevision |
Document type revision |
payload |
Payload file path |
attachment |
Attachment file path |
msgID |
Message ID (optional). B2B generates its own message ID if it is not provided as part of an enqueue. |
replyToMsgID |
Reply to message (optional) |
msgType |
Message type; the default is |
attachment_name |
Attachment file name. Use this property to assign a name to the attachment file that is something other than the e-mail subject name. For a custom outbound message over e-mail with JMS do the following: constant : Sample.xml property : jca.jms.JMSProperty.ATTACHMENT_NAME |
dateFormat |
Used to convert the date format used in e-mail delivery channel |
dynamicemail |
Provides the
constant : email_id property : jca.jms.JMSProperty.DYNAMICEMAIL
|
dynamic_from_email |
Provides the
constant : email_id property : jca.jms.JMSProperty.DYNAMIC_FROM_EMAIL
|
Example 23-1 shows the sample jms_enqueue.properties
file.
Example 23-1 Sample jms_enqueue.properties File
####### Destination Details ####### destination = jms/b2b/B2B_IN_QUEUE cf = jms/b2b/B2BQueueConnectionFactory ####### Server and Factory Details ####### factory=weblogic.jndi.WLInitialContextFactory url=t3://host_name:port_number/ #user=<uncomment and provide you username> #password=<uncomment and proivde you password if required> ####### Payload Details ####### from=Acme to=GlobalChips #eventName=SampleEvent doctypeName=Custom doctypeRevision=1.0 payload=/scratch/work/GlobalChips_1234.dat
See the sample documentation for how to run these utilities.
The properties used by the AQ and JMS utilities are translated internally before the message is sent to the destination. Ensure that the properties in Table 23-4 are set as part of the javax.jms.Message
delivered to the destination that B2B listens on.
Table 23-4 How AQ/JMS Properties Are Translated for Custom Utilities
AQ/JMS Utilities | Translated Value—For Custom Utilities | JMS Message |
---|---|---|
from |
FROM_PARTY |
Sent as a |
to |
TO_PARTY |
Sent as a |
doctypeName |
DOCTYPE_NAME |
Sent as a |
doctypeRevision |
DOCTYPE_REVISION |
Sent as a |
eventName |
ACTION_NAME |
Sent as a |
msgID |
MSG_ID |
Sent as a |
replyToMsgID |
INREPLYTO_MSG_ID |
Sent as a |
msgType |
MSG_TYPE |
Sent as a |
attachment |
ATTACHMENT |
Sent as a |
payload |
- |
Sent as the message body |
The JMS dequeue utility, oracle.tip.b2b.data.JMSDequeue
, receives messages from the destination. The count
property can be specified to control the number of messages to be picked up from the destination. Retrieved messages are written to the file JMSDequeue.txt
at the current path (where you run the utility).
See the samples documentation on Oracle Technology Network for how to run these utilities.
Example 23-2 shows the sample JMS dequeue properties file.
Example 23-2 Sample jms_dequeue.properties File
####### Destination Details####### destination = jms/b2b/B2B_IN_QUEUE cf = jms/b2b/B2BQueueConnectionFactory count=1 ####### Server and Factory Details ####### factory=weblogic.jndi.WLInitialContextFactory url=t3://host_name:port_number/ #user=<uncomment and provide your username> #password=<uncomment and provide your password if required>
Use the attachmentsDescriptor.xsd
file for sending attachments.
Example 23-3 shows a sample attachment XML file.
Example 23-3 Sample Attachment XML File
<?xml version="1.0" encoding="ISO-8859-1"?> <!--Sample XML file generated by XMLSpy v2005 sp1 U (http://www.xmlspy.com)--> <Attachments xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="AttachmentsDescriptor.xsd" version="1.0" boundary="boundary---"> <AttachmentPart> <Location>file:///home/user_dir/data.xml</Location> <Content-Type> <Top-Level-Type>text</Top-Level-Type> <Sub-Type>plain</Sub-Type> <Parameter Value="charset" Name="us-ascii"/> </Content-Type> <!--Content-Transfer-Encoding>BASE64</Content-Transfer-Encoding--> <Content-ID/> <Content-Description/> </AttachmentPart> </Attachments>