将请求发送到 RestFul Web 服务时出现错误 400

Error 400 on Put request to a RestFull webService

我需要调用 Web 服务来获取一些数据,但是当我使用此代码时:

app.controller('Hello', function($scope, $http) {

var config = {
  headers:  {
        "loginName": 'opzudecche',
        "password" : "****"
    }
};

$http.put("WEBSERVICEURL", config).then(function(response) {
  $scope.greeting = response.data;
});



});

它继续 return 给我一个错误 400...我哪里错了?

首先检查服务是否正常,然后使用此代码

var app = angular.module('Hello', '$http', []);
app.controller('myCtrl', function($scope, $http) {

  $http({
    method: "PUT",
    url: "WEBSERVICEURL",
    headers: {
      'loginName': 'opzudecche',
      'password': "****"
    },
  }).then(function mySuccess(response) {
    $scope.greeting = response.data;
  }, function myError(response) {
    $scope.error = response.data;
  });

});