1
Webサービス(WS)に接続したいとします。ただし、このWebサービスと対話するためには、クッキーを提供する必要があります。JavaのWebサービス呼び出しにCookieを手動で追加する方法はありますか。
これまでのところ、ここで私が持っているものです。
String requiredCookieName = "requiredCookieName";
String requiredCookieValue = getRequiredCookieValue();
// Prepare SOAP message
SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
soapMessage.getMimeHeaders().addHeader("SOAPAction", getSoapAction());
soapMessage.saveChanges();
// Send SOAP message
SOAPConnection soapConnection = buildSoapConnection();
SOAPBody soapBody = soapConnection
// How to add required cookie here before calling WS?
.call(soapMessage, getOperationLocation("operationName"))
.getSOAPBody();
// Process response...
私はWSへの基本的なHTTPリクエストに必要なCookieを追加することができますどのように?
も参照してください:https://coderanch.com/wiki/ 659769/Webサービス#http-headers – Stephan
参照:http://www.herongyang.com/Web-Services/SAAJ-addHeader-Set-SOAPAction-Header-Line.html – Stephan