码迷,mamicode.com
首页 > 编程语言 > 详细

python调用SOA服务

时间:2015-07-08 18:07:01      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:

python调用SOA服务,运用suds模块

#! /usr/bin/python
# coding:gbk
import suds,time,sys
reload(sys)
sys.setdefaultencoding( "utf-8" )
LOG_PATH = r".\TestLog"+time.strftime(r%Y-%m-%d, time.localtime(time.time()))+".txt"


def TestService():
        url=‘服务的WSDL链接地址
        client = suds.client.Client(url)
        param1=dict(X=123)
        result1=client.service.METHODNAME1(param1)
        writeLog(‘METHODNAME1,result1)

def writeLog(methodname,result): ‘‘‘写日志‘‘‘ with open(LOG_PATH,"a") as testLog: content = time.strftime(r%X, time.localtime(time.time())) + "\t|" +methodname + "\n" for item in result: content=content+\t|+str(item) testLog.writelines(+*60+"\n") testLog.writelines(content) testLog.write("\n") testLog.close() if __name__=="__main__": TestService()

 

python调用SOA服务

标签:

原文地址:http://www.cnblogs.com/hito/p/4630610.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!