0
我想使用此WSDL http://www.webservicex.net/uszip.asmx?WSDL使用net/http的GetInfoByZIP服務器,但始終得到錯誤「服務器無法識別HTTP頭SOAPAction的值」服務器無法識別HTTP頭SOAPAction的值與淨/ http
path = '/uszip.asmx'
#http://www.webservicex.net/uszip.asmx?WSDL
# Create the SOAP Envelope
data = <<-EOF
<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>
<GetInfoByZIPResponse xmlns="http://www.webserviceX.NET">
<GetInfoByZIPResult>
<NewDataSet xmlns="">
<Table>
<CITY>Beverly Hills</CITY>
<STATE>CA</STATE>
<ZIP>90210</ZIP>
<AREA_CODE>310</AREA_CODE>
<TIME_ZONE>P</TIME_ZONE>
</Table>
</NewDataSet>
</GetInfoByZIPResult>
</GetInfoByZIPResponse>
</soap:Body>
</soap:Envelope>EOF
host = "www.webservicex.net"
http = Net::HTTP.new(host)
resp = http.post(path, data, { 'Content-Type' => 'text/xml; charset=utf-8', 'SOAPAction' => 'GetInfoByZIP' })
任何人都可以幫我嗎? 謝謝
完美!作品!!謝謝 – Angel
@Angel - 如果它解決了問題,那麼我會很感激你給我的信用,將答案標記爲「接受」。非常感謝。 :) – Roberto