I have two simple web services, as shown below. One returns the file size of
a test file, and the second the file itself. I can successfully recover the
file size using the following code:\
httpRequest.Met hod = "Post"
httpRequest.Con tentType = "text/xml; charset=utf-8"
httpResponse = httpRequest.Get Response()
Dimsr As NewStreamReader (httpResponse.G etResponseStrea m())
strStatus = sr.ReadToEnd()
sr.Close()
httpResponse.Cl ose()
However, when I try to download the file itself, using the following code,
the app just hangs:
DimhttpRequest2 As HttpWebRequest =
WebRequest.Crea te("http://localhost:1995/webSvs/Service.asmx/RetrieveZip")
httpRequest2.Me thod = "Post"
httpRequest2.Co ntentLength = lFileLength
httpRequest2.Co ntentType = "applicatio n/x-zip-compressed"
httpResponse2 = httpRequest2.Ge tResponse()' hangs here.
Any suggestion how I can retrieve this zip file and write it to my local
disk? Thanks.
Joe
Here are the web services themselves:
Public ClassService
InheritsSystem. Web.Services.We bService
<WebMethod()_
PublicFunction RetrieveZip() As Byte()
Dimpath As String=
"U:\-CVS-\Painless.NET\R andD\webSvs\App _Code\test.zip"
Dimbindata() As Byte= File.ReadAllByt es(path)
Returnbindata
EndFunction
<WebMethod()_
PublicFunction RetrieveZipSize () As String
Dimpath As String=
"U:\-CVS-\Painless.NET\R andD\webSvs\App _Code\test.zip"
DimlFileSize As Long
DimstrFileSize As String
lFileSize = FileLen(path)
strFileSize = CStr(lFileSize)
ReturnstrFileSi ze
EndFunction
End Class