CommunicationException: An error in receiving HTTPResponse while adding lead through REST API.

Anonymous
Not applicable

CommunicationException: An error in receiving HTTPResponse while adding lead through REST API.

Some times I am facing issue while adding lead through REST API.

Occurrence: 1-2 times per month.

Exception: System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response to https://045-lqs-022.mktoapi.com/soap/mktows/2_3. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

2 REPLIES 2
Kenny_Elkington
Marketo Employee

Re: CommunicationException: An error in receiving HTTPResponse while adding lead through REST API.

That's actually the SOAP API endpoint, not REST.  The message itself is too vague to provide any direction here, since it's an exception happening at the network layer.  I'd take this to your dev/IT teams to see if they can provide any additional info on what request was being made when the exception was received, and if there are any associated logs other than this one.

Anonymous
Not applicable

Re: CommunicationException: An error in receiving HTTPResponse while adding lead through REST API.

Thank you for your reply.

  1. We have REST api which is exposed by marketo to add leads(syncLead).
  2. We have one web application which is hosted on cloud and cloud application calls REST api to syncLead.

It is working find and able to sync leads, but only few request gets failed, twice a month.

So In this case our assumption is our application is not able to communicate with marketo: either due to marketo server is slow for few seconds or network congestion related issue or delay in response.

We don't have any additional information for the request which gets failed.

We are getting exception at cloud and it is as below:

===================================================================================

System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response to https://045-lqs-022.mktoapi.com/soap/mktows/2_3. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)

at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)

at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)

at System.Net.Security._SslStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)

at System.Net.Security._SslStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)

at System.Net.Security._SslStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)

at System.Net.TlsStream.Read(Byte[] buffer, Int32 offset, Int32 size)

at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)

at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)

at System.Net.HttpWebRequest.GetResponse()

at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

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 AutomationAnywhere.Marketo.Marketo.MktowsPort.syncLead(syncLeadRequest request)

at AutomationAnywhere.Marketo.API.SyncLead.Execute()

at AAUserAccountRole.MarketoController.AddLead(Object user)

===================================================================================

If you feel to talk to our dev/IT for more detail, please provide your convenient time.