Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby SOAP:HTTP错误400。请求的标头名称无效_Ruby_Http Headers_Savon - Fatal编程技术网

Ruby SOAP:HTTP错误400。请求的标头名称无效

Ruby SOAP:HTTP错误400。请求的标头名称无效,ruby,http-headers,savon,Ruby,Http Headers,Savon,我正在使用Ruby On Rails gemSavon进行SOAP调用,在发出请求时,我收到以下错误消息: Bad Request - Invalid Header HTTP Error 400. The request has an invalid header name. 400 Bad Request - The request cannot be fulfilled due to bad syntax. 这听起来很有描述性,但我仍然无法找出问题所在。我在这里也找到了一些话题,但不幸的

我正在使用Ruby On Rails gem
Savon
进行SOAP调用,在发出请求时,我收到以下错误消息:

Bad Request - Invalid Header
HTTP Error 400. The request has an invalid header name.
400 Bad Request - The request cannot be fulfilled due to bad syntax.
这听起来很有描述性,但我仍然无法找出问题所在。我在这里也找到了一些话题,但不幸的是,没有一个对我有帮助

以下是我如何建立连接:

client = Savon.client(endpoint: wsdl_url,
                          namespace: '',
                          env_namespace: :s, 
                          basic_auth: ["username", "password"],
                          ssl_verify_mode: :none,
                          log: true,
                          logger: Rails.logger,
                          pretty_print_xml: true)

@response = client.call('MyAction', 
                        soap_action: 'url address',
                        xml: xml_payload,
                        headers: {
                          'Content-Type': 'application/soap+xml; charset=utf-8',
                        })
下面是从(终端)控制台生成的错误:

为此:

@response = client.call('MyAction', 
                            soap_action: 'url address',
                            xml: xml_payload)
错误消息显示的信息要少得多:

Savon::HTTPError - HTTP error (400):
因此,标题使其更具描述性。如果我查看由
Savon
生成的标题,它看起来如下所示:

SOAP request: https://URL_ENDPOINT
Content-Type: application/soap+xml; charset=utf-8, SOAPAction: "http://URL_ENDPOINT/MyAction", Content-Type: text/xml;charset=UTF-8, Content-Length: 2935
什么标题是错误的?我如何在这里调试/检查它

我还试图在《邮递员》中调查这个问题,但只收到了以下错误消息:

Bad Request - Invalid Header
HTTP Error 400. The request has an invalid header name.
400 Bad Request - The request cannot be fulfilled due to bad syntax.
我还尝试验证发送到服务器的生成的XML数据——这是有效的(在不同的验证器上验证)

我如何解决这个问题


谢谢

变量
xml\u有效载荷
是什么?该变量中是我发送到服务器的有效xml代码/数据。变量
xml\u有效载荷
是什么?该变量中是我发送到服务器的有效xml代码/数据。