【发布时间】: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