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