Javascript 使用AngularJS从SSR请求时出现SOAP错误

Javascript 使用AngularJS从SSR请求时出现SOAP错误,javascript,angularjs,soap,reporting-services,Javascript,Angularjs,Soap,Reporting Services,我正在使用AngularJS尝试从中下拉一个报告列表以显示在iframe中。我遇到的问题是,我在执行POST请求时遇到了SOAP错误 这是做柱子的角度控制器的样子 function ReportSSRSController($scope, $http, $location) { $scope.request = '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http:/

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

这是做柱子的角度控制器的样子

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);
    });
}
函数报告ssrscontroller($scope、$http、$location){
$scope.request=''
+ ''
+ ''
+“/报告”
+“假”
+ '' 
+ '' 
+ '';
$http({
方法:“POST”,
url:“/ReportServer/ReportService2010.asmx”,
数据:$scope.request,
标题:{
“内容类型”:“应用程序/soap+xml;操作=”http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/ListChildren"'
}
})
.success(函数(数据、状态、标题、配置){
console.log('In Success');
$scope.data=数据;
})
.error(函数(数据、状态、标题、配置){
console.log('In Error');
控制台日志(数据);
console.log(config);
});
}
下面是SOAP错误的要点

System.Web.Services.Protocols.SoapException:未指定参数“ItemPath”的值。函数调用中缺少它,或者将其设置为null

正如您在Angular代码中看到的,
ItemPath
包含在SOAP主体中,与函数调用位于同一名称空间中。我还可以在控制台中将其视为错误块中
数据
变量的输出。所以我想知道为什么它找不到这些信息


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

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

当我将名称空间更改为

http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer
匹配SOAP操作(减去末尾的命令);请求返回了有效的SOAP响应


我不确定这是否是SOAP或SSR的限制,因为我对它们都不是很熟悉

我建议您使用一些SOAP客户端并发出请求,然后将其与使用angular发出的请求进行比较,以找出差异。@Chandermani我最近也想到了这一点。我希望我的角度足够近,也许有人能指出错误,比我用其他东西重写它要快。不过我一定会尝试一下,并用我从中发现的任何新信息更新问题。谢谢!这给了我几个小时的麻烦,你的解决方案帮我解决了。