You need to sign in to do that
Don't have an account?
DocMagic
uploading jpg attachments via SOAP successful, but broken in the browser.
I'm able to successfully upload data as an attachment to salesforce. These are all jpg images. However, if I do not provide the 'ContentType', when viewing the attachment in a browser, I see the base64 encoded data. If I use the 'image/jpg' tag, the image is broken and nothing displayed.
To confirm the base64 encoded data is valid, I copy that out of the brower and go to an independent decoder website and it creates the jpg correctly.
What am I not setting in the SOAP?
This is Delphi.
Jim
TheAttachment := Attachment.Create; TheAttachment.ParentId := aCaseID; //required TheAttachment.ContentType := 'image/jpg'; TheAttachment.IsPrivate := False; FileData := ArrOfByte(aDataStream.GetAsString); //aDataStream is already base64 encoded. TheAttachment.Body := FileData; TheAttachment.Description := aName; TheAttachment.Name_ := aName; //required SetLength(AttachmentArray,1); AttachmentArray[0] := TheAttachment; cr := fBinding.create( AttachmentArray ); if not cr[0].success then ShowMessage(aName + ' not saved to SalesForce CaseID: ' + aCaseID);
Most soap stacks will automatically base64 encode the binary data for you, sounds like your encoding it, then the soap stack is encoding it, so its getting double encoded.
GREAT! I WAS base64 encoding the body and once I stopped that, it worked. However, my app also connect to JIRA via soap and it requires me to explicitly base64 encode the payload to make that work.... Thank you so much.