cancel
Showing results for 
Search instead for 
Did you mean: 

Soap message with Attachment

0 Kudos

Hi All,

I have a requirement wherin I have to send an attachment(image) along with the soap payload.i.e. the soap message contains the payload and an attachment.For eg. the soap message is as shown below:

<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Body>
    <ns1:MT_Soap xmlns:ns1="http://www.adc.com/sample">
         <Record>
            <FieldXML>abc</FieldXML>
            <FieldAthmt />
         </Record>
      </ns1:MT_Soap>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

How can I include the attachment(which is on a local machine) in the above soap message?

Is it posssible to send the attachment in the field "FieldAtthmt"?

If it is possible to send an attachment with the soap message then how can that attachment be handled in XI?

Thanks in advance,

Vikram

Accepted Solutions (0)

Answers (3)

Answers (3)

aashish_sinha
Active Contributor
0 Kudos

Hi,

A SOAP message may need to be transmitted together with attachments of various sorts, ranging from facsimile images of legal documents to engineering drawings. Such data are often in some binary format. For example, most images on the Internet are transmitted using either GIF or JPEG data formats. In this document we describe a standard way to associate a SOAP message with one or more attachments in their native format in a multipart MIME structure for transport.

yes it is possible to send attachment with the SOAP.

SOAP Message Packages

A "SOAP message package" contains a primary SOAP 1.1 message. It may also contain additional entities that are not lexically within the SOAP message but are related in some manner. These entities may contain data in formats other than XML. The primary SOAP 1.1 message in a message package may reference the additional entities. Such additional entities are often informally referred to as "attachments." This section describes how to construct SOAP message packages and how SOAP processors will process them.

A SOAP message package is constructed using the Multipart/Related media type, which is defined in RFC 2387. The rules for the construction of SOAP message packages are as follows:

The primary SOAP 1.1 message must be carried in the root body part of the Multipart/Related structure. Consequently the type parameter of the Multipart/Related media header will always equal the Content-Type header for the primary SOAP 1.1 message, i.e., text/xml.

The MIME Multipart/Related encapsulation of a SOAP message is semantically equivalent to a SOAP protocol binding in that the SOAP message itself is not aware that it is being encapsulated. That is, there is nothing in the primary SOAP message proper that indicates that the SOAP message is encapsulated .

For more details you can refer these links

http://www.w3.org/TR/SOAP-attachments

http://www.w3.org/TR/soap12-af/

regards

Aashish Sinha

PS : reward points if helpful

0 Kudos

Thank you for your reply,

But with reference to the above links I have changed my code accordingly as shown below

<?MIME-Version = "1.0">
Content-Type: Multipart/Related; boundary=MIME_boundary; type=text/xml;
       start="<http://hydhtc65586/data/rtth.JPG>"
Content-Description: This is the optional message description.

<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Body>
    <ns1:MT_Soap xmlns:ns1="http://www.adc.com/sample">
         <Record>
            <FieldXML>abc</FieldXML>
            <FieldAthmt> href="http://hydhtc65586/data/rtth.JPG"</FieldAthmt>
         </Record>
      </ns1:MT_Soap>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Content-Type: image/jpg
Content-Transfer-Encoding: binary
Content-ID: <http://hydhtc65586/data/rtth.JPG>
Content-Location:http://hydhtc65586/data/rtth.JPG

But on the target side the url is being mapped to the field"FieldAtthmt" instead of the image being created.

How can I know whether the image file is being parsed by XI if the baove code is correct.If not please correct the code.

Thanks,

Vikram

venkatanarayana_vagu
Active Participant
0 Kudos

Hello,

Remove the tag image field.

0 Kudos

Than how can the attachment be parsed through XI i.e how can I handle the attachment in XI.

Former Member
0 Kudos

Hi Plese check check the link below

http://dev2dev.bea.com/pub/a/2004/05/websvcs_nottingham.html

Ps: Please give point if helpful

Former Member
0 Kudos

Plase check the link below

The attachment (image) is in tag <theSignedForm>

<theSignedForm href="cid:claim.tiff(at)claiming-it.com"/>

MIME-Version: 1.0

Content-Type: Multipart/Related; boundary=MIME_boundary; type=text/xml;

start="<claim.xml(at)claiming-it.com>"

Content-Description: This is the optional message description.

--MIME_boundary

Content-Type: text/xml; charset=UTF-8

Content-Transfer-Encoding: 8bit

Content-ID: <claim.xml(at)claiming-it.com>

<?xml version='1.0' ?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

<SOAP-ENV:Body>

..

<theSignedForm href="cid:claim.tiff(at)xyz.com"/>

..

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

--MIME_boundary

Content-Type: image/tiff

Content-Transfer-Encoding: binary

Content-ID: <claim.tiff(at)claiming-it.com>

d3d3Lm1hcmNoYWwuY29taesgfSEVFES45345sdvgfszd==

MIME_boundary