I have been struggling with this issue for a few days and finally found the solution:
SCENARIO:
You have created an infopath form that uses data from a webservice data connection. The source of that webservice is comming from the Sharepoint REST webservice (You probably want to retrieve some user data or list data and use it in the form).
When previewing the form in your desktop, the webservice works without issue, data is retrieved, no error are found… but, when you publish your form to sharepoint, it throws an error everytime data from the webservice is queried.
EXPLANATION:
The way that the infopath form performs authentication against the Sharepoint webservice doesnt work, since it is adding some ilegal prefix to the userlogin details. Therefore, when the form is rendered in the browser, it shows a error (event ID: 5566). If you read the even log in your IIS server, or the ULS correlation information, you will notice that there's an access denied error (probably a 401 error).
SOLUTION:
- You need to convert your webservice data connection to a dataconnection file, and store it in your sharepoint site data connection library.
- You need to edit that data connection file to either add an explicit (non crypted) login, or a secure access token.
Explicit login. Add the following text to your .udcx data connection file:
<udc:Authentication>
<udc:UseExplicit CredentialType="NTLM">
<udc:UserId>domain\user</udc:UserId>
<udc:Password>password</udc:Password>
</udc:UseExplicit>
</udc:Authentication>
Secure access token example (you will need access to the SP farm central admin):
<udc:Authentication>
<udc:SSO AppId='TestSSOGroup' CredentialType='NTLM'/>
</udc:Authentication>
REFERENCE:
NOTICE:
This scenario only works when form and webservice are under the same domain. If you are working with different domains, you will find a CORS issue.
Forget about the lookback registry fix or any other solution you may find on internet. All you have is a credentials issue.