An error occurred while trying to connect to a Web service.

 

While opening InfoPath form at https://mysite.com/xxxx/formstest name newfrom we getting error.
An error occurred while trying to conned to a Web service, An entry has been added to the Windows event log of the server. Log ID:5566 Correlation ID:ed55029c-xxxx-703b-xxxxx-5balBl xxxxxx

 

In ULs we can see

 

 

image

 

Solution for the issue is.

 

1) Install hotfix https://support.microsoft.com/kb/2516485 on all WFEs. This is necessary so that the “userName()” function in InfoPath will return a result in domain\username format, instead of just username.

2) In SharePoint Central Administration, create a new “Group” Secure Store App, assign “All Authenticated Users” as the membership condition, and set the credentials to a user with permissions to access user information for all site users (i.e. a site admin).

3) In the UDCX file for the data connection calling the “GetUserProfileByName” web service method, add the Secure Store App information and reapprove:

<udc:Authentication>

<udc:SSO AppId="GetUserProfileByNameSSA" CredentialType="NTLM" />

</udc:Authentication>

4) In the form template, in design mode, modify the “GetUserProfileByName” data connection so it does not initialize on load.

5) In the “Form Load” rule, add actions to set the “AccountName” query field of the “GetUserProfileByName” data connection to the “userName()” function, and then query the data connection.