VBScript Byte Array WebService

I am trying to call a webservice which returns a byte array which is a file.... I am trying to do this with vbscript.  I can call the webservice no problem the issue is how do I get the contents (which is the actual file) to disk?  I can get through the document and locate the contents the question is how do I get it to disk?  I have essentially a text string which is an array of bytes and I dont know what to do with it.. in vb.net this is no problem I just dont know how to handle in vbscript.. can anyone help?
Who is Participating?
WMIFConnect With a Mentor Commented:
you should be able to do the same thing in asp/vbscript using the adodb.stream object.
Hello NTGuru705,
You just need to write it to a file?
Use the FSO...
Dim objFSO:Set objFSO=CreateObject("Scripting.FileSystemObject")
Dim objOutput: SetobjOutput=objFSO.CreateTextFile("C:\YourFile.txt")
objOutput.WriteLine YourData

NTGuru705Author Commented:
Well not really... the data isnt text... so I am ot writing a text file...

The webservice is handing me a binary file... and it is handing it to me as a return parameter which is a byte array...

So i .net I can do something like this..

Public Function WriteFile(ByVal ccDocument As Byte(), ByVal FilePath As String) As Integer
        Dim objFstream As FileStream
        Dim lngLen As Long = ccDocument.Length
            objFstream = File.Open(FilePath, FileMode.Create, FileAccess.Write)
            objFstream.Write(ccDocument, 0, CInt(lngLen))
        Catch ex As Exception
            ErrorHandler("WriteFile", ex.Message, AgentName, EventLogEntryType.Error, -5000)
            Return -5000
        End Try

        If Not objFstream Is Nothing Then
            objFstream = Nothing
        End If
        Return 0
    End Function

How to do this in vbscript though?
7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

NTGuru705Author Commented:
right but to write binary data you have to use the wrtie method and the parameter is a byte array which I dont think vbscript supports.
NTGuru705Author Commented:
Ok I am making progress here...

This is what the XML looks like.. note the content is in the document element...
Problem is when I write it back to disk it isnt right.. anyone recognize the encoding or something?  This is just being returned from a vb.net webservice as a byte array.

<ccDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://services.firstfleetinc.com/">
- <ccDocProperties>
  <ccDocStatusName>Pending Index</ccDocStatusName>
  <ccErrorString />
- <ccDocAttribues>
- <ccDocAttributes>
  <ccErrorString />
- <ccDocAttributes>
  <ccErrorString />
  <ccErrorString />
rdivilbissConnect With a Mentor Commented:
Probably Base64 encoded
NTGuru705Author Commented:
yes and there are lots of dlls I have found to help me write this file to disk... thank for your help.. reference link


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.