WEB开发网
开发学院软件开发Python Python Web 服务开发人员: 现实世界,第一部分 阅读

Python Web 服务开发人员: 现实世界,第一部分

 2007-03-29 12:42:00 来源:WEB开发网   
核心提示: 这时,我们可以简单地使用 SOAPpy 中的 SOAPProxy 对象,Python Web 服务开发人员: 现实世界,第一部分(5),而不用显式地创建 SOAP 信封(envelope)并通过 HTTP 发送它,如果为 Web 服务指定了可调用的 URL 和适当的命名空间,与 WSDL

这时,我们可以简单地使用 SOAPpy 中的 SOAPProxy 对象,而不用显式地创建 SOAP 信封(envelope)并通过 HTTP 发送它。如果为 Web 服务指定了可调用的 URL 和适当的命名空间,那么 SOAPpy 就可以用 Python 的动态绑定,来把调用参数甚至方法名称( doGoogleSearch( ) )编组为代理服务对象上的一个远程过程调用。然后,就可以访问响应,因为它作为一个聚合对象,与 WSDL 中所指定的 GoogleSearchResult 结构是相匹配的。为了显示这个结果,我们直接访问 results 对象的特性。

清单6. 清单5的结果

[scott@daedalus google_test]$ python google_test.py
google search for " spotted owl "
estimated result count: 117000
      search time: 0.070122
results 1 - 10:
title: Spotted Owl
 url: http://www.mbr-pwrc.usgs.gov/id/framlst/i3690id.html
title: Mexican Spotted Owl - Home
 url: http://mso.fws.gov/
title: EO Study: Spotting the Spotted Owl
 url: http://earthobservatory.nasa.gov/Study/SpottedOwls/
title: Western Spotted Owl Printout- EnchantedLearning.com
 url:
 http://www.enchantedlearning.com/subjects/birds/printouts/Spottedowlprintout.shtml
title: Northern Spotted Owl
 url: http://biology.usgs.gov/s+t/SNT/noframe/pn172.htm
title: AMNH - Expedition : Endangered url: http://www.amnh.org/nationalcenter/Endangered/owl/owl.html
title: Northern Spotted Owl - USFS History - Forest History Society
 url: http://www.lib.duke.edu/forest/usfscoll/policy/northern_spotted_owl/
title: North American Owl Identification Guide
 url: http://www.owlinstitute.org/owls/spotted.html
title: Spotted Owls - Strix occidentalis
 url: http://www.owlpages.com/species/strix/occidentalis/Default.htm
title: The Northern Spotted Owl Debate
 url: http://www.spa3.k12.sc.us/WebQuests/endangeredanimals/endangered.htm

上一页  1 2 3 4 5 6  下一页

Tags:Python Web 服务

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接