我从端点处获得了正确的SOAP响应,但是如何从服务被单击时的SOAP响应中获取日期和时间呢?
soapRequest = createSoapMessage(wsRequestString);
soapConnFactory = SOAPConnectionFactory.newInstance();
soapConnection = soapConnFactory.createConnection();
URL endPoint = new URL(URL);
soapResponse = soapConnection.call(soapRequest, endPoint);
最佳答案
应该通过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");
您可以根据需要修改前三行。
关于java - 如何从SOAP响应中检索日期和时间?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37787749/