0

I want to parse multipart/form-data response in salesforce using apex, my response sample is below. do I need to parse it with some algorithm or there is any built-in library or method available.

----------fffjg902hegoj2b0efh012hf-g023rhg92gev092getfh208rhd102-----
Content-type: text/plain; charset=UTF-8
Content-Disposition: form-data; name="ABC"; filename="ABC"

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE DO_UNDERWRITE_RESPONSE SYSTEM "DewriteRes_v9_7.dtd">
<DO_UNDERWRITE_RESPONSE CaseIdentifier="89454949" InstitutionIdentifier="23423423">
    <STATUS _Condition="PROCESSED" _Name="SBAWF9.3" _Description="jdhaljdsl ajskl djalks jdlajksd" _Code="8"/>
    <_RECOMMENDATION _Code="87" AIndicator="6" BIndicator="15" RecommendationDescription="dont"/>
</DO_UNDERWRITE_RESPONSE>

----------fffjg902hegoj2b0efh012hf-g023rhg92gev092getfh208rhd102-----
Content-type: text/plain; charset=UTF-8
Content-Disposition: form-data; name="STATUS"; filename="STATUS"

-------------------------------------------------------------------------------- 
XYZ Application Warnings 
-------------------------------------------------------------------------------- 


Credit Log
----------

                    Unknown Report Retrieval Log
                    ================================

Date:  11/19/2021 10:44:17.717
User:  NYYHHHQQQQ

SSN        Requested                  Joint/
           NYYHHHQQQQ                 Acdb
=========  =========================  =======   
111111111  MMMMMMXXNNNNNN            I                             


Credit agency ZZZZ's performance time was 0 seconds.


Import Log
----------

--------------------------------------------------------------------------------
Casefile Support Service Results File
--------------------------------------------------------------------------------
Command:  XXXXXXX
UserID:     xxYYYZZ
InstID:     10101
Date:     11/19/2021 10:44:16.999
--------------------------------------------------------------------------------

----------fffjg902hegoj2b0efh012hf-g023rhg92gev092getfh208rhd102-----

1 Answer 1

0

this requirement seems to be a combination of both an inbuilt class AND some manual efforts from your end! The file needs to be first delivered into a JSON form, and then use the in-built BLOB processing class to convert it into the apex-parsable data.

http://www.fishofprey.com/2017/04/steps-required-to-support-posting.html

https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_blob.htm

Would not comment without looking at detailed design of your underlying apex class.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .