Oracle Web Services On Demand Guide > Using Attachments with Web Services On Demand >

Retrieving or Querying File Attachments


When performing a query operation to retrieve attachment content, the response must contain Base64 encoded content. This is true even if the attached file is a simple text file. The attachment content must therefore be decoded back from Base64 to the binary or text format in all cases.

No content reuse is supported when performing a query. Even though the same file has been attached to multiple records, the response always generates unique ContentId values and the <Attachment> elements contain the attachment content.

The following SOAP response illustrates a query response for an attachment child:

<?xml version="1.0" encoding="UTF-8"?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<SOAP-ENV:Body>

<ns:AccountWS_AccountQueryPage_Output mlns:ns="urn:crmondemand/ws/account/10/2004">

<ns:LastPage>true</ns:LastPage>

<ListOfAccount xmlns="urn:/crmondemand/xml/account">

<Account>

   <AccountId>1QA2-L9DZG</AccountId>

   <Description>Account with attachment</Description>

   <Location>Toronto</Location>

   <AccountName>Test Account</AccountName>

   <ListOfAttachment>

      <Attachment>

         <DisplayFileName>My sales analysis</DisplayFileName>

         <FileNameOrURL>Analysis</FileNameOrURL>

         <FileExtension>xml</FileExtension>

         <AttachmentTag>FILE</AttachmentTag>

         <Description></Description>

         <Attachment AttachmentIsTextData="false" Extension="xml" ContentId="1QA2-RTX3">PD94bWwgdiVVRGLTgiPz48P1NpZWJlbC1Qcm9wZXJ0eS1TZXQgRXNjYXBl

         <Base 64 encoded attachment data ........>

         </Attachment>

      </Attachment>

   </ListOfAttachment>

</Account>

</ListOfAccount>

</ns:AccountWS_AccountQueryPage_Output>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

There are two additional attributes of the <Attachment> element:

  • EndOfData. Indicates that the data is the complete content. Always true.
  • TimedOut. Indicates whether a time-out occurred when obtaining the data. Always false.
Oracle Web Services On Demand Guide, Version 21.0 (Oracle CRM On Demand Release 33) Copyright © 2016, Oracle and/or its affiliates. All rights reserved. Legal Notices.