首页 文章

HTTP 400错误请求错误

提问于
浏览
0

我试图发布一个XML文件(test1.xml)并从webservice API接收输出 . 我收到错误 HTTP/1.1 400 Bad Request . 这是下面的代码 .

myheader=c(Connection="close", 
       'Content-Type' = "application/xml",
       'Content-length' =nchar("test1.xml"))

 data =  getURL("http://abcd/efg/requests/",
           userpwd="m12345:123456", httpauth = 1L,
           postfields="test1.xml",
           httpheader=myheader,
           verbose=TRUE)

这是输出

* Hostname was NOT found in DNS cache
 *   Trying 123.456.789.123...
 * Connected to rcftomdev1 (123.456.789.123) port 8086 (#0)
 * Server auth using Basic with user 'm12345'
 > POST /dart/requests/ HTTP/1.1
 Authorization: Basic bTEzNDQ4M#$#$#$#$%5==
 Host: abcd:8086
 Accept: */*
 Connection: close
 Content-Type: application/xml
 Content-length: 9

 * upload completely sent off: 9 out of 9 bytes
 < HTTP/1.1 400 Bad Request
 < Server: Apache-Coyote/1.1
 < Content-Type: text/html;charset=utf-8
 < Content-Length: 968
 < Date: Tue, 20 Jan 2015 07:50:05 GMT
 < Connection: close
 < 
 * Closing connection 0

不知道我哪里出错了,需要帮忙吗?

1 回答

  • 0

    如果这确实与给定用户密码的Authorization:标头中发送的完全相同,则会发生严重错误,因为您的组合应该创建 bTEyMzQ1OjEyMzQ1Ngo= .

    该请求的其他方面看起来很好,所以只读取服务器端对此服务器和API的要求将为您提供答案 .

相关问题