- 获取到HttpClientUtils.jar
上传到erp服务器
cd $TOP/utl/java/jar
rz
上传jar包
添加环境变量
cd u1/etc
vim topenv
#HttpClientUtils CLASSPATH=$TOP/utl/java/jar/HttpClientUtils.jar:$CLASSPATH;export CLASSPATH
:wq
保存并退出
- 重新打开xshell,进入jar文件夹,输入
java -jar HttpClientUtils.jar
,有输出,则说明正常 修改T100程序
导入jar包
IMPORT JAVA HttpClientUtils.HttpClientUtils IMPORT JAVA java.util.Hashtable
目前为止该jar包中有7个方法
sendGetRequest(String reqURL, String decodeCharset)
- 参数
地址
、解码字符集
返回值 string类型
回传内容
DEFINE re STRING LET re = HttpClientUtils.sendGetRequest("http://172.16.100.42/wstopprd/ws/r/awsp900?WSDL","utf-8") DISPLAY re
- 参数
sendGetRequest(String reqURL, Map<String, String> heads, String decodeCharset)
- 参数
地址
、header
、解码字符集
返回值 string类型
回传内容
DEFINE re STRING DEFINE heads Hashtable LET heads = Hashtable.create() CALL heads.put("accept","*/*") CALL heads.put("connection","Keep-Alive") CALL heads.put("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36") LET re = HttpClientUtils.sendGetRequest("http://172.16.100.42/wstopprd/ws/r/awsp900?WSDL",heads,"utf-8") DISPLAY re
- 参数
sendPostRequest(String reqURL, String decodeCharset)
- 参数
地址
、解码字符集
返回值 string类型
回传报文
DEFINE re STRING LET re = HttpClientUtils.sendPostRequest("http://172.16.100.42/wstopprd/ws/r/awsp920?WSDL","utf-8") DISPLAY re
- 参数
sendPostRequest(String reqURL, Map<String, String> heads, String decodeCharset)
- 参数
地址
、header
、解码字符集
返回值 string类型
回传报文
DEFINE re STRING DEFINE heads Hashtable LET heads = Hashtable.create() CALL heads.put("accept","*/*") CALL heads.put("connection","Keep-Alive") CALL heads.put("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36") LET re = HttpClientUtils.sendPostRequest("http://172.16.100.42/wstopprd/ws/r/awsp920?WSDL",heads,"utf-8") DISPLAY re
- 参数
sendPostRequest(String reqURL, Map<String, String> params, String encodeCharset, String decodeCharset)
- 参数
地址
、params参数
、编码字符集
、解码字符集
返回值 string类型
回传报文
DEFINE re STRING DEFINE params Hashtable LET params = Hashtable.create() CALL params.put("account","admin") CALL params.put("password","123456") LET re = HttpClientUtils.sendPostRequest("http://172.16.100.42/wstopprd/ws/r/awsp920?WSDL",params,"utf-8","utf-8") DISPLAY re
- 参数
sendPostRequest(String reqURL, Map<String, String> heads, Map<String, String> params, String encodeCharset, String decodeCharset)
- 参数
地址
、header
、params参数
、编码字符集
、解码字符集
返回值 string类型
回传报文
DEFINE re STRING DEFINE heads Hashtable DEFINE params Hashtable LET heads = Hashtable.create() CALL heads.put("accept","*/*") CALL heads.put("connection","Keep-Alive") CALL heads.put("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36") LET params = Hashtable.create() CALL params.put("account","admin") CALL params.put("password","123456") LET re = HttpClientUtils.sendPostRequest("http://172.16.100.42/wstopprd/ws/r/awsp920?WSDL",heads,params,"utf-8","utf-8") DISPLAY re
- 参数
sendPostByJson(String url, Map<String, String> heads, String body)
- 参数
地址
、header
、json形态的字符串
返回值 string类型
回传报文
DEFINE re STRING DEFINE heads Hashtable DEFINE body STRING LET heads = Hashtable.create() CALL heads.put("accept","*/*") CALL heads.put("connection","Keep-Alive") CALL heads.put("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36") LET body = '{"account":"admin","password":"123456"}' LET re = HttpClientUtils.sendPostByJson("http://172.16.100.42/wstopprd/ws/r/awsp920?WSDL",heads,body) DISPLAY re
- 参数
END
Last modification:February 8th, 2022 at 11:26 am
© 允许规范转载