How to manually add a cookie to a webservice call in Java?
问题 I want to connect to a webservice (WS). However, a cookie must be provided in order to interact with this webservice. So far, here is what I have: 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