2

I have a bindings XML file for BizTalk, the ports are WCF-WebHttp which is basically for calling rest services.

These kind of ports have a HttpHeaders field where you normally put:

Authorization: Basic ThenTHeToken
ContentType: application/json

When check with BizTalk deployment framework and preprocess the bindings,

This is the generated XML, where you can see after the bearer token, there is actually a Line Break

<TransportTypeData>
          &lt;CustomProps&gt;&lt;ServiceCertificate vt="8" /&gt;&lt;HttpMethodAndUrl vt="8"&gt;POST&lt;/HttpMethodAndUrl&gt;&lt;MaxReceivedMessageSize vt="3"&gt;65536&lt;/MaxReceivedMessageSize&gt;&lt;ClientCertificate vt="8" /&gt;&lt;ProxyUserName vt="8" /&gt;&lt;UseAcsAuthentication vt="11"&gt;0&lt;/UseAcsAuthentication&gt;&lt;SuppressMessageBodyForHttpVerbs vt="8" /&gt;&lt;VariablePropertyMapping vt="8"&gt;&amp;lt;BtsVariablePropertyMapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /&amp;gt;&lt;/VariablePropertyMapping&gt;&lt;SecurityMode vt="8"&gt;Transport&lt;/SecurityMode&gt;&lt;ProxyToUse vt="8"&gt;Default&lt;/ProxyToUse&gt;&lt;EndpointBehaviorConfiguration vt="8"&gt;&amp;lt;behavior name="EndpointBehavior" /&amp;gt;&lt;/EndpointBehaviorConfiguration&gt;&lt;TransportClientCredentialType vt="8"&gt;None&lt;/TransportClientCredentialType&gt;&lt;OpenTimeout vt="8"&gt;00:01:00&lt;/OpenTimeout&gt;&lt;UseSSO vt="11"&gt;0&lt;/UseSSO&gt;&lt;UseSasAuthentication vt="11"&gt;0&lt;/UseSasAuthentication&gt;&lt;CloseTimeout vt="8"&gt;00:01:00&lt;/CloseTimeout&gt;&lt;SendTimeout vt="8"&gt;00:01:00&lt;/SendTimeout&gt;&lt;HttpHeaders vt="8"&gt;Authorization: Basic bearertoken=
          Content-Type: application/json&lt;/HttpHeaders&gt;&lt;/CustomProps&gt;
        </TransportTypeData>

However when import the bindings into BizTalk application, then on on the output headers, the Line Break is lost, and BizTalk puts both the authorization and content type on the same line, and then it fails.

I can't fix this manually because in the other environments deployment is done automatically via Azure DevOps.

Any idea how to add that line break?

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
Luis Valencia
  • 32,619
  • 93
  • 286
  • 506
  • Have you tried exporting the bindings from one of the other environments and seeing how it looks like in there? – Dijkgraaf Feb 02 '19 at 20:34
  • it looks the same, with a new line, but when I import it that way, the new line is removed – Luis Valencia Feb 02 '19 at 21:05
  • Well one thing, you shouldn't really be hardcoding the bearertoken in the HttpHeader in the Adapter, as that is not secure. I've solved this by either using the Basic Auth settings on the Adapter, or where that didn't work, having a custom endpoint behaviour that looks up the credentials from SSO and adds that header. – Dijkgraaf Feb 02 '19 at 21:40
  • The inserted line breaks are an artifact of the program reading the text. We opened an exported bindings file in notepad. Saving it without change breaks it. Are you processing the file in some way during your deploy? Is there a line size limit in that application? – Jay Feb 04 '19 at 21:33

2 Answers2

0

I faced the same issue, and I resolve it adding the following separator between headers : WhiteSpace + & # x a; + WhiteSpace in your case :

Authorization: Basic ThenTHeToken & # x a; ContentType: application/json

NB : I added spaces between characters to avoid the decode here

Hichamveo
  • 475
  • 3
  • 16
0
& lt;HttpHeaders vt="8"& gt;X-API-Key: ${XpertDocBulkCNToken} & #xA; Content-Type: application/json& lt;/HttpHeaders& gt;

The above has worked for me.

I have just added the space( ) after each & for the parser to not detect xml.

Even though in the BizTalk Admin console you won't be able to see the new line character, BizTalk is able to sense the 2 HTTP headers and send them.

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
venu
  • 41
  • 2