python利用suds調用webservice接口

1、安裝suds 

下載安裝包:https://pypi.org/simple/suds/

上傳服務器,解壓安裝

2、創建客戶端

[root@009025000 ~]# python
Python 3.6.6 (default, Jul  4 2018, 15:26:10) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.
 
In [1]: from suds.client import Client
 
In [2]: headers={'Content-Type':'application/soap+xml;charset="UTF-8"'}
 
In [3]: client=Client('http://192.168.15.106/services/HrmService?wsdl',headers=headers,faults=False,timeout=15)

3、查詢接口方法

In [4]: print(client)
 
Suds ( https://fedorahosted.org/suds/ )  version: 0.6
 
Service ( HrmService ) tns="http://localhost/services/HrmService"
   Prefixes (1)
      ns0 = "http://webservice.hrm.weaver"
   Ports (1):
      (HrmServiceHttpPort)
         Methods (1):
            getH
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章