Print Page

Thursday, November 6, 2008

Attachment feature in ebMS using Oracle AS B2B 10g

These steps help in sending attachments in ebMS.

1. Create an xml in UNIX FILE FORMAT. Here is the sample xml file,

<?xml version="1.0" encoding="UTF-8"?>
<Attachments xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="AttachmentsDescriptor.xsd" version="1.0" boundary="boundary---">
<AttachmentPart>
<Location>file:///scratch/nansrini/test.pdf</Location>
<Content-Type>
<Top-Level-Type>application</Top-Level-Type>
<Sub-Type>pdf</Sub-Type>
</Content-Type>
</AttachmentPart>
</Attachments>


2. Edit the enq.properties to provide the file name for the "attachment" attribute as the above file(sample xml).

3. Provide directory name in tip.properties for the key "oracle.tip.adapter.b2b.attachments.dir" where the file will be stored in the inbound scenario.
4. Restart the server and enqueue the Message.
5. By Default oracle.tip.adapter.b2b.MimeType accepts only below types,

@ application/xml
@ application/octet-stream
@ application/EDIFACT
@ application/EDI-X12
@ application/jpg
@ image/jpeg
@ application/gzip
@ application/x-gzip
@ application/pkcs7-signature

If you want more options, Then you must modify tip.properties in
$ORACLE_HOME/ip/config directory to include your MimeTypes also, For example,
You want to include pdf attachments, Then your tip.properties would look like,

oracle.tip.adapter.b2b.MimeType=application/xml : application/octet-stream : application/EDIFACT : application/EDI-X12 : application/jpg : image/jpeg :
application/gzip : application/x-gzip : application/pkcs7-signature :
application/pdf

Ensure the above property in single line.

Add a new content type such as application/pdf restart opmn and re-try testcase.

2 comments:

Anonymous said...

I need to download AttachmentsDescriptor.xsd that is mentioned in above Sample xml file. Please advise.

Nandhu said...

Please find the below AttachmentsDescriptor.xsd,

<?xml version="1.0" encoding="UTF-8" ?>
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:element name="AttachmentPart">
- <xs:complexType>
- <xs:sequence>
<xs:element ref="Location" />
<xs:element ref="Content-Type" />
<xs:element ref="Content-ID" />
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="Attachments">
- <xs:complexType>
- <xs:sequence>
<xs:element ref="AttachmentPart" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="version" type="xs:NMTOKEN" use="required" />
<xs:attribute name="xsi:noNamespaceSchemaLocation" type="xs:string" use="required" />
<xs:attribute name="boundary" type="xs:NMTOKEN" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Content-ID" type="xs:string" />
- <xs:element name="Content-Type">
- <xs:complexType>
- <xs:sequence>
<xs:element ref="Top-Level-Type" />
<xs:element ref="Sub-Type" />
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="Location">
<xs:complexType mixed="true" />
</xs:element>
- <xs:element name="Sub-Type">
<xs:complexType mixed="true" />
</xs:element>
- <xs:element name="Top-Level-Type">
<xs:complexType mixed="true" />
</xs:element>
</xs:schema>