python 訪問webservice

來源:互聯網
上載者:User

標籤:更新   net   password   pass   ebs   max   word   import   json   

<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">如今最流行的就是suds了,可是裡面仍然有很多bug未修複。也好像沒有人更新了</span>

import sysfrom suds.client import Clientsys.setrecursionlimit(1500)test_url = ‘http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl‘url = ‘http://localhost/IdentifierService.svc?

wsdl‘client = Client(url, cache=None)

suds確實簡單易用

可是執行後有錯誤,其它的wsdl地址卻沒有問題

google中還發現suds與.net平台似乎有一點的不相容

而這個wsdl就是.net平台的,萬惡的.net

不能說常見吧,可是我第一次用就碰到了 runtimeerror: maximum recursion depth exceeded

意思就是遞迴過深,python預設的遞迴深度是1000

你能夠通過改動深度值,可是無濟於事

import sys

sys.setrecursionlimit(1500)


最後僅僅好換工具。用了SOAPy,SOAPpy,pysimplesoap,soaplib真是快用一遍了

最後僅僅有ZSI可用

from ZSI import ServiceProxyurl = ‘http://localhost/IdentifierService.svc?wsdl‘proxy = ServiceProxy.ServiceProxy(url)#是兩個ServiceProxyperson = "{    ‘IDNumber‘: ‘4123412412423‘,    ‘Name‘: ‘張三‘}"account = "{    ‘UserName‘: ‘admin‘,    ‘Password‘: ‘123456‘}"response = proxy.ExactCheckByJson(request=person, cred=account)
當中ExactCheckJson是webservice提供的服務

並且參數必須是這個形式的,假設直接上參數,就會報ypeError: Not supporting SOAPENC:Arrays or XSD:List的錯誤

然後我的request跟cred是借口文檔提供的。還不能變~


python 訪問webservice

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.