You need to sign in to do that
Don't have an account?
HTTPS Callout Request Strange Behavior
Hi all,
We recently encountered an unusual issue while using the standard Apex HttpRequest class to communicate with a remote REST API server over HTTPS. Based on our specified parameters, the server returns a CSV report that we later use to update records in Salesforce. The majority of our callouts to this server behave as expected, but in about 5% of these calls, we receive html code defining the site homepage. On the Salesforce side, we are not changing any parameters between calling the web service so there is no reason why we should be getting this odd response at random intervals like we are seeing. In addition, we have several other integrations using the same basic code, only with slight changes to the HttpRequest endpoint and have never encountered this issue before...
We brought up this scenario to the technical support team responsible for this API and according to the logs on their side, the Salesforce HTTP library is occasionally inserting a CONNECT request instead of or in addition to the typical GET request. Since their API does not support CONNECT requests, the server is returning a default html response. The following is an example log of the requests sent from our Apex code:
05/09/13 08:52:03 96.43.146.8 www.billiansonline.com /index.php CONNECT 200 6952 3501
05/09/13 08:52:03 96.43.146.8 www.billiansonline.com /api.php ?
We've tried replicating the issue on our end using Firebug and other browser tools, but have not been able to witness a CONNECT request coming out of Salesforce from these logs or the Salesforce Debug Log. We have opened support cases with both Salesforce and this third party company with little success so we are turning to other developers on this forum in hopes of shedding some light on this issue. Have any of you encountered something like this before? Any suggestions on how we can better diagnose the problem?
Thanks in advance for your help!
-caukajun
Is the ip address they shared, does it belong to Salesforce?
Hi Bhawani,
Yes, I believe the IP address they shared belongs to Salesforce and represents the address from which these requests originated. That also justifies their belief that the CONNECT request is coming from Salesforce since it matches the GET request. I've never heard of this behavior either, so I'm hoping someone on these forums has encountered it before...
We've been able to get around this occurence in our code by testing the response for the presence of HTML tags. Once we see this, we discard the response and simply redo the request.
If you have any ideas as to what could be causing this, please share them with us!
caukajun