hiding away some stuff that I'm mostly done with for now...

This commit is contained in:
Dan Buch
2012-07-09 20:14:14 -04:00
parent b9e8e70867
commit 3b7d21b12f
36 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
require 'savon'
require 'pp'
require 'tmpdir'
WSDL = File.expand_path('./uszip.wsdl', File.dirname(__FILE__))
def main
logfile = File.join(Dir.tmpdir, 'uszip.log')
HTTPI.log = false
Savon.configure do |config|
config.log = true
config.log_level = :debug
config.logger = Logger.new(logfile)
end
r = get_info_by_zip((ARGV.first || 90210).to_i)
puts "#{r[:city]}, #{r[:state]} #{r[:zip]} " <<
"(#{r[:area_code]}) [#{r[:time_zone]}]"
end
def get_info_by_zip(zipcode)
client = Savon.client(WSDL)
response = client.request(:get_info_by_zip) do
soap.body = {"USZip" => zipcode}
end
res = response.to_hash[:get_info_by_zip_response][:get_info_by_zip_result]
res[:new_data_set][:table]
end
if $0 == __FILE__
main
end

395
.old/ruby-soap/uszip.wsdl Normal file
View File

@@ -0,0 +1,395 @@
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.webserviceX.NET" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://www.webserviceX.NET" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://www.webserviceX.NET">
<s:element name="GetInfoByZIP">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="USZip" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetInfoByZIPResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetInfoByZIPResult">
<s:complexType mixed="true">
<s:sequence>
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetInfoByCity">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="USCity" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetInfoByCityResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetInfoByCityResult">
<s:complexType mixed="true">
<s:sequence>
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetInfoByState">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="USState" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetInfoByStateResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetInfoByStateResult">
<s:complexType mixed="true">
<s:sequence>
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetInfoByAreaCode">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="USAreaCode" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetInfoByAreaCodeResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetInfoByAreaCodeResult">
<s:complexType mixed="true">
<s:sequence>
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="GetInfoByZIPSoapIn">
<wsdl:part name="parameters" element="tns:GetInfoByZIP" />
</wsdl:message>
<wsdl:message name="GetInfoByZIPSoapOut">
<wsdl:part name="parameters" element="tns:GetInfoByZIPResponse" />
</wsdl:message>
<wsdl:message name="GetInfoByCitySoapIn">
<wsdl:part name="parameters" element="tns:GetInfoByCity" />
</wsdl:message>
<wsdl:message name="GetInfoByCitySoapOut">
<wsdl:part name="parameters" element="tns:GetInfoByCityResponse" />
</wsdl:message>
<wsdl:message name="GetInfoByStateSoapIn">
<wsdl:part name="parameters" element="tns:GetInfoByState" />
</wsdl:message>
<wsdl:message name="GetInfoByStateSoapOut">
<wsdl:part name="parameters" element="tns:GetInfoByStateResponse" />
</wsdl:message>
<wsdl:message name="GetInfoByAreaCodeSoapIn">
<wsdl:part name="parameters" element="tns:GetInfoByAreaCode" />
</wsdl:message>
<wsdl:message name="GetInfoByAreaCodeSoapOut">
<wsdl:part name="parameters" element="tns:GetInfoByAreaCodeResponse" />
</wsdl:message>
<wsdl:message name="GetInfoByZIPHttpGetIn">
<wsdl:part name="USZip" type="s:string" />
</wsdl:message>
<wsdl:message name="GetInfoByZIPHttpGetOut">
<wsdl:part name="Body" />
</wsdl:message>
<wsdl:message name="GetInfoByCityHttpGetIn">
<wsdl:part name="USCity" type="s:string" />
</wsdl:message>
<wsdl:message name="GetInfoByCityHttpGetOut">
<wsdl:part name="Body" />
</wsdl:message>
<wsdl:message name="GetInfoByStateHttpGetIn">
<wsdl:part name="USState" type="s:string" />
</wsdl:message>
<wsdl:message name="GetInfoByStateHttpGetOut">
<wsdl:part name="Body" />
</wsdl:message>
<wsdl:message name="GetInfoByAreaCodeHttpGetIn">
<wsdl:part name="USAreaCode" type="s:string" />
</wsdl:message>
<wsdl:message name="GetInfoByAreaCodeHttpGetOut">
<wsdl:part name="Body" />
</wsdl:message>
<wsdl:message name="GetInfoByZIPHttpPostIn">
<wsdl:part name="USZip" type="s:string" />
</wsdl:message>
<wsdl:message name="GetInfoByZIPHttpPostOut">
<wsdl:part name="Body" />
</wsdl:message>
<wsdl:message name="GetInfoByCityHttpPostIn">
<wsdl:part name="USCity" type="s:string" />
</wsdl:message>
<wsdl:message name="GetInfoByCityHttpPostOut">
<wsdl:part name="Body" />
</wsdl:message>
<wsdl:message name="GetInfoByStateHttpPostIn">
<wsdl:part name="USState" type="s:string" />
</wsdl:message>
<wsdl:message name="GetInfoByStateHttpPostOut">
<wsdl:part name="Body" />
</wsdl:message>
<wsdl:message name="GetInfoByAreaCodeHttpPostIn">
<wsdl:part name="USAreaCode" type="s:string" />
</wsdl:message>
<wsdl:message name="GetInfoByAreaCodeHttpPostOut">
<wsdl:part name="Body" />
</wsdl:message>
<wsdl:portType name="USZipSoap">
<wsdl:operation name="GetInfoByZIP">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get State Code,City,Area Code,Time Zone,Zip Code by Zip Code</wsdl:documentation>
<wsdl:input message="tns:GetInfoByZIPSoapIn" />
<wsdl:output message="tns:GetInfoByZIPSoapOut" />
</wsdl:operation>
<wsdl:operation name="GetInfoByCity">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get State Code,City,Area Code,Time Zone,Zip Code by City</wsdl:documentation>
<wsdl:input message="tns:GetInfoByCitySoapIn" />
<wsdl:output message="tns:GetInfoByCitySoapOut" />
</wsdl:operation>
<wsdl:operation name="GetInfoByState">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get State Code,City,Area Code,Time Zone,Zip Code by state</wsdl:documentation>
<wsdl:input message="tns:GetInfoByStateSoapIn" />
<wsdl:output message="tns:GetInfoByStateSoapOut" />
</wsdl:operation>
<wsdl:operation name="GetInfoByAreaCode">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get State Code,City,Area Code,Time Zone,Zip Code by Area Code</wsdl:documentation>
<wsdl:input message="tns:GetInfoByAreaCodeSoapIn" />
<wsdl:output message="tns:GetInfoByAreaCodeSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="USZipHttpGet">
<wsdl:operation name="GetInfoByZIP">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get State Code,City,Area Code,Time Zone,Zip Code by Zip Code</wsdl:documentation>
<wsdl:input message="tns:GetInfoByZIPHttpGetIn" />
<wsdl:output message="tns:GetInfoByZIPHttpGetOut" />
</wsdl:operation>
<wsdl:operation name="GetInfoByCity">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get State Code,City,Area Code,Time Zone,Zip Code by City</wsdl:documentation>
<wsdl:input message="tns:GetInfoByCityHttpGetIn" />
<wsdl:output message="tns:GetInfoByCityHttpGetOut" />
</wsdl:operation>
<wsdl:operation name="GetInfoByState">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get State Code,City,Area Code,Time Zone,Zip Code by state</wsdl:documentation>
<wsdl:input message="tns:GetInfoByStateHttpGetIn" />
<wsdl:output message="tns:GetInfoByStateHttpGetOut" />
</wsdl:operation>
<wsdl:operation name="GetInfoByAreaCode">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get State Code,City,Area Code,Time Zone,Zip Code by Area Code</wsdl:documentation>
<wsdl:input message="tns:GetInfoByAreaCodeHttpGetIn" />
<wsdl:output message="tns:GetInfoByAreaCodeHttpGetOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="USZipHttpPost">
<wsdl:operation name="GetInfoByZIP">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get State Code,City,Area Code,Time Zone,Zip Code by Zip Code</wsdl:documentation>
<wsdl:input message="tns:GetInfoByZIPHttpPostIn" />
<wsdl:output message="tns:GetInfoByZIPHttpPostOut" />
</wsdl:operation>
<wsdl:operation name="GetInfoByCity">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get State Code,City,Area Code,Time Zone,Zip Code by City</wsdl:documentation>
<wsdl:input message="tns:GetInfoByCityHttpPostIn" />
<wsdl:output message="tns:GetInfoByCityHttpPostOut" />
</wsdl:operation>
<wsdl:operation name="GetInfoByState">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get State Code,City,Area Code,Time Zone,Zip Code by state</wsdl:documentation>
<wsdl:input message="tns:GetInfoByStateHttpPostIn" />
<wsdl:output message="tns:GetInfoByStateHttpPostOut" />
</wsdl:operation>
<wsdl:operation name="GetInfoByAreaCode">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get State Code,City,Area Code,Time Zone,Zip Code by Area Code</wsdl:documentation>
<wsdl:input message="tns:GetInfoByAreaCodeHttpPostIn" />
<wsdl:output message="tns:GetInfoByAreaCodeHttpPostOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="USZipSoap" type="tns:USZipSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetInfoByZIP">
<soap:operation soapAction="http://www.webserviceX.NET/GetInfoByZIP" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetInfoByCity">
<soap:operation soapAction="http://www.webserviceX.NET/GetInfoByCity" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetInfoByState">
<soap:operation soapAction="http://www.webserviceX.NET/GetInfoByState" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetInfoByAreaCode">
<soap:operation soapAction="http://www.webserviceX.NET/GetInfoByAreaCode" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="USZipSoap12" type="tns:USZipSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetInfoByZIP">
<soap12:operation soapAction="http://www.webserviceX.NET/GetInfoByZIP" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetInfoByCity">
<soap12:operation soapAction="http://www.webserviceX.NET/GetInfoByCity" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetInfoByState">
<soap12:operation soapAction="http://www.webserviceX.NET/GetInfoByState" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetInfoByAreaCode">
<soap12:operation soapAction="http://www.webserviceX.NET/GetInfoByAreaCode" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="USZipHttpGet" type="tns:USZipHttpGet">
<http:binding verb="GET" />
<wsdl:operation name="GetInfoByZIP">
<http:operation location="/GetInfoByZIP" />
<wsdl:input>
<http:urlEncoded />
</wsdl:input>
<wsdl:output>
<mime:content part="Body" type="text/xml" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetInfoByCity">
<http:operation location="/GetInfoByCity" />
<wsdl:input>
<http:urlEncoded />
</wsdl:input>
<wsdl:output>
<mime:content part="Body" type="text/xml" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetInfoByState">
<http:operation location="/GetInfoByState" />
<wsdl:input>
<http:urlEncoded />
</wsdl:input>
<wsdl:output>
<mime:content part="Body" type="text/xml" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetInfoByAreaCode">
<http:operation location="/GetInfoByAreaCode" />
<wsdl:input>
<http:urlEncoded />
</wsdl:input>
<wsdl:output>
<mime:content part="Body" type="text/xml" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="USZipHttpPost" type="tns:USZipHttpPost">
<http:binding verb="POST" />
<wsdl:operation name="GetInfoByZIP">
<http:operation location="/GetInfoByZIP" />
<wsdl:input>
<mime:content type="application/x-www-form-urlencoded" />
</wsdl:input>
<wsdl:output>
<mime:content part="Body" type="text/xml" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetInfoByCity">
<http:operation location="/GetInfoByCity" />
<wsdl:input>
<mime:content type="application/x-www-form-urlencoded" />
</wsdl:input>
<wsdl:output>
<mime:content part="Body" type="text/xml" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetInfoByState">
<http:operation location="/GetInfoByState" />
<wsdl:input>
<mime:content type="application/x-www-form-urlencoded" />
</wsdl:input>
<wsdl:output>
<mime:content part="Body" type="text/xml" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetInfoByAreaCode">
<http:operation location="/GetInfoByAreaCode" />
<wsdl:input>
<mime:content type="application/x-www-form-urlencoded" />
</wsdl:input>
<wsdl:output>
<mime:content part="Body" type="text/xml" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="USZip">
<wsdl:port name="USZipSoap" binding="tns:USZipSoap">
<soap:address location="http://www.webservicex.net/uszip.asmx" />
</wsdl:port>
<wsdl:port name="USZipSoap12" binding="tns:USZipSoap12">
<soap12:address location="http://www.webservicex.net/uszip.asmx" />
</wsdl:port>
<wsdl:port name="USZipHttpGet" binding="tns:USZipHttpGet">
<http:address location="http://www.webservicex.net/uszip.asmx" />
</wsdl:port>
<wsdl:port name="USZipHttpPost" binding="tns:USZipHttpPost">
<http:address location="http://www.webservicex.net/uszip.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>