cancel
Showing results for 
Search instead for 
Did you mean: 

Web Services Publishing - Upload File via Unity Script

Srimanth_Nerall
Champ in-the-making
Champ in-the-making
Is there a ability to upload a file into OnBase using Web Services Publishing [Unity Script]?Hyland.Unity.EnterpriseIntegrationServer.EISScriptEventArgs has InputMessageDocument to send the input XML/ JSON to the service unity script. In addition, can the unity script has the ability to read the byte stream from the request object?
Below is the sample client code in .net to invoke a REST WCF service to pass the file stream to be uploaded.

How can the unity script receive the File steam object to be uploaded into OnBase?byte[] bytearray=null ;string name = "";//throw new NotImplementedException();if (FileUpload1.HasFile){name = FileUpload1.FileName;Stream stream = FileUpload1.FileContent;stream.Seek(0, SeekOrigin.Begin);bytearray = new byte[stream.Length];int count = 0;while (count < stream.Length){bytearray[count++] = Convert.ToByte(stream.ReadByte());} }string baseAddress = "http://" + Environment.MachineName + ":8000/Service/FileUpload/";HttpWebRequest request = (HttpWebRequest) HttpWebRequest.Create(baseAddress+name);request.Method = "POST";request.ContentType = "text/plain";Stream serverStream = request.GetRequestStream();serverStream.Write(bytearray, 0, bytearray.Length);serverStream.Close();using ( HttpWebResponse response = request.GetResponse() as HttpWebResponse ){int statusCode =(int) response.StatusCode;StreamReader reader = new StreamReader( response.GetResponseStream() ); }

Appreciate your help!

Thank you!
Srimanth
1 ACCEPTED ANSWER

Naveen_Kandakum
Confirmed Champ
Confirmed Champ

Web Services Publishing can accept strings as input or base64. Input the same to the Unity Script and you can achieve it. We don't support byte stream.

 

You can also use HIS Workflow XML Messaging to use OffRamp to download the document to a temporary folder and create the document inside Onbase. Which will have less coding and more of a workflow logic.

 

Thank You,

Naveen

View answer in original post

6 REPLIES 6

Naveen_Kandakum
Confirmed Champ
Confirmed Champ

Hi Srimanth,  Yes you can do that.

Thank you!

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.