简体   繁体   中英

BizTalk WCF-WebHttp - Send header value from the orchestration variable

In my BizTalk application I have a API call (WCF-WebHttp) for which I need to pass a sessionid which is generated from by calling another service. So I have created a WCF-WebHttp send port and it returns the session id to orchestration. Now I need to pass this sessionid value from orchestration to a send port (WCF-WebHttp static port) and this sessionid will be used in headers of this API call.

I generally configure headers in Outbound http headers in message tab of WCF-webhttp port. But here I can give only static headers. So how can I pass the sessionid header to the service (wcf-webhttp static port) with value which I get from orchestration. Do I need to use dynamic ports for this or can I achieve this in static port? How it can be achieved?

Something like below can help

xPathString = System.String.Format("string(/ [local-name()='loginResponse' and namespace-uri()='urn:enterprise.soap.sforce.com']/ [local-name()='result']/*[local-name()='sessionId']/text())"); sessionId = xpath(LoginResponse.parameters, xPathString);

APIMUrl = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

SalesforceCallBackRequest(WCF.HttpMethodAndUrl) = "POST"; SalesforceCallBackRequest(WCF.HttpHeaders) = "Content-Type:application/json" + System.Environment.NewLine +"Ocp-Apim-Subscription-Key: XXXXXXXXXXXXXXXXXXXXXXXXX" + System.Environment.NewLine +"Authorization: Bearer " + sessionId;

SalesforceCallBackRequest(WCF.BindingType) = "basicHttpBinding"; SalesforceCallBackRequest(WCF.SecurityMode) = "Transport";

Port_APIM(Microsoft.XLANGs.BaseTypes.Address) = APIMUrl; Port_APIM(Microsoft.XLANGs.BaseTypes.TransportType) = "WCF-BasicHttp";

Try with MessageOutput(WCF.HttpHeaders) or MessageOutput(HTTP.InboundHttpHeaders) or something similar. I succeded to do that some months ago but now I don't remember which method was exactly. Anyway it will return a value as string and then you should parse that string to retrieve the header that you want

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