使用到的ohHttp.jar下载地址:https://download.youkuaiyun.com/download/qq_37160920/10576350
根据提供的webServiceUrl,methodName,调用接口,并处理返回的xml格式的结果.
代码可以使用postMan生成:
@Test
public void checkValue() {
String url = "http://127.0.0.1:8001/portal.integration/service/IntegrateService";
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("text/xml");
//设置soap请求头,并设置方法名和参数
RequestBody body = RequestBody.create(mediaType, "<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xxx=\"http://tempuri.org/xxx.xsd\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\r\n <soapenv:Header></soapenv:Header>\r\n <soapenv:Body>\r\n <xxx:checkValue xmlns=\"http://www.w3.org/2001/XMLSchema\">\r\n <sId>12