In the previous article we showed how to use the suds library in Python to access SOAP web services. Here are some extra examples of public SOAP web services. Some of the outputs are edited for readability. We start with a recap of the one we used in the previous article.
Map IP address to country
import suds url = "http://www.ecubicle.net/iptocountry.asmx?wsdl" client = suds.client.Client(url) print client.service.FindCountryAsString("194.145.200.104")
<?xml version="1.0"?> <IPAddressService> <country>Netherlands</country> </IPAddressService>
Country Information
import suds url = "http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL" client = suds.client.Client(url) print client.service.ListOfCountryNamesByCode() print client.service.CountryISOCode("Netherlands") print client.service.CapitalCity("NL") print client.service.CountryCurrency("NL")
(ArrayOftCountryCodeAndName){ tCountryCodeAndName[] = (tCountryCodeAndName){ sISOCode = "AD" sName = "Andorra" }, ... (tCountryCodeAndName){ sISOCode = "ZW" sName = "Zimbabwe" }, } NL Amsterdam (tCurrency){ sISOCode = "EUR" sName = "Euro" }
Whois Service
import suds url = "http://www.ecubicle.net/whois_service.asmx?WSDL" client = suds.client.Client(url) print client.service.Whois("whois.tucows.com", 43, "google.com")
Whois Server Version 2.0 Domain names in the .com and .net domains can now be registered with many different competing registrars. Go to http://www.internic.net for detailed information. Domain Name: GOOGLE.COM Registrar: MARKMONITOR INC. ...
ISBN Test
import suds url = "http://webservices.daehosting.com/services/isbnservice.wso?WSDL" client = suds.client.Client(url) print client.service.IsValidISBN13("9789059650886")
True
US Zip Validator
import suds url = "http://www.webservicemart.com/uszip.asmx?WSDL" client = suds.client.Client(url) print client.service.ValidateZip("90210")
<result code="200"> <item zip="90210" state="CA" latitude="34.0888" longitude="-118.40612" /> </result>
Number Conversion
import suds url = "http://www.dataaccess.com/webservicesserver/numberconversion.wso?WSDL" client = suds.client.Client(url) print client.service.NumberToWords(2931)
two thousand nine hundred and thirty one