none
wcf-webhttp adapter use in Biztalk server 2016 to connect to an API RRS feed

  • Question

  • Hi,

    we have a requirement of receiving files in biztalk and upload them to an API which will be a ReST call . This process involves various steps BUT I am stuck with below step:

    1.Get the file id's from the API which returns file id's along with filenames so biztalk needs to UPLOAD these files to API 

    I am using wcf-webhttp adapter to conenct to an API and upload files using methods like PUT, POST

    I have created a simple messaging application on admin console with a receive location to receive files and a send port to upload files and No schema,maps etc used.

    So we have got the file id and file name from API using GET method and  now we need to upload this file using PUT command. I have configured the send port with this adapter and specified as below (I have changed the details):

    Address URL : https://test.com/files/Test123/

    Http method and URL Mapping  :

    <BtsHttpUrlMapping> <Operation Method="PUT" URL="/Test+123.txt"  /> 

    Outbound HTTP Headers :

    Authorization: Basic encoded version of credentials

    Content-Type: application/octet-stream

    With this configuration while i try sending the file named Test 123.txt from biztalk getting error as below: Is there anything wrong in the way we specify the PUT method? what should be the format of this method to upload files using this adapter? Please any suggestions would be of great help. Thank you. 

    The adapter failed to transmit message going to send port "APUTSendPort" with URL "https://test.com/files/Test123/files/Test123/". It will be retransmitted after the retry interval specified for this Send Port. Details:"System.Net.WebException: There was no endpoint listening at https://test.com/files/Test123/files/Test123/files/Test123/Test+123.txt that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
      <head>
        <title>A</title>
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="viewport" content="width = 960">
        <link rel="shortcut icon" href="lib/themes/original/images/favicon.ico">
        <style type="text/css">
          @import "lib/dojo/resources/dojo.css";
          html {
            overflow: auto;
          }
        </style>
      </head>
      <body>
        <div id="pageWrap" class="pageWrap">
          <div class="banner"><h1>An error has occurred whilst processing your request:</h1></div>
          
          
          <div><pre class="original">Not Found</pre></div>
          <div>Please close your browser window and try again.</div>
          <div>If the problem persists then please contact Support.</div>
        </div>
      </body>
    </html>
    ".

    Tuesday, December 11, 2018 2:34 PM

All replies

  • Have you tried doing the same PUT operation with another tools such as Postman or SoapUI?  Do you also get a 404 response with that?

    Did you mean to have the URI contain the same /files/Test123/ 3 times?

    Try removing the trailing slash from the Address URL
    Wednesday, December 12, 2018 6:02 AM
  • Hi Colin, thanks for the response. Yes it is working now. I had to remove the file name and the slash from the URL and included the below in header section

    Outbound HTTP Headers :

    Authorization: Basic encoded version of credentials

    Content-Type: application/octet-stream

    Content-Dis; filename="Test123.txt"

    Now we are getting the 204 response which is No content  rather we are expecting back response from API by uploading the file . I have tried this test using Fiddler and getting the same 204 response in there.  

    Wednesday, December 12, 2018 9:43 AM
  • Hi Colin,

    thanks for the response. Yes, its working now as I added below highlighted  and have removed the slash . getting a 204 status back which is fine which says No content. 

    Outbound HTTP Headers :

    Authorization: Basic encoded version of credentials

    Content-Type: application/octet-stream

    Content-Dis filename="Test123.txt"

    Now trying to do a POST for the above file uploaded. so basically we need to import the processid for the file uploaded and then do a POST of the processid which returns biztalk a Task id . Is there a way of doing a POST by not setting the filter to receive port as we are not sending any file. So in this case how should this POST method executed from Biztalk? any suggestions please?   Thank you.

    Wednesday, December 12, 2018 3:47 PM