Sending big attachment through SOAP Message without converting it into String?

Iv_n Carravilla
Kilo Contributor

I'm trying to send a big attachment (around 40MB) through a SOAP Message. For doing this, I'm transforming it to base64 and then adding it to the respective parameter (via setStringParameter). The problem appears when this base64 is converted into a String, because it seems to exceed the limit size, throwing the following error:

Javascript compiler exception: String object would exceed maximum permitted size of 33554432

Is there any way to send this huge parameter without transforming it to string in memory?

Thank you very much in advance.
6 REPLIES 6

Pratiksha Kalam
Kilo Sage

Hi,

RESTMessageV2 has a method called setRequestBodyFromAttachment(attachmentSysId). Use this instead of setRequestBody. You can remove all of the code that calls GlideSysAttachment and just pass the Sys ID of the attachment to this method.

https://developer.servicenow.com/app.do#!/rest_api_doc?v=london&id=r_AttachmentAPI-POST

 

If my answer is helpful mark correct and helpful.

Regards,

Pratiksha

Pratiksha Kalam
Kilo Sage

Hi,

RESTMessageV2 has a method called setRequestBodyFromAttachment(attachmentSysId). Use this instead of setRequestBody. You can remove all of the code that calls GlideSysAttachment and just pass the Sys ID of the attachment to this method.

https://developer.servicenow.com/app.do#!/rest_api_doc?v=london&id=r_AttachmentAPI-POST

 

If my answer is helpful mark correct and helpful.

Regards,

Pratiksha