如何读取soap响应头

时间:2019-04-15 07:43:49

标签: php xml cookies soap header

从其中一个肥皂函数php获取响应,然后将此响应作为参数发送到另一个肥皂请求,然后我需要从响应头下方的前一个响应头中提取set-cookie。我需要阅读set-cookie JSESSIONID元素吗?

HTTP/1.1 200 OK

Set-Cookie: **JSESSIONID=9A977E193F9B505B084D95C3028BAD0C.srv1816**;

Path=/webservices

Content-Type: text/xml;charset=UTF-8

Transfer-Encoding: chunked

Date: Mon, 15 Apr 2019 07:38:52 GMT

Set-Cookie: aeroID=12988141315553139361555313936504655;Path=/;
Expires=Sun, 09-Feb-2020 07:38:56 GMT

1 个答案:

答案 0 :(得分:0)

您可以像这样读取JSESSIONID cookie:

首先获取您的Cookie:

import com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport
def cookieStore= HttpClientSupport.getHttpClient().getCookieStore()

然后只找到您感兴趣的人

def cookies = cookieStore.getCookies()
def jsessionidCookie
cookies.each {
    if(it.name == "JSESSIONID")
        jsessionidCookie= it
}