将 cookie 作为 SOAP UI 请求中的请求标头发送到其余 Web 服务 [英] Sending cookie as request header in SOAP UI request for rest web service

查看:36
本文介绍了将 cookie 作为 SOAP UI 请求中的请求标头发送到其余 Web 服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 SOAP UI 工具测试 Rest API.

I am testing a Rest API using SOAP UI tool.

首先,我点击了另一个给我 jSessionid 的 API,然后在我的实际请求中,我向请求标头中添加了一个名为 "Cookie" 的参数,并提供它是上面提取的 jsessionid 值.一切正常.

First, I hit another API which gave me the jSessionid and then in my actual request I added a parameter to the request header by the name "Cookie" and provide it the above extracted jsessionid value. Everything worked fine.

我想要的是以某种方式在请求标头中动态设置 cookie/jessionid,而无需显式/手动执行此操作.

What I want is to somehow dynamically set the cookie/jessionid in request header without explicitly/manually doing it.

怎么做?

推荐答案

您可以从 UI 创建应用程序会话并使用 cookie 来保存会话.使用浏览器的开发者工具从浏览器获取会话 cookie 详细信息.该图像显示了 cookie 在浏览器中的可用位置:

You can create a application session from the UI and use cookies that save the session. Get the session cookie details from the browser using the developer tools of the browser. The image shows where the cookies are available in the browser :

在soapUI 中创建一个与您从浏览器获得的值相同的标头属性并运行请求.请求将使用保存在 cookie 中的相同会话 id(JSESSIONID) 来运行请求.下图显示了如何将 cookie 值添加到标头中.

In soapUI create a header attribute with the same value you obtained from the browser and run the request. The request will use the same session id(JSESSIONID) that is saved in the cookie to run the request. The below images shows how to add the cookie value to the header.

这篇关于将 cookie 作为 SOAP UI 请求中的请求标头发送到其余 Web 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆