BizTalk 2016: Using an HTTP Send Adapter with an API Token

I need to make calls to the rest API service through the BizTalk Send adapter. The API simply uses the token in the header for authentication / authorization. I tested this in a C # console application using httpclient and it works fine:

string apiUrl = "https://api.site.com/endpoint/<method>?";
        string dateFormat = "dateFormat = 2017-05-01T00:00:00";

        using (var client = new HttpClient())
        {

            client.DefaultRequestHeaders.Add("token", "<token>");
            client.DefaultRequestHeaders.Add("Accept", "application/json");

            string finalurl = apiUrl + dateFormat;
            HttpResponseMessage resp = await client.GetAsync(finalurl);
            if (resp.IsSuccessStatusCode)
            {
                string result = await resp.Content.ReadAsStringAsync();
                var rootresult = JsonConvert.DeserializeObject<jobList>(result);
                return rootresult;

            }
            else
            {
                return null;
            }
        }

however, I want to use BizTalk to call and process the response.

I tried to use the wcf-http adapter, selecting "Transport" for security (this is an https site, so security (?) Is required) without the specified credential type and put the header with the token in the "messages" tab of the adapter configuration tab. This fails, except for: System.IO.IOException: Authentication failed because the remote side closed the transport stream.

. OAUth, , BizTalk 2016 - .

- , wcf-http?

+4
2

, . WCF-WebHttp Basic Auth , .

OAuth , , , 2 OAuth, . , , , - Basic Auth, . , creds, .

, , - TLS, , BizTalk 2013 R2 TLS 1.0, , - .

Microsoft, , OAuth 2.0/OpenID Connect

, - . . : BizTalk Server !

+2

. "" .

:

  • " HTTP-" "" "" "" .
  • - API () .
  • "" ( API/-, ).

, Fiddler, - Fiddler (http://localhost:8888). , , Fiddler / TLS ( tls1.2 fiddler) , , API ( Fiddler ),

+2

Source: https://habr.com/ru/post/1686239/


All Articles