0
Msg_Get_AccessToken = "";
Msg_Get_AccessToken(GUID) = ...;
Msg_Get_AccessToken(WebServiceHost) = "http://...";
Msg_Get_AccessToken(WCF.VariablePropertyMapping)= @"<?xml version='1.0' encoding='utf-16'?>
<BtsVariablePropertyMapping xmlns:xsi='http://www...' xmlns:xsd='http://www...'>
<Variable Name='var_GUID' PropertyName='GUID' PropertyNamespace='https://...'/>
</BtsVariablePropertyMapping">;
Msg_Get_AccessToken(WCF.BindingType)="WCF-WebHTTP";
Msg_Get_AccessToken(WCF.SecurityMode)="Transport";
Msg_Get_AccessToken(WCF.HttpMethodAndUrl)=@"<BtsHttpUrlMapping> <Operation Method='POST' Url='{var_GUID}'  /></BtsHttpUrlMapping>";
Msg_Get_AccessToken(WCF.HttpHeaders) = "Content-Type:application/x-www-form-urlencoded"+"grant_type=client_credentials&client_id=123&client_secret=3456&scope=https://...";
Msg_Get_AccessToken(WCF.SuppressMessageBodyForHttpVerbs)="POST";
Msg_Get_AccessToken(WCF.SecurityMode)="None";
Msg_Get_AccessToken(WCF.TransportClientCredentialType)="None";
Msg_Get_AccessToken(WCF.MaxReceivedMessageSize)=2147483647;
Msg_Get_AccessToken(BTS.RetryCount) = 5;
Msg_Get_AccessToken(BTS.RetryInterval) = 5;
Msg_Get_AccessToken(BTS.IsDynamicSend) = true;
P_GET_ACCESSTOKEN(Microsoft.XLANGs.BaseTypes.Address)=Msg_Get_AccessToken(WebServiceHost);
P_GET_ACCESSTOKEN(Microsoft.XLANGs.BaseTypes.TransportType)="WCF-WebHttp";

This is not working! I don't know how to transfer the information

"Content-Type:application/x-www-form-urlencoded"+"grant_type=client_credentials&client_id=1234&client_secret=5678&scope=https://..."; 

to the dynamic send port

Does anyone know how this might be done for the dynamic wcf-http send port?

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
BenjaminR
  • 23
  • 4
  • "It is not working" is not a good problem description. What debugging have you done? What error messages do you get? Have you tried using Fiddler or Wireshark to inspect the payload? – Dijkgraaf Feb 14 '22 at 21:03
  • What is the reason you are using a Dynamic Port? – Dijkgraaf Feb 17 '22 at 22:05

1 Answers1

0

We get access token with a WCF-behavior. Is that possible for you? See: Token behavior in BizTalk

Martin Bring
  • 1,176
  • 1
  • 7
  • 17
  • Unfortunately you can't add a WCF-Behavior to a Dynamic Port – Dijkgraaf Feb 17 '22 at 21:02
  • Can you make it static, add the behavior, and make it dynamic as a first code line in the code above? sendport.IsDynamic = true? I think that's a possible "workaround". msg.Context.Promote(“IsDynamicSend”, “http://schemas.microsoft.com/BizTalk/2003/system-properties”, true); See more on: https://jamescorbould.wordpress.com/2014/06/17/using-a-static-send-port-like-a-dynamic-send-port/ – Martin Bring Feb 18 '22 at 08:12
  • I expect that making it static is exactly what they need to do, which is why I questioned them trying to do it with a Dynamic port, no answer from them yet. P.S. James Corbould is a colleague of mine,. – Dijkgraaf Feb 19 '22 at 07:14
  • Unfortunately I cannot make it static, add the behavior, and make it dynamic. – BenjaminR Feb 23 '22 at 08:25
  • Now I wrote a C# method with Restsharp to get the token, that works – BenjaminR Feb 23 '22 at 08:27
  • Then I wrote a similar C# method to test the URL with the token with Restsharp but I always recieve a NullReferenceException, Object reference not set to an instance of an object, do you have an idea why ? – BenjaminR Feb 23 '22 at 08:30
  • I created a new question for this ! https://stackoverflow.com/questions/71234007/biztalk-2019-using-c-sharp-restharp-methode-in-biztalk-throws-nullreferenceexc – BenjaminR Feb 23 '22 at 09:04
  • @Martin Bring I tried to do it with WCF-behavior from the Salesforce Example but I only found the AuthEndpoint to get the Token, but where in this code I do set the URL I send with the Token ? – BenjaminR Mar 01 '22 at 12:31
  • HttpRequestMessageProperty httpRequest = null; WebHeaderCollection headers = httpRequest.Headers; FetchOAuthToken(); headers.Add(HttpRequestHeader.Authorization, "Bearer " + this.token_.access_token); headers.Add(HttpRequestHeader.Accept, "application/jason"); return null; – BenjaminR Mar 01 '22 at 12:33
  • @BenjaminR, the destination URL is set as an URI in the dynamic send port. – Martin Bring Mar 07 '22 at 15:03