Timeout Exception: Calling Soap API from Within a REST API-Collection of common programming errors
I have a very odd problem. I have a REST API that uses ServiceStack that does a few things like save payment data etc. From within that API I start building payment object so I can fire off a payment to a Payment Gateway. This payment gateway is a Soap API Using SoapHttpClientProtocol.
The problem I am having is that the Soap API Times out. I have a stack trace that lead me to believe it is happening inside the framework somewhere.
System.Net.WebException: Error: ConnectFailure (Connection timed out) ---> System.Net.Sockets.SocketException: Connection timed out
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in :0
at System.Net.WebConnection.Connect (System.Net.HttpWebRequest request) [0x00000] in :0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetRequestStream (IAsyncResult asyncResult) [0x00000] in :0
at System.Net.HttpWebRequest.GetRequestStream () [0x00000] in :0
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in :0
Above is the exception I got so I believe it is happening inside the Invoke method. Here is the code which is in the proxy file.
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("paymenturl", RequestNamespace="gatewayurl", ResponseNamespace="gatewayurl", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, Use=System.Web.Services.Description.SoapBindingUse.Literal)]
public string SubmitPayment(string trnXML) {
object[] results = this.Invoke("SubmitPayment", new object[] {
trnXML});
return ((string)(results[0]));
}
Does anyone know why this would happen?
Now the SOAP Payment API works though the UI. So if call it straight from the UI I can make a payment and get a successful response back. When I do it from the API it doesn’t work.
Is this perhaps a Architectural problem which does not allow an API call from within another API?
Has anyone come across anything like this before?
Any help will appreciated.