- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2019 10:51 AM
What is the replacement of Packages.java.io.ByteArrayOutputStream() for New York version?
We have custom integration with Third party tool. After the upgrade to NewYork, attachments are not passing over SOAP
It is giving below error::
Error MessageIllegal access to method writeTo(java.io.ByteArrayOutputStream) in class com.glide.ui.SysAttachmentInputStream
var attachmentIS = new GlideSysAttachmentInputStream(attachsys_id);
var bytearrayOS = new Packages.java.io.ByteArrayOutputStream();
attachmentIS.writeTo(bytearrayOS);
var content64 = GlideBase64.encode(bytearrayOS.toByteArray());
Can anyone suggest API/function for the replacement of Packages.java.io.ByteArrayOutputStream().
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2020 07:54 AM
Hi Gursimrun,
It seems ServiceNow changed the signature for the 'writeTo' method.
Try to use "attachmentIS.writeTo(bytearrayOS, 0, 0);" instead of "attachmentIS.writeTo(bytearrayOS);".
Example in the oob script: /sys_script.do?sys_id=468eebfeff447300c2e8a897d53bf16e
I hope this solved your issue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2019 12:00 PM
Hi,
Is this scope application?
If yes then see this: https://community.servicenow.com/community?id=community_question&sys_id=332f47e1dbdcdbc01dcaf3231f96...
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2019 12:33 PM
Thanks Ashutosh,
This is Global application. I tried using getBytes from glideSysAttachment , attachment is going through integration - file name and content type , but content/payload is not going. I think there is a problem in attachmentIS.writeTo(bytearrayOS); - how to write byte array on SOAP in NewYork, any guess?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2019 09:14 AM
Hi Gurismran,
Can you share more details about the use case and how you're using the attachment with the SOAP call? Is the entire SOAP envelope in the attachment, and this is sent as the payload? Are you using SOAPMessageV2?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2020 07:54 AM
Hi Gursimrun,
It seems ServiceNow changed the signature for the 'writeTo' method.
Try to use "attachmentIS.writeTo(bytearrayOS, 0, 0);" instead of "attachmentIS.writeTo(bytearrayOS);".
Example in the oob script: /sys_script.do?sys_id=468eebfeff447300c2e8a897d53bf16e
I hope this solved your issue.