Jenkins+PowerShell持续集成环境搭建(五)SSRS项目

部署SSRS项目的原理是使用ReportingService2005类的方法实现rdl文件上传等功能。

上传rdl文件的脚本示例:

 $username="Victor";
$password="******"; $pass = ConvertTo-SecureString -AsPlainText $password -Force
$credential= New-Object System.Management.Automation.PSCredential -ArgumentList $username,$pass $uri="http://YourServer/ReportServer/ReportService2005.asmx"; $webServiceProxy = New-WebServiceProxy -Uri $uri -Credential $credential $rdlName="Test" #Backup
$backupDateFormat = (Get-Date -format yyyy_MM_dd)
$backupDir= "D:\" + $backupDateFormat +"\Report\"+$rdlName
$rdlDefinitionBackup = $webServiceProxy.GetReportDefinition("Report/" + $rdlName)
$memoryStreamBackup = New-Object System.IO.MemoryStream (,$rdlDefinitionBackup)
$xmlDocBackup = New-Object "System.Xml.XmlDocument"
$xmlDocBackup.Load($memoryStreamBackup)
$xmlDocBackup.Save(backupDir+".rdl") #Upload
$rdlDir="D:\CI\File\"+$rdlName+".rdl"
$rdlFileStream=[System.Io.File]::OpenRead($rdlDir)
$rdlFileStreamLength=$rdlFileStream.Length
$rdlDefinition = New-Object Byte[] $rdlFileStreamLength
$rdlFileStream.Read($rdlDefinition, 0, $rdlFileStreamLength);
$rdlFileStream.Close();
$webServiceProxy.CreateReport($rdlName,"/Report",$TRUE,$rdlDefinition,$NULL)
上一篇:shell多进程


下一篇:c++ 查找数组或者容器元素是否存在(find)