我从端点获得了正确的SOAP响应,但是如何在服务被命中时从SOAP响应中获取日期和时间?
soapRequest = createSoapMessage(wsRequestString);
soapConnFactory = SOAPConnectionFactory.newInstance();
soapConnection = soapConnFactory.createConnection();
URL endPoint = new URL(URL);
soapResponse = soapConnection.call(soapRequest, endPoint);
答案 0 :(得分:0)
应该通过HTTP标头完成。在Java中你可以这样。
import org.apache.http.HttpResponse;
String getURL = "your_url";
HttpGet get = new HttpGet(getURL);
HttpResponse responseGet = client.execute(get);
String DateTime = responseGet.getHeaders("Date");
您可以根据自己的要求挑选前3行。
答案 1 :(得分:0)
soapRequest = createSoapMessage(wsRequestString);
soapConnFactory = SOAPConnectionFactory.newInstance();
soapConnection = soapConnFactory.createConnection();
URL endPoint = new URL(URL);
soapResponse = soapConnection.call(soapRequest, endPoint);
String[] str = soapResponse.getMimeHeaders().getHeader("Date");
System.out.println(str[0]);