这是获取并保存cookie的部分代码:
HttpTransportSE transport = new HttpTransportSE(url);
try {
// 调用WebService
String headerKey = "";
String headerValue = "";
List headerList = transport.call(soapAction, envelope, null);
for(Object header :headerList){
HeaderProperty headerProperty = (HeaderProperty) header;
headerKey = headerProperty.getKey();
headerValue = headerProperty.getValue();
if(headerKey!= null && headerKey.equals("Set-Cookie")){
YIFULI.cookie = headerValue;
}
}
} catch (Exception e) {
e.printStackTrace();
}