操作步骤:
1)安装suds:在命令行输入easy_install suds
2)编写webservice客户端代码,非常简单,只有2步:
创建client: client = suds.client.Client(url)
调用webservice接口提供的方法:result = client.service.方法名(参数)
示例代码:
1)安装suds:在命令行输入easy_install suds
2)编写webservice客户端代码,非常简单,只有2步:
创建client: client = suds.client.Client(url)
调用webservice接口提供的方法:result = client.service.方法名(参数)
示例代码:
#coding=utf-8
'''
Created on 2015-1-2
@author: kite
'''
import suds
#检查手机号归属地
url = 'http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl'
clientPH = suds.client.Client(url)
print clientPH
result = clientPH.service.getMobileCodeInfo(18611217787) #这个号码是办证的,拿来测试,哈哈
print result # 返回 18611217787:北京 北京 北京联通GSM卡
print clientPH.last_received()
#检查QQ是否在线
url2='http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?wsdl'
clientQQ=suds.client.Cli