The OnWebServiceExecuteEnd Event occurs when data is returned from a Web Service Data Source. This Event could be used to decompress or decrypt data being returned from a Web Service Data Source.
Signature
For custom code the args array is structured as follows:
Args[] contains a single string of the data coming from the Web Service in position zero.
For .Net Assemblies the method signature is as follows:
string EventHandlerName(SessionInfo sessionInfo, string webServiceXml)
Expected Return
The OnWebServiceExecuteEnd Event expects a string to be returned.
NOTE. This Event only occurs when the callType Parameter has the value 1.
Example
The following example shows how information from a web service could be decompressed.
byte[] compressedBuffer = Convert.FromBase64String((string)args[0]); using (System.IO.MemoryStream stream = new System.IO.MemoryStream()) { int uncompressedLength = BitConverter.ToInt32(compressedBuffer, 0); stream.Write(compressedBuffer, 4, compressedBuffer.Length - 4); byte[] uncompressedBuffer = new byte[uncompressedLength]; stream.Position = 0; using (System.IO.Compression.GZipStream compress = new System.IO.Compression.GZipStream(stream, System.IO.Compression.CompressionMode.Decompress)) { compress.Read(uncompressedBuffer, 0, uncompressedBuffer.Length); compress.Close(); return System.Text.Encoding.UTF8.GetString(uncompressedBuffer); } }