如何使用SOAP API将图像上传到SSRS服务器?

时间:2018-08-27 15:45:19

标签: c# api asp.net-core reporting-services soap-client

我正尝试使用其SOAP API将图像上传到Microsoft Reporting Services 2014,但无法正常工作,我尝试了相同的操作,但使用了一个报告,效果很好。当我运行此代码时,它不会显示任何错误。它似乎什么也没做。

private static async void DeployImage(string path)
    {
        RSService.TrustedUserHeader trustedUserHeader = new RSService.TrustedUserHeader();
        string strType = "Resource";
        string strName = "ReportImage2.jpg";
        Byte[] definition = null;
        RSService.Warning[] warnings = null;
        CreateCatalogItemResponse newImage = null;

        try
        {
            string strLocalPath = @"C:\Users\path\ReportImage2.jpg";
            FileStream stream = File.OpenRead(strLocalPath);
            definition = new Byte[stream.Length];
            stream.Read(definition, 0, (int)stream.Length);
            stream.Close();
        }
        catch (IOException e)
        {
            Console.WriteLine(e.Message);
        }

        try
        {

            string parent = path;
            CreateCatalogItemRequest thisRequest = new CreateCatalogItemRequest(trustedUserHeader, strType, strName, parent,true, definition,null);

            newImage = rsclient.CreateCatalogItemAsync(thisRequest).Result;

            Console.WriteLine("File Upload Complete");

        }catch (Exception)
        {
            throw;
        }

我在这里缺少任何步骤吗?

0 个答案:

没有答案