简体   繁体   中英

How to pass Headers using HTTP component in Mule

Hi I am working with Any Point Studio and i want to pass headers with the current request with a key value pair How to achieve that using existing HTTP Component.

在此处输入图片说明

You can invoke the HTTP Inbound through Mule Client, here is an example:

MuleClient muleClient = new MuleClient(muleContext);
Map<String, Object> headers = new HashMap<String, Object>(1);
headers.put("key", "456453N123");
MuleMessage result = muleClient.send("http://localhost:8081/prm", PAYLOAD, headers);

The HTTP headers are in the inbound-scoped properties of the MuleMessage. To get the header from a flow, you can use:

<logger level="INFO" message="Header Content-Type = #[header:key]"/>

您还可以使用“属性”组件或“消息”属性来设置标头,以设置多个标头数据,如下所示:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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