7

using REST API to get all site user. When I click on Preview button in InfoPath Designer 2013 working fine. but after Publishing form it shows error.

here is My rest api URL

http://site/_api/web/siteusers

when I use URL in browser it shows all entries . but in Info Path form it shows error:

enter image description here

I looked in to log files I have found 3 important messages

1) DataAdapterException, Exception Message: The form cannot run the specified query. The remote server returned an error: (401) Unauthorized.)

2)Non-OAuth request. IsAuthenticated=False, UserIdentityName=, ClaimsCount=0

3)Forced due to logging gap, cached @ 08/23/2016 02:26:29.73

2

If the error / problem would occur with a SOAP web service call. I'd be interested to know if you were to create an InfoPath form with a SOAP data connection (UserProfileService for example) if you'd encounter similar problems. If this same problem occurs with a SOAP data connection you could be running into an issue where InfoPath makes a call to one server for the form, then routes a request to another server for the Web Service. The request to the second server is denied, resulting in a data source error in your form. If that is indeed the case then I suggest the following:

Make the following modifications on all Web Front Ends (in order to eliminate a double hop):

DisableLoopbackCheck on each WFE:

  1. Click Start, click Run, type regedit, and then click OK.
  2. In Registry Editor, locate and then click the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
  3. Right-click Lsa, point to New, and then click DWORD 32-bit Value.
  4. Type DisableLoopbackCheck, and then press ENTER.
  5. Right-click DisableLoopbackCheck, and then click Modify.
  6. In the Value data box, type 1, and then click OK.
  7. Quit Registry Editor, and then restart your computer. Edited the HOSTS file on each WFE - located at c:\Windows\system32\drivers\etc.

Add an entry for your server name that pointed to 127.0.0.1. An example HOSTS file is shown below:

 Copyright (c) 1993-2009 Microsoft Corp.

 This is a sample HOSTS file used by Microsoft TCP/IP for Windows.

 This file contains the mappings of IP addresses to host names. Each
 entry should be kept on an individual line. The IP address should
 be placed in the first column followed by the corresponding host name.
 The IP address and the host name should be separated by at least one
 space.

 Additionally, comments (such as these) may be inserted on individual
 lines or following the machine name denoted by a '' symbol.

 For example:

 102.54.94.97 server.com  source server
 38.25.63.10 x.server.com  x client host
 localhost name resolution is handled within DNS itself.
 127.0.0.1 localhost
 ::1 localhost
127.0.0.1    servername.com

Please let me know if that helps.

Please check below link for more information

Error occured Accessing Data Source Error ID 5566

  • I Have already did this. but not working for me... – Akshay Dattatray Nangare Aug 24 '16 at 11:27
  • Have you Rebooted your server after configuration changes? – Hardik Aug 24 '16 at 11:29
  • yes, I have Rebooted server after configuration changes. – Akshay Dattatray Nangare Aug 24 '16 at 11:30
  • @Hardik. Please update the link provided at the last. Its not redirecting to proper destination – Aakash Maurya Aug 24 '16 at 11:30
  • Sorry for wrong link. Please check it now as i have updated it. – Hardik Aug 24 '16 at 11:32
2

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:

  1. You need to convert your webservice data connection to a dataconnection file, and store it in your sharepoint site data connection library.
  2. 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.

  • 1
    Comment by my co-worker: In my case, authentication via the explicit login didn't work. InfoPath simply ignored this information. The solution via a secure access token worked for me. – Uwe Keim Nov 24 '17 at 14:09
1

Whenever you view InfoPath forms in the client, you use the account you are logged in as. Whenever you view that same InfoPath form in the browser, the browser impersonates the application pool account for any data sources. Thus, you need to have the application pool account added to Full Read (or Full Control if you are using POSTs), and that way you will not see unauthorized.

  • Go to Web Applications
  • Highlight the web application in question
  • Go to User Policy
  • Add the application pool account
  • Select Full Read
  • Click OK.

Then retest.

  • application pool account is already available on Web Application with Full Read permission... – Akshay Dattatray Nangare Aug 26 '16 at 3:56
  • Is there any other settings I need to do? – Akshay Dattatray Nangare Aug 26 '16 at 4:49
  • How are you calling you REST? Look at this here: johnliu.net/blog/2012/4/26/… – Mike Aug 26 '16 at 13:52
  • 2
    Also, are your settings "allow cross-domain data access for user form templates that use connection settings in a data connection file" and "Allow user form templates to use authentication information contained in data connection files " in Central Admin checked? – Mike Aug 26 '16 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.