I have built a webservice in salesforce so that it is being consumed from SAP. So, when a sales order is created in SAP, it would call the salesforce webservice and post the sales order details and also a pdf file as xstring (a data type in SAP). I have used blob field to get the pdf file from SAP. Now, i need to persist the data in that blob field to a field in one of the custom object.
Is there any equivalent data type in standard or custom object to store blob data? Please suggest.
global without sharing class SOBlockWebService{
//webService static List<SOBlockResponseDTO> getSOBlock(List<SOBlockRequestDTO> SOBlock)
webService static void getSOBlock(List<SOBlockRequestDTO> SOBlock)
{
List<SOBlockResponseDTO> lstSOBlockDTO = new List<SOBlockResponseDTO> {};
//************************remaining code goes here*************
}
}
and the inner class to handle the input. Here, i have declared a blob variable to get the pdf file stream from SAP. Is that correct data type for the file stream?
global class SOBlockRequestDTO {
webservice String ApplicationType {get;set;}
webservice String CustomerNumber {get;set;}
webservice String DocDate {get;set;}
webservice String DocTime {get;set;}
webservice String Timestamp {get;set;}
webservice String Message {get;set;}
webservice String Context1 {get;set;}
webservice String Context2 {get;set;}
webservice String Context3 {get;set;}
webservice String Context4 {get;set;}
webservice String Context5 {get;set;}
webservice String Context6 {get;set;}
webservice String Status {get;set;}
webservice Blob PDFAttachment {get;set;}
public SOBlockRequestDTO(String ApplicationType,String CustomerNumber, String DocDate, String DocTime, String Timestamp, String Message, String Context1, String Context2, String Context3, String Context4, String Context5, String Context6, String Status, Blob PDFAttachment) {
this.ApplicationType = ApplicationType;
this.CustomerNumber = CustomerNumber;
this.DocDate = DocDate;
this.DocTime = DocTime;
this.Timestamp = Timestamp;
this.Message = Message;
this.Context1 = Context1;
this.Context2 = Context2;
this.Context3 = Context3;
this.Context4 = Context4;
this.Context5 = Context5;
this.Context6 = Context6;
this.Status = Status;
this.PDFAttachment = PDFAttachment;
}
}