Partager via


InfoPath form published in one SharePoint farm accessing data from another Farm.

 

Issue: When submitting InfoPath forms which access data from another farm, will get below error

"A query to retrieve form data cannot be completed because this action would violate cross-domain restrictions.

If this form template is published to a SharePoint document library, cross-domain access for user form templates must be enabled under InfoPath Forms Services in SharePoint Central Administration, and the data connection settings must be stored in a UDC file in a data connection library in the same site collection.

If this is an administrator-approved form template, the security level of the form must be set to full trust, or the data connection settings must be stored in a UDC file by using the Manage data connection files option under InfoPath Forms Services in SharePoint Central Administration.

An entry has been added to the Windows event log of the server.

Log ID:6932 

 

You can reproduce this issue with below steps

  1. Created a Source list
  2. List URL: https://source/sites/InfoPath/Lists/Psource
  3. Destination URL: https://destination/Pdestination
  4. Created a new infopath form.
  5. Added a receive data connection pointing to list "https://source/sites/InfoPath/Lists/Psource"
  6. Published it to https://destination/Pdestination
  7. Tried to access the form from SharePoint site, it gave error.
  8. Created a data connection library in https://destination.
  9. Converted the data connection to an udcx file and uploaded in https://destination/udl .
  10. Enabled full trust in the form.
  11. Tried to access the form from IE, it fails with correlation id.

Error message

System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() at Microsoft.Office.InfoPath.Server.SolutionLifetime.DataAdapterSharepointListQuery.SendSoapRequestAndReturnResultSync(DataAdapter adapter, WebRequest request) . n entry has been added to the Windows event log of the server. Log ID:5566

 

You see below entries in the ULS

05/14/2013 13:03:59.32 w3wp.exe (0x084C) 0x16D4 SharePoint Foundation Logging Correlation Data xmnv Medium Name=Request (GET:https://destination:80/_layouts/FormServer.aspx?XsnLocation=https://destination/PDestination/Forms/template.xsn&SaveLocation=http%3A%2F%2Fdestination%2FPDestination&ClientInstalled=true&Source=http%3A%2F%2Fdestination%2FPDestination%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1) 83959695-dcf1-44be-b7b4-931e75941d07

05/14/2013 13:03:59.32 w3wp.exe (0x084C) 0x16D4 SharePoint Foundation Logging Correlation Data xmnv Medium Site=/ 83959695-dcf1-44be-b7b4-931e75941d07

05/14/2013 13:03:59.53 w3wp.exe (0x084C) 0x16D4 InfoPath Forms Services Runtime - Data Connections 7tfk Medium Data adapter failed during OnLoad: The remote server returned an error: (401) Unauthorized. 83959695-dcf1-44be-b7b4-931e75941d07

05/14/2013 13:03:59.53 w3wp.exe (0x084C) 0x16D4 InfoPath Forms Services Runtime - Data Connections eq8l Warning The following query failed: PSource (User: EOS\administrator, Form Name: PDestination, IP: , Connection Target: https://destination/dcl/psource.udcx, Request: https://destination/_layouts/FormServer.aspx?XsnLocation=https://destination/PDestination/Forms/template.xsn&SaveLocation=https://destination/PDestination&ClientInstalled=true&Source=https://destination/PDestination/Forms/AllItems.aspx&DefaultItemOpen=1, Form ID: urn:schemas-microsoft-com:office:infopath:PDestination:-myXSD-2013-05-14T06-54-07 Type: DataAdapterException, Exception Message: The remote server returned an error: (401) Unauthorized. The remote server returned an error: (401) Unauthorized.) 83959695-dcf1-44be-b7b4-931e75941d07

05/14/2013 13:03:59.59 w3wp.exe (0x084C) 0x16D4 SharePoint Server State Service 8kfs Medium The StateManager is disposing and calling ReleaseLockedStates() (Count=0) 83959695-dcf1-44be-b7b4-931e75941d07

05/14/2013 13:03:59.59 w3wp.exe (0x084C) 0x16D4 SharePoint Foundation Monitoring b4ly Medium Leaving Monitored Scope (Request (GET:https://destination:80/_layouts/FormServer.aspx?XsnLocation=https://destination/PDestination/Forms/template.xsn&SaveLocation=http%3A%2F%2Fdestination%2FPDestination&ClientInstalled=true&Source=http%3A%2F%2Fdestination%2FPDestination%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1)). Execution Time=265.2747 83959695-dcf1-44be-b7b4-931e75941d07

 

Resolution:

Following are the changes that needs to be done for the InfoPath form to pull data from another Farm.

<udc:Authentication>

    <udc:UseExplicit CredentialType="NTLM">

        <udc:UserId>domain\username</udc:UserId>

        <udc:Password>Password</udc:Password>

    </udc:UseExplicit>

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

</udc:Authentication>

  • Also need to make sure that we have enabled 'Allow user form templates to use authentication information contained in data connection files' in Central Admin.