InfoPath Error ID: 5566 Error accessing a datasource

No errors were logged in Event Logs. We have identified the root cause of the problem to be connectivity with SharePoint User Profile web service as we are using it to populate the properties of logged-in user at form-load.

On the other hand, this seems to be an issue only in a specific environment. So, we wanted to check the settings on the environment.

Resolution Steps:

1) Made sure all the data connection files have the environment specific List GUIDs, URLs and so on

2) Made sure all the settings related to InfoPath Forms Services under Central Admin are proper: Enable web service proxy, Enable cross-data connections, Disable Anonymous access

3) Made sure all the relevant user profiles are properly imported under SSP

4) Made sure that the authentication Loopbackcheck registry entry is disabled on the WFE server

5) Made sure the alternate access mappings or managed paths are not breaking the web service calls in the interim

None worked. Finally, we have added a host file entry on the WFE server (we have only one WFE in our case) to point to its own IP, did a IIS reset  and it worked.

I have actually found this resolution on one of the blogs:

If the WFE servers are load-balanced, we need to add a host file entry on WFE pointing to its own IP on each of WFE. This is to deal with a known issue with InfoPath browser forms; all browser form calls to SharePoint web services will be made to the current machine that invoked the form.