2013-12-20 1 views
1

SSRS 통합 셰어 포인트 서버가 있습니다. 나는 그것에서 PDF로 수출되는보고를 얻는 것을 시도하고있다. VBHT에서 XMLHTTP의 응답 객체가 비동기 적으로 작동합니까?

(. 난 내 URL이 너무 길기 때문에이 더 나은 솔루션처럼 보이지만 오히려, 이런 식으로 할 쉘 명령을 사용, 이런 식으로해야했다.)

Here'is 내 코드 :

Dim request as New XMLHTTP 
Dim oStream as New Stream 
Dim aBunchOfMiliseconds as Long 

Dim fileLocation as String 
Dim reportUrl as String 

aBunchOfMiliseconds = 500 

reportUrl = "http://www.mySharepointDomain.com/_vti_bin/ReportServer?http://www.mySharepointDomain.com/sites/AFolderHere/OOAnotherFolder/BlaBlaReportFolder/FolderFolder/AhTheLastOne/AtLeastMyReportFile.rdl&rs:Command=Render&rc:Toolbar=true&rs:Format=PDF&Parameter1=ABC &Parameter2=1&Parameter3=1&TheLastParameter=IllBeDamned&rs%3aParameterLanguage=ln-LN" 


request.Open "GET", reportUrl 
request.setRequestHeader "WWW-Authenticate", "NTLM" 'For impersonation 
request.Send 'Go get it Bruce 

If request.Status = 200 Then 'Are you successful? 

    oStream.Type = adTypeBinary 
    oStream.Open 

    oStream.Write request.responseBody 'Here's the problematic part 
    Sleep(aBunchOfMiliseconds) 'If I don't do this, file will be corrupted 

    oStream.SaveToFile fileLocation, adSaveCreateOverWrite 

    oStream.Close 


End If 


Set oStream = Nothing 
Set request = Nothing 

"수면"줄을 주석 처리하면 열 수없는 손상된 파일이 생깁니다. 이 코드는 잘 작동하지만 "Sleep"을 사용하는 비웃음을 발견했습니다.

데이터 복사 작업이 완료되었다는 것을 이해하는 방법이 있습니까?

답변

1

아, 알겠습니다.

저는 "이것은 비동기 호출이 아닙니다"라고 말하기를 놓쳤습니다.

request.Open "GET", reportUrl, False 
관련 문제