今天有個任務(wù),要將現(xiàn)場環(huán)境的wsdl接口的數(shù)據(jù)采回來,本地不能訪問現(xiàn)場,只能通過mstsc機(jī)器遠(yuǎn)程.
1遠(yuǎn)程把wbeservice頁面內(nèi)容另存回來
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放到遠(yuǎn)程機(jī)上,執(zhí)行bat
哈哈 ? ok了