简体   繁体   English

Mule将JSESSIONID从第一个REST请求设置为第二个REST请求或如何将cookie放入其中

[英]Mule Set JSESSIONID from first into 2nd REST request or how to put the cookie through

for my Thesis I'm integrating Bonita BPM into a Mule SOA. 对于我的论文,我正在将Bonita BPM集成到Mule SOA中。

To start a new case or process-instance in Bonita I have to call the Bonita REST. 要在Bonita中启动新案例或流程实例,我必须调用Bonita REST。 First I have to authenticate with that Bonita REST. 首先,我必须使用Bonita REST进行身份验证。 And here starts my problem. 这里开始我的问题。

The authentication works like "You have to call the loginservice and put the responding cookie in all future request". 身份验证的工作方式类似于“您必须调用loginservice并将响应cookie放在以后的所有请求中”。

How could this be done inside a mule flow ? 怎么可能在骡子流中完成? Some articles told me that copy-properties propertyName="JSESSIONID" should do that. 有些文章告诉我,copy-properties propertyName =“JSESSIONID”应该这样做。 But this does not work. 但这不起作用。

Does anybody have a idea ? 有人有想法吗?

Further heres my flow and the related print messages: 继续我的流程和相关的打印消息:

PRINT1 : CopyPropertiesTransformer: Property value for is null, no property will be copied PRINT1:CopyPropertiesTransformer:属性值为null,不会复制任何属性

PRINT 2 : LoggerMessageProcessor: {Set-Cookie=JSESSIONID=F60114E3ECB450A62171E3D63EAC3E4D; PRINT 2:LoggerMessageProcessor:{Set-Cookie = JSESSIONID = F60114E3ECB450A62171E3D63EAC3E4D; Path=/bonita/; 路径= /博尼塔/; HttpOnly} 仅Http}

PRINT 3 : Response code 401 mapped as failure. 打印3:响应代码401映射为失败。 Message payload is of type: BufferInputStream 消息有效内容的类型为:BufferInputStream

<http:request-config name="bos" host="localhost"
    port="8080" basePath="/bonita" doc:name="bos-connection" />


<flow name="sendOrderFlow">

    <http:listener config-ref="HTTP_Listener_Configuration"
        path="/" doc:name="HTTP" />

    <http:request config-ref="bos" path="loginservice"
        method="GET" followRedirects="false" doc:name="bos-login">
        <http:request-builder>
            <http:query-param paramName="username" value="walter.bates" />
            <http:query-param paramName="password" value="bpm" />
        </http:request-builder>

    </http:request>

    <copy-properties propertyName="JSESSIONID" /> <!-- PRINT 1 HERE -->
    <logger message="#[headers:INBOUND:Set-Cookie]" level="INFO" />  <!-- PRINT 2 HERE -->

    <http:request config-ref="bos"
        path="API/bpm/process" method="GET" followRedirects="false" doc:name="bos-listAvailableProcesses">
        <http:request-builder>
            <http:query-param paramName="p" value="0" />
        </http:request-builder>
    </http:request>

Additionally to JSESSIONID you also need to include X-Bonita-API-Token in HTTP header. 除了JSESSIONID之外,您还需要在HTTP标头中包含X-Bonita-API-Token。 The value of this header is provide as a cookie sent with the answer to the authentication (ie the call to loginservice). 此标头的值作为cookie发送,其中包含对身份验证的答案(即对loginservice的调用)。

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

相关问题 如何在REST服务的请求标头中设置cookie - How to set cookie in request header for REST service 如何在MULE中的REST Web服务中映射JSON请求? - How to map JSON request in REST webservice in MULE? 如何使用ContainerRequestContext从HTTP请求获取JSESSIONID? - How to get the JSESSIONID from a HTTP request using ContainerRequestContext? 在WCF中使用REST GET作为第二个端点 - Using REST GET in WCF as 2nd endpoint 如何在m子中的https请求中设置标头 - How to set headers in https request in mule 隐藏REST API:如何在差异中指定第二个提交ID? - stash REST API: how do you specify the 2nd commit ID in a diff? 我如何在Mule中接收REST API请求? - How can i receive the REST API request in Mule? 如何在angular 2应用程序中读取服务器设置cookie,以及如何在angular 2应用程序的请求中发送相同的cookie? - How to read server set cookie in angular 2 application, and how to send same cookie in request from angular 2 application? Netsuite - REST API (restlet) - 创建记录导致第二次和更多记录请求失败 INVALID_LOGIN_ATTEMPT - Netsuite - REST API (restlet)- creating record causes INVALID_LOGIN_ATTEMPT failure on the 2nd and more request for records 如何将JSON值从REST POST响应传输到SOAPUI中的REST PUT请求 - How to Transfer a JSON value from a REST POST Response to a REST PUT Request in SOAPUI
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM