gpt4 book ai didi

javascript - 使用 AngularJS 从 SSRS 请求时出现 SOAP 故障错误

转载 作者:行者123 更新时间:2023-11-30 17:17:44 24 4
gpt4 key购买 nike

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

这是进行 POST 时 Angular Controller 的样子。

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: The value for parameter 'ItemPath' is not specified. It is either missing from the function call, or it is set to null.

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

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

最佳答案

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

当我将命名空间更改为

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

匹配 SOAP 操作(减去末尾的命令);该请求返回了有效的 SOAP 响应。

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

关于javascript - 使用 AngularJS 从 SSRS 请求时出现 SOAP 故障错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25770419/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com