I am trying to connect from CRM Plugin to External SOAP API. It gives me error.
I am using Isolation Mode as None. When I connect the same API using Console APP it works fine. I executed the Console APP from Server and it connects and responds Fine.
I googled a bit got some leads but probably I lack capability to understand/ pinpoint the issue.
Code Snippet below
WebRequest request = WebRequest.Create("URL");
request.Method = "GET";
//request.Credentials = new NetworkCredential("USERNAME", "PASSWORD");
WebResponse response = request.GetResponse();
HttpWebResponse webresponse = (HttpWebResponse)response;
if (webresponse.StatusCode == HttpStatusCode.OK)
{
tracing.Trace($" Resposne is correct i.e OK");
}
When I debug using Plugin Registration Tool, Tool breaks up and exits.
Error from Tracing:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
Reason why it was not working:
Steps Taken to Solve the issue: In our plugin Code, when we make an HTTP request we add proxy to the request. This solved our issue.