【问题标题】:SOAP fault error when using AngularJS to request from SSRS使用 AngularJS 从 SSRS 请求时出现 SOAP 错误错误
【发布时间】:2014-09-10 16:19:27
【问题描述】:

我正在使用 AngularJS 尝试从 SSRS 下拉报告列表以显示在 iframe 中。我遇到的问题是在执行 POST 请求时出现 SOAP 错误错误。

这是 Angular 控制器在进行 POST 时的样子。

function ReportSSRSController($scope, $http, $location) {
    $scope.request = '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">'
        + '<soap:Body>'
        + '<m:ListChildren xmlns:m="http://example.com/ReportingServer/ReportService2010">'
        + '<m:ItemPath>/reports</m:ItemPath>'
        + '<m:Recursive>false</m:Recursive>' 
        + '</m:ListChildren>' 
        + '</soap:Body>' 
        + '</soap:Envelope>';
    $http({
        method: 'POST', 
        url: '/ReportServer/ReportService2010.asmx', 
        data: $scope.request, 
        headers: {
            'Content-Type': 'application/soap+xml; action="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/ListChildren"'
        }
    })
    .success(function(data, status, headers, config){
        console.log('In Success');
        $scope.data = data;
    })
    .error(function(data, status, headers, config){
        console.log('In Error');
        console.log(data);
        console.log(config);
    });
}

这里是 SOAP 错误错误的要点。

System.Web.Services.Protocols.SoapException:未指定参数“ItemPath”的值。它要么在函数调用中丢失,要么被设置为 null。

正如您在 Angular 代码中看到的那样,ItemPath 包含在与函数调用相同的命名空间中的 SOAP 主体中。我还可以在控制台中看到它作为错误块中data 变量的输出。所以我想知道为什么它无法找到该信息。

在 Angular 处理 POST 请求的方式中,我是否遗漏了什么?还是我没有正确制定 SOAP 请求?

【问题讨论】:

  • 我建议你使用一些 SOAP 客户端并发出请求,然后将其与使用 Angular 发出的请求进行比较以获得差异。
  • @Chandermani 最近我也想到了这个想法。我希望我的角度足够接近,也许有人可以更快地指出错误,而不是用其他东西重写它。不过我肯定会尝试这样做,并用我从中找到的任何新信息更新问题。

标签: javascript angularjs soap reporting-services


【解决方案1】:

事实证明,该问题与 SOAP XML 中的命名空间有关。

当我将命名空间更改为

http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer

匹配 SOAP 动作(减去最后的命令);该请求返回了一个有效的 SOAP 响应。

我不确定这是否是 SOAP 或 SSRS 的限制,因为我对两者都不太熟悉。

【讨论】:

  • 谢谢!这给我带来了几个小时的麻烦,您的解决方案帮助我解决了它。
猜你喜欢
  • 1970-01-01
  • 2016-09-15
  • 2017-06-23
  • 2017-09-09
  • 2023-03-20
  • 1970-01-01
  • 2016-08-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多