Error Description :-
The adapter failed to transmit message going to send port "WcfSendPort_MyWebService_MyWebServiceSoap" with URL http://localhost/MyWebService/MyWebService.asmx. It will be retransmitted after the retry interval specified for this Send Port. Details:"System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (400) Bad Request. —> System.Net.WebException: The remote server returned an error: (400) Bad Request.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
— End of inner exception stack trace —
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 :
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)".
I feel little nauseating after deploying close to zillion times (Hypothetically) in attempt to fix this error since this morning. All I am doing is call a web service using a WCF-BasicHTTP adapter in my BizTalk Project.
The webmethod takes the string as the input parameter and return string..Plain simple right? but the catch is I am send a huge XML serialized to string to the Webmethod.
At first, I thought it to be a problem with the size of the data, But no..that was not the case. I realised that after increasing the maxReceivedRequestSize on the send port and similarly on the web service by modifying web.config with the below
<system.web> <httpRuntime maxRequestLength="2097150" executionTimeout="3000"/> </system.web>
Second, I had to identify the problem using brute force / Trail and error basis, As the great BizTalk would not allow you to debug the Message Assignment shape. After trying and retrying couple of times, I realized that interfacing is good – I am able to send huge XML message from Orchestration to Web Service without issue.
Third, It was the problem with how I constructed the SOAP request in the message assignment shape (because I did not want to use Transform shape), I was assigning a part of my input multipart message direclly to my SOAP Request XML, So this was messing up the entire intention of the code and made be run this errand to fix it.
Finally, Voilà – the issue is fixed and I can sign off happily and enjoy my weekend.