今天有个任务,要将现场环境的wsdl接口的数据采回来,本地不能访问现场,只能通过mstsc机器远程.
1远程把wbeservice页面内容另存回来
2使用python把wsdl地址解析回来
f =open('webservice.htm', 'r', encoding='utf-8')
all_str =''
for xxxin f.readlines():
all_str += xxx
读取全部文字
pattern =r'(?<=\bhref=").+?(?<=wsdl)'
htm1 = re.findall(pattern, all_str)# 按段落匹配 找到http://xxxxxxxxxxxxxx/xxx.wsdl
s1 =''
i =1
for xxxin htm1:
xx ='' + xxx;
if xx.index('http') ==0:
ii=str(i)
s = getValue(xxx, 'services/', '/?wsdl')
s = s.replace('?', '')
生成 shell语句
s1 +='echo '+ii+'\r\necho '+s+' \r\ncall ./xx/' + ii +'.bat \r\n'
# s1 += 'timeout 15 \r\n'
s2 ='echo '+s+' \r\nwsdl2java -b bindingfile.xml -p com.xxx.wsdl.' + s +' -d src -encoding utf-8 -all ' + xxx +"\r\n"
ff =open('./xx/' + ii +'.bat', 'w+', encoding='utf-8')
ff.write(s2)
ff.close()
i +=1
f.close()
ff =open('xx.bat', 'w', encoding='utf-8')
ff.write(s1)
ff.close()
print(s1)
3把bat放到远程机上,执行bat
哈哈 ok了