Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/55.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 on rails SOAPAction是空的_Ruby On Rails_Soap - Fatal编程技术网

Ruby on rails SOAPAction是空的

Ruby on rails SOAPAction是空的,ruby-on-rails,soap,Ruby On Rails,Soap,我在Mac和Linux上运行相同的web应用程序 在Mac上,我使用的是Savon 0.7.6,web应用程序运行得非常好;应用程序启动SOAP请求,如下所示: client = Savon::Client.new("http://pvwatts.nrel.gov/PVWATTS.asmx?WSDL") req = prep_request(@locationId, @dc_rating, @tilt, @azimuth, @derate, @array_type, @cost) respo

我在Mac和Linux上运行相同的web应用程序

在Mac上,我使用的是Savon 0.7.6,web应用程序运行得非常好;应用程序启动SOAP请求,如下所示:

client = Savon::Client.new("http://pvwatts.nrel.gov/PVWATTS.asmx?WSDL")

req = prep_request(@locationId, @dc_rating, @tilt, @azimuth, @derate, @array_type, @cost)

response = client.get_pvwatts{|soap| soap.input = "GetPVWATTS"; soap.body = req }
rdata = response.to_hash
这将导致以下请求:

Retrieving WSDL from: http://pvwatts.nrel.gov/PVWATTS.asmx?WSDL
SOAP request: http://pvwatts.nrel.gov/PVWATTS.asmx
SOAPAction: http://pvwatts.nrel.gov/GetPVWATTS, Content-Type: text/xml;charset=UTF-8
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:wsdl="http://pvwatts.nrel.gov" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><wsdl:GetPVWATTS><wsdl:derate>0.8</wsdl:derate><wsdl:latitude>-99.0</wsdl:latitude><wsdl:pwrdgr>-0.005</wsdl:pwrdgr><wsdl:cost>0.1</wsdl:cost><wsdl:locationID>23234</wsdl:locationID><wsdl:inoct>45.0</wsdl:inoct><wsdl:mode>0</wsdl:mode><wsdl:key><key></wsdl:key><wsdl:azimuth>230</wsdl:azimuth><wsdl:tilt>20</wsdl:tilt><wsdl:DCrating>1</wsdl:DCrating><wsdl:longitude>0.0</wsdl:longitude></wsdl:GetPVWATTS></env:Body></env:Envelope>
这将导致以下错误:

SOAP request: http://pvwatts.nrel.gov/PVWATTS.asmx
Content-Length: 750, Content-Type: text/xml;charset=UTF-8, SOAPAction: ""
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="http://pvwatts.nrel.gov" xmlns:wsdl="http://pvwatts.nrel.gov"><env:Body><ins0:GetPVWATTS><wsdl:inoct>45.0</wsdl:inoct><wsdl:tilt>20</wsdl:tilt><wsdl:cost>0.1</wsdl:cost><wsdl:locationID>23234</wsdl:locationID><wsdl:mode>0</wsdl:mode><wsdl:DCrating>1</wsdl:DCrating><wsdl:key><key></wsdl:key><wsdl:pwrdgr>-0.005</wsdl:pwrdgr><wsdl:latitude>-99.0</wsdl:latitude><wsdl:azimuth>180</wsdl:azimuth><wsdl:longitude>0.0</wsdl:longitude><wsdl:derate>0.8</wsdl:derate></ins0:GetPVWATTS></env:Body></env:Envelope>
SOAP response (status 500):
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Server did not recognize the value of HTTP Header SOAPAction: .</faultstring><detail /></soap:Fault></soap:Body></soap:Envelope>
Completed 500 Internal Server Error in 1065ms

Savon::SOAP::Fault ((soap:Client) Server did not recognize the value of HTTP Header SOAPAction: .):
SOAP请求:http://pvwatts.nrel.gov/PVWATTS.asmx
内容长度:750,内容类型:text/xml;字符集=UTF-8,SOAPAction:“
45.0200.12323401-0.005-99.01800.00.8
SOAP响应(状态500):
soap:ClientServer无法识别HTTP标头SOAPAction:的值。
在1065ms内完成500个内部服务器错误
Savon::SOAP::Fault((SOAP:Client)服务器未识别HTTP头SOAPAction:的值):
请注意,SOAPAction字段未填充


谁能告诉我这里出了什么问题?

我找到了解决办法;我的工作代码如下:

response = client.request :wsdl, "get_pvwatts" do
  soap.body = req
end

rdata = response.to_hash
response = client.request :wsdl, "get_pvwatts" do
  soap.body = req
end

rdata = response.to_hash