Brian ACN
Brian ACN

Reputation: 1

Where/how to retrieve a file attachment sent through web services through oracle service cloud?

I sent a file attachment encoded in Base64 through webservices to OSC, which I need to display on the customer portal. Now I'm not able to retrieve the file attachment in Object Explorer. Where should I look? Any suggestions please?

Here is a piece of the xml I used(the webservices request is working fine btw):

        <n0:RNObjects xsi:type="n1:GenericObject">
            <!-- Value to check in OSC // concatenation of Source System ID and Ticket ID -->
            <n2:LookupName>TEST2023</n2:LookupName>
            <!-- Object reference in OSC // Statutory Control -->
            <n1:ObjectType>
                <n1:Namespace>testspace</n1:Namespace>
                <n1:TypeName>typename</n1:TypeName>                 
            </n1:ObjectType>
            <!-- File Attachments -->
            <n3:FileAttachments>
                <n3:FileAttachmentList xsi:type="n3:FileAttachment" action="add">
                    <n3:ContentType>application/octet-stream</n3:ContentType>
                    <n3:Data>dGVzdA==</n3:Data>
                    <n3:FileName>test.csv</n3:FileName>
                    <n3:Name>Test File Attachments</n3:Name>
                </n3:FileAttachmentList>
            </n3:FileAttachments>               
        </n0:RNObjects> 

Upvotes: 0

Views: 610

Answers (1)

Scott Harwell
Scott Harwell

Reputation: 7465

Customer Portal does not expose file attachments connected to custom objects directly. You'll need to create a mechanism to pull file attachment data associated with your custom object using the SOAP API and then serve it via the Customer Portal.

I'd probably suggest a widget that uses ROQL to query for the names of the file attachments associated with your custom object. Then, you can use it to display a list of the files for download and generate the links. When a user clicks the link, you have an ajax call back to a controller that pulls the file to the CP script from the SOAP API (probably using cURL); you can save the file in /tmp. Then, return the contents of the file to the browser along with a header indicating the proper file type so that the browser can respond to the file type accordingly.

There are easier mechanisms for displaying file attachments connected to incidents through Customer Portal. But, you'll need to connect the dots for your custom object.

Upvotes: 1

Related Questions