mbt masai
 
Welcome !
         

                                
After experiencing a lot of down time, We decided to move this site to CrystalTech.com. CrystalTech.com is powered by only the finest Windows servers providing the best performance, reliability, and value anywhere.

 Posting file to webservice using vbscript

Author Message
Nars

  • Total Posts : 4
  • Scores: 0
  • Reward points : 0
  • Joined: 2/22/2009
  • Status: offline
Posting file to webservice using vbscript Tuesday, August 11, 2009 7:24 PM (permalink)
0
HI All,


I am currently working on a project in which i need to post a file to webservice using vbscript.
The webservice method is PutFile(buffer).This method create a file and put the content received in that file.
I am trying to read a file in binary format and trying post  the binary text  to webservice.
As i am new to this domain i am not sure how can i do it.

Following is the code i am trying

Const adTypeText =1
Dim folderIdx, objFilesystem, objFilestream, intFilelength
folderIdx = "D:\sample.txt"
Set objFilesystem = CreateObject("Scripting.FileSystemObject")
Set objFilestream = objFilesystem.GetFile(folderIdx)
intFilelength = objFilestream.size
WScript.Echo intFileLength
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
BinaryStream.Type = adTypeText 
BinaryStream.Open
BinaryStream.LoadFromFile folderIdx
ReadTextFile =BinaryStream.Read
Dim xmlhttp,objHttp
set xmlhttp = Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.open "POST", "http://localhost/WebApplication1/Service1.asmx/PutFile", False
xmlhttp.setRequestHeader "Content-Type","application/x-www-form-urlencoded" '"text/html"
xmlhttp.setRequestHeader "Content-Length", intFilelength
xmlhttp.setOption 2, 13056
xmlhttp.send(ReadTextFile)

Nothing will be happening using this.

Can anybody help me how this can be done.

Thanks in advance,
Nars
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.8
    mbt shoes www.wileywilson.com