在SOAP UI请求中发送cookie作为请求头,用于休息Web服务 [英] Sending cookie as request header in SOAP UI request for rest web service

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

问题描述

我使用 SOAP UI 工具测试 Rest API

首先,我打开了另一个API,它给了我 jSessionid ,然后在我的实际请求中,我通过名称向请求头添加了一个参数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:

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.

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

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