none
Error :The adapter failed to transmit message going to send port RRS feed

  • Question

  • Hi All,

    I am new to wcf. I have a c# code for the request response from a web service and getting the response from the code. but i want to implement this in biztalk. using the wsdl i consumed the wcf web service and got the bindings n generated a simple schema then build the orchestration for wcf request response. In the Biztalk admin in my application i imported the bindings for the wcf send port.

    can anyone help me?Now i am getting this warning message:

    The adapter failed to transmit message going to send port
    "WcfSendPort_VinDecoderService_VinDecoderPort_Custom" with URL 

    https://vintelligence3.polk.com/vindecoder/VinDecoderService
     It will be retransmitted after the retry interval specified for this Send Port.
    Details:"System.ServiceModel.ProtocolException: The content type text/html;
    charset=UTF-8 of the response message does not match the content type of the
    binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the
    IsContentTypeSupported method is implemented properly. The first 297 bytes of the
    response were: '<html><head><title>Oracle Access Manager
    Operation Error</title></head><body><h1>Oracle Access Manager
    Operation Error</h1><p>The authentication scheme Basic over
     LDAP - no forms has invalid configured parameters.</p><p>Contact your
    website administrator to remedy this problem.</p></body></html>
    '.

    Server stack trace:
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndRequest(IAsyncResult result)

    Exception rethrown at [0]:
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at System.ServiceModel.Channels.IRequestChannel.EndRequest(IAsyncResult result)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result)".

    My web.config file:


    • Edited by renu relan Thursday, February 27, 2014 12:52 PM
    Wednesday, February 26, 2014 2:00 PM

Answers

  • Use code below for reading and writing the file.

                byte[] input = File.ReadAllBytes("filename");
                File.WriteAllBytes("filename", input);

    I don't see anything obvious errors except the encoding.  The serialize data is XML format and usingg the wrong encoding method can corrupt the XML format.  The exception indicating the error was caused by the encoding not being UTF8.  So make the changes and check to see if the exception error changes.   People often think just because you are stilling getting an error the fix you put in didn't work.  Many times you fix one problem and then still get an exception due to a second issue. 

    jdweng

    Thursday, February 27, 2014 10:22 AM
  • The exception says the header in the message is UTF-8, but your code is using Encoding.Unicode.  change the code to use UTF8 encoding.  Also I would not use File.CreateText with UTF8 nor would a use String objects.  Make all your reads/writes as Byte Arrays.  Use Binary Read/Write method connected to streams that are using UTF8.

    jdweng

    Wednesday, February 26, 2014 2:45 PM

All replies

  • The exception says the header in the message is UTF-8, but your code is using Encoding.Unicode.  change the code to use UTF8 encoding.  Also I would not use File.CreateText with UTF8 nor would a use String objects.  Make all your reads/writes as Byte Arrays.  Use Binary Read/Write method connected to streams that are using UTF8.

    jdweng

    Wednesday, February 26, 2014 2:45 PM
  • can u plz explain me with a sample code how to write the byte arrays for read write
    Thursday, February 27, 2014 10:01 AM
  • my c# code is working means i am getting the response from the webservice but in biztalk i am not getting the response.
    Thursday, February 27, 2014 10:10 AM
  • Use code below for reading and writing the file.

                byte[] input = File.ReadAllBytes("filename");
                File.WriteAllBytes("filename", input);

    I don't see anything obvious errors except the encoding.  The serialize data is XML format and usingg the wrong encoding method can corrupt the XML format.  The exception indicating the error was caused by the encoding not being UTF8.  So make the changes and check to see if the exception error changes.   People often think just because you are stilling getting an error the fix you put in didn't work.  Many times you fix one problem and then still get an exception due to a second issue. 

    jdweng

    Thursday, February 27, 2014 10:22 AM
  • Hi jdweng,

    how can i pass this code to send port

    httpRequestMessageProperty.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(System.Configuration.ConfigurationManager.AppSettings["myUsername"] + ":" + System.Configuration.ConfigurationManager.AppSettings["myPassword"])));

     so i can get the response back from the we service.

    Thanks.

    Monday, March 3, 2014 8:58 AM
  • Not sure why you were taking a string converting to bytes and then back to a string.  The original errror message indicatted you need to use UTF8, did you solve that issue?  A string is not UTF8.  If you are still having a UTF8 error then you should be sending byte arrays and converting the datagram from strings to byte array using Encoding.UTF8.GetBytes(string).

    httpRequestMessageProperty.Headers.Add("Authorization", "Basic " + System.Configuration.ConfigurationManager.AppSettings["myUsername"] + ":" + System.Configuration.ConfigurationManager.AppSettings["myPassword"]);

     


    jdweng

    Monday, March 3, 2014 10:09 AM
  • Hi jdweng,

    I didn't resolved that issue as from the c# code m getting the response. now i want the same in biztalk so i cant anything in the code. need to find the solution.

    Monday, March 3, 2014 10:28 AM
  • Hi jdweng,

    with the code

    httpRequestMessageProperty.Headers.Add("Authorization", "Basic " + System.Configuration.ConfigurationManager.AppSettings["myUsername"] + ":" + System.Configuration.ConfigurationManager.AppSettings["myPassword"]);

    i am not getting the response in the .cs file now

    Monday, March 3, 2014 2:38 PM
  • Has the webserver been verified?  Can you use an IE to get the data from the server?  I normally recommend comparing the IE results with the user application using a sniffer like fiddler or wireshark when you can make a connection with an IE.

    The HTTP data consists of a HTTP header and a datagram.  I looks like the header may be encoded properly (or the credentials need to be 64 bit encoded) but the datagram encoding is wrong.  Without sniffer data it is hard for me to tell the root cause of this issue.

    The exception is indicating the "contents type" in the http header doesn't match the the contents type in the datagram.   I would start by looking at the header in the server site to see what contents type it expects.  When a client connects to a server there is a negotiation that occurs using the http headers.  The negotiation uses the headers in the webpage with the headers the client send and attempts to find a common transmission mode.  Multiple request/responses occur until a common mode is found or an error occurs.  Normally when a common nmode is found a status of 200 done is returned from the server.  When an error occurs something other than 200 done is returned. 


    jdweng

    Monday, March 3, 2014 4:04 PM
  • So how to add the wcf basic http header in orchestration

    can u help me with this case

    Tuesday, March 4, 2014 7:05 AM
  • Tuesday, March 4, 2014 8:44 AM
  • this web page did not helped me:(
    Wednesday, March 5, 2014 1:51 PM
  • This is a little bit outside my expertisee.   I searching the web just like you probably did.  See if the page below helps.

    http://social.msdn.microsoft.com/Forums/en-US/96f24b06-76c7-4604-b946-8f3aa96f3b17/how-to-add-custom-http-header-using-wcfbasichttp-adpater-from-custom-send-pipeline?forum=biztalkgeneral


    jdweng

    Wednesday, March 5, 2014 2:20 PM