Following errors occurred to me when InfoPath form services trying to access user profile service. my profile connections are stored in a udx file.
The following query failed: User Profile (User: domain\user, Form Name: Template, IP: , Connection Target: http://server/sites/capex/DataConnectionsLibrary/userprofile.udcx, Request: http://server/sites/capex/SitePages/Home.aspx, Form ID: urn:schemas-microsoft-com:office:infopath:list:-AutoGen-2011-02-21T05:15:34:497Z Type: DataAdapterException, Exception Message: The remote server returned an error: (500) Internal Server Error. Server was unable to process request. ---> Attempted to perform an unauthorized operation. The remote server returned an error: (500) Internal Server Error.)
in here first i looked for cross site reference issue (here). but it is not the problem. then i found running Application Pool set to Anonymous Access true. Then i disabled the anonymous access and it worked for me.