简体   繁体   English

使用 Http 连接器/自定义逻辑应用连接器发送 Cookie

[英]Sending Cookie using Http connector/custom logic app connector

I am trying to invoke a session based webservice from Azure Logic apps which requires session id from authentication request to be sent as a cookie for actual request.我正在尝试从 Azure 逻辑应用程序调用基于 session 的 Web 服务,该应用程序需要 session 来自身份验证请求的实际请求 ID 作为 a.cookie 发送I am able to authenticate and recieve session id successfully, however when i try to send it as cookie in the next step, it is unsuccessful.我能够成功验证并接收 session id,但是当我尝试在下一步中将其作为 cookie 发送时,它不成功。 Tried below options and got respective responses:尝试了以下选项并得到了相应的响应:

  1. Using HTTP connector -> gave me 'Unresolvablehostname'使用 HTTP 连接器 -> 给了我“无法解析的主机名”
  2. using custom logic app connector, with on-premises gateway checked and 'http' option -> SOAP Fault and upon looking at destination logs we could see that Cookie was empty.使用自定义逻辑应用程序连接器,检查本地网关和“http”选项 -> SOAP 故障,查看目标日志时,我们可以看到 Cookie 为空。 I have tried sending "Cookie" in headers as well as a parameter but no luck.我曾尝试在标头和参数中发送“Cookie”,但没有运气。
  3. using custom logic app connector, with on-premises gateway checked and 'https' option -> certification error and i understand https is not configured and hence wouldn't work.使用自定义逻辑应用程序连接器,检查本地网关和“https”选项 - > 认证错误,我了解 https 未配置,因此无法工作。

I tried from SOAP UI and it works when I send cookie in header of the request.我从 SOAP UI 尝试过,当我在请求的 header 中发送 cookie 时它可以工作。 or if I check the 'keep same session' box in SOAP UI.或者,如果我选中 SOAP UI 中的“保持同一会话”框。 But fails with Logic App.但使用 Logic App 失败。 could you please help me on how to send cookie from Logic App.您能帮我了解如何从 Logic App 发送 cookie。 where is it getting missed although I am setting it in my application.尽管我在我的应用程序中设置了它,但它在哪里被遗漏了。

The Add new parameter dropdown allows you to enable a checkbox that says Cookie that enables you to enter the HTTP cookie (from dynamic content if you want to). Add new parameter下拉菜单允许您启用一个显示Cookie的复选框,该复选框使您能够输入 HTTP cookie(如果您愿意,可以从动态内容中输入)。 You cannot enter the value straight in the dropdown, so close it down after you selected the checkbox and see a magic Cookie field appear underneath the Authentication field.您不能直接在下拉列表中输入值,因此请在选中复选框后将其关闭,然后在“身份验证”字段下方看到一个神奇的 Cookie 字段。

在此处输入图像描述

More information to be found here: How to call an API with cookie authentication from a Logic App .可在此处找到更多信息: 如何使用来自逻辑应用的 cookie 身份验证调用 API

Here is the answer: You can use HTTP connectors only for a published service.If you are trying to invoke an internal service below is the response from Microsoft team.答案如下:您只能将 HTTP 连接器用于已发布的服务。如果您尝试调用内部服务,下面是 Microsoft 团队的响应。 In short - HTTP connectors do not use gateway so you cannot establish connection & custom connectors do not suppport Cookies.简而言之 - HTTP 连接器不使用网关,因此您无法建立连接并且自定义连接器不支持 Cookies。 I would choose option 4 from below.我会从下面选择选项 4。 Hope this helps:希望这可以帮助:

  1. HTTP action does not support on-premise data gateway, so the hostname or ip could not be resolved because the HTTP action always talks to public network. HTTP 操作不支持本地数据网关,因此无法解析主机名或 ip,因为 HTTP 操作始终与公共网络通信。
  2. If you could use custom connector to connect to on-premise data gateway, you should not get the unresolvedhostname issue.如果您可以使用自定义连接器连接到本地数据网关,则不应出现未解决的主机名问题。 However, the custom connector does not support Cookie authentication, that's why you could not get it through.但是,自定义连接器不支持 Cookie 身份验证,这就是您无法通过的原因。
  3. One workaround is using application gateway to reverse proxy services and publish your on-premise server to public.一种解决方法是使用应用程序网关来反向代理服务并将您的本地服务器发布到公众。 It would act like an VPN and you could use HTTP action in logic app to establish connection.它就像一个 VPN,您可以在逻辑应用程序中使用 HTTP 操作来建立连接。
  4. Another workaround is trying to use Function App to make the HTTP request with Cookies另一种解决方法是尝试使用 Function 应用程序通过 Cookies 发出 HTTP 请求

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM