我对角度不太好。我想发布到一个Web服务,发送一些带有我的搜索参数的xml。我不想在查询字符串中发送参数。我已经阅读了官方文档,但我仍然感到困惑。我大多挂了如何定义$资源以便能够发布我想要的方式。
我得到的错误是:POST' https://someWebservice/searchnet' :: ERR_INSECURE_RESPONSE
我的代码如下:
'use strict';
angular.module('app').controller('inventorySearchController', inventorySearchController);
inventorySearchController.$inject = ['$scope','$http', '$resource'];
function inventorySearchController($scope, $http, $resource) {
console.log("controller initialized...");
$scope.callService = function(){
console.log("callService function called...");
var urlSearchService = 'https://someWebservice/search';
var skuVal = $scope.skuField;
var mVenVal = $scope.mVendorField;
//need to somehow specifiy that xml is a @FormParam
var xmlItemSearchRequest = "<ItemSearchRequest>"
+"<skuid>" + skuVal + "</skuid>"
+"<mvendor>" + mVenVal + "</mvendor>"
+"</ItemSearchRequest>";
console.log('calling: ' + urlSearchService + 'sending xml: ' + xmlItemSearchRequest);
var Results = $resource(urlSearchService, {
save: {
method: 'POST',
isArray: true
}
});
var result = Results.save();
console.log('Results: ' + Results);
console.log('result: ' + result);
var successfunction = function(){
$scope.searchResults = data;
console.log('call to ' + urlSearchService + ", was a success.");
};
var errorfunction = function(){
console.error('Calling error', status, data);
};
};
};
答案 0 :(得分:0)
显示的错误与您发布数据的方式无关。相反,响应未由有效的SSL证书签名(或者无法接受证书)。这是由于使用了HTTPS协议。您应该考虑使用HTTP。
您可以尝试使用here建议的方法来确认是这种情况。