https://blog.csdn.net/Peng_Hong_fu/article/details/80113196
记录测试代码
SoapUI
调用路径
http://localhost:8082/*/webservices/**Service?wsdl
import org.apache.commons.lang.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.xpath.DefaultXPath;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Base64;
import java.util.Collections;
import java.util.List;
/**
* 模拟soapUI调用WebService,解析返回报文
* Created by PengHongfu 2018-04-26 15:36
*/
public class TestSoap {
//测试环境地址
public static String INVOICE_WS_URL = "http://localhost:8082/*/webservices/**Service";
public static void main(String[] args) throws Exception {
String sid = "SID值";
String content = "报文内容,jOSN格式";
String tranSeq = "UUID";
String tranReqDate = "2018-04-24";
StringBuffer stringBuffer = testWebService(sid, content, tranSeq, tranReqDate);
// 打印HTTP响应数据
System.out.println(stringBuffer);
//处理返回数据
String xmlResult = stringBuffer.toString().replace("<", "<");
String rtnCode = getXmlMessageByName(xmlResult, "rtnCode");//报文返回状态码,0表示正常,3表示错误
String message = getXmlMessageByName(xmlResult, "message");//返回信息,主要是状态码不正常时抛出
String body = getXmlMessageByName(xmlResult,