You need to sign in to do that
Don't have an account?
opiedog
Receiving intermittent protocol error and "(500) internal server error"
I have an implementation for a client that works most of the time.
When it doesn't work, I'm receiving a WebException.Status of ProtocolError with an HttpWebResponse.StatusCode of InternalServerError.
Could you provide some guidance about what might cause this? I log the SOQL query strings and they can be run successfully so I assume it's in the way I'm constructing the HTTP headers.
Thanks!
API sessions expire on inactivity, if there's a long enough gap between your api requests the session will get expired, and you'll need to call login again.
All Answers
Without further info I think it'll be hard to determine the cause as internal server error is too general... have you tried putting debug lines in your apex class?
Hi,
I should have been more informative with my first post. I'm calling Salesforce from a .NET app - the implementation is not Apex.
The challenge I'm having is with the general reply from the server. My hope is that the WebException of ProtocolError would be enough for somebody to say "in that case, look for X, Y, or Z which can cause that to happen." I'm really at a loss given that the SOQL queries that I'm sending to Salesforce are valid (I test them in independent code to confirm I'm not passing a bad Id or missing fields or something like that).
Thanks for any help or ideas you might have!
SOAP Faults are returned with a http status code of 500, as required by the soap spec. You should have a soap fault body (which typically .NET will translate into an exception for you) to go with that 500 error.
Sorry if I'm misunderstanding what you're saying, but what I got from the WebException that .NET threw was the ProtocolError and the "(500) internal server error".
For example, here's the code where the exception occurred (I removed extraneous code to hopefully make it as clear as possible):
{
WebResponse response = null;
try
{
response = m_wr.GetResponse(); // FYI, m_wr == "private WebRequest m_wr;"
}
catch( WebException wex )
{
StringBuilder sb1 = new StringBuilder();
sb1.AppendFormat( "Exception: GetResponse: WebException Status={0}", wex.Status );
ServerControl.SFLog( sb1.ToString() );
HttpWebResponse httpWR = (HttpWebResponse) wex.Response;
}
}
Are you not using the .NET soap stack? What I'm saying is that the response with a 500 status code includes an HTTP body, that is a soap fault that will have much more specific details of what went wrong. You (or your framework) need to look at the response HTTP body to find out the real error message.
Ah - gotcha. This is what was returned:
I'm getting the sessionId from the LoginResult returned from the login call, and this works for a while but then stops working. I doubt the solution is to logout/login if/when this happens...
Thanks for your help!
API sessions expire on inactivity, if there's a long enough gap between your api requests the session will get expired, and you'll need to call login again.
Thanks for your help with this!