none
401 - unauthorized error while connecting to web service -Sharepoint + IPFS

    Question

  • Hi All,

    I have a Infopath form published in a sharepoint list which is connecting to UserProfileService.asmx to autopopulate some user properties. It works fine in my stage server but when i moved it to production it gives me unauthorized 401 error while connecting to web service -

    Error Log-

    The following query failed: GetUserDetails (User: domain\username, Form Name: Template, IP: , Connection Target: , Request:http://sitename/Lists/newlist/AllItems.aspx?View={88B0F3FB-4C19-4711-8A3C-491DEB51C5A0}, Form ID: urn:schemas-microsoft-com:office:infopath:list:-AutoGen-2012-05-26T10:48:21:36Z Type:DataAdapterException, Exception Message: The remote server returned an error:(401) Unauthorized.

    **GetUserDetails is the data connection created in infopath which is connecting tohttp://app-domain/_vti_bin/userprofileservice.asmx and using its GetUserProfileByName method.

    Few strange observations-

    1. One side it is giving me 'Unauthorized error', but on other it works sometimes (with same browser, on same machine). This is driving me crazy because if some is unauthorized then how come he is able to connect sometimes.
    2. It works fine in preview mode in infopath but gives error after publishing it to sharepoint site.

    Fews things that i ensured-

    1. I updated the web service url in data connection file.
    2. Anonymous access is not enabled in central administration

    Note - I am using Windows Server 2008 R2 Standard edition. My servers are not load balanced and i am getting this error while browsing from any machine i.e server and other local machines.

    Please suggest me something. Thanks.

    Wednesday, June 6, 2012 6:28 PM

Answers

All replies

  • Hi All,

    I have a Infopath form published in a sharepoint list which is connecting to UserProfileService.asmx to autopopulate some user properties. It works fine in my stage server but when i moved it to production it gives me unauthorized 401 error while connecting to web service -

    Error Log-

    The following query failed: GetUserDetails (User: domain\username, Form Name: Template, IP: , Connection Target: , Request:http://sitename/Lists/newlist/AllItems.aspx?View={88B0F3FB-4C19-4711-8A3C-491DEB51C5A0}, Form ID: urn:schemas-microsoft-com:office:infopath:list:-AutoGen-2012-05-26T10:48:21:36Z Type:DataAdapterException, Exception Message: The remote server returned an error:(401) Unauthorized.

    **GetUserDetails is the data connection created in infopath which is connecting tohttp://app-domain/_vti_bin/userprofileservice.asmx and using its GetUserProfileByName method.

    Few strange observations-

    1. One side it is giving me 'Unauthorized error', but on other it works sometimes (with same browser, on same machine). This is driving me crazy because if some is unauthorized then how come he is able to connect sometimes.
    2. It works fine in preview mode in infopath but gives error after publishing it to sharepoint site.

    Fews things that i ensured-

    1. I updated the web service url in data connection file.
    2. Anonymous access is not enabled in central administration

    Note - I am using Windows Server 2008 R2 Standard edition. My servers are not load balanced and i am getting this error while browsing from any machine i.e server and other local machines.

    Please suggest me something. Thanks.

    Wednesday, June 6, 2012 6:28 PM
  • Hi All,

    I have a Infopath form published in a sharepoint list which is connecting to UserProfileService.asmx to autopopulate some user properties. It works fine in my stage server but when i moved it to production it gives me unauthorized 401 error while connecting to web service -

    Error Log-

    The following query failed: GetUserDetails (User: domain\username, Form Name: Template, IP: , Connection Target: , Request:http://sitename/Lists/newlist/AllItems.aspx?View={88B0F3FB-4C19-4711-8A3C-491DEB51C5A0}, Form ID: urn:schemas-microsoft-com:office:infopath:list:-AutoGen-2012-05-26T10:48:21:36Z Type:DataAdapterException, Exception Message: The remote server returned an error:(401) Unauthorized.

    **GetUserDetails is the data connection created in infopath which is connecting tohttp://app-domain/_vti_bin/userprofileservice.asmx and using its GetUserProfileByName method.

    Few strange observations-

    1. One side it is giving me 'Unauthorized error', but on other it works sometimes (with same browser, on same machine). This is driving me crazy because if some is unauthorized then how come he is able to connect sometimes.
    2. It works fine in preview mode in infopath but gives error after publishing it to sharepoint site.

    Fews things that i ensured-

    1. I updated the web service url in data connection file.
    2. Anonymous access is not enabled in central administration

    Note - I am using Windows Server 2008 R2 Standard edition. My servers are not load balanced and i am getting this error while browsing from any machine i.e server and other local machines.

    Please suggest me something. Thanks.

    Wednesday, June 6, 2012 6:28 PM
  • Please don't cross post the same question to multiple forums. You've posted this question in both pre-2010 and 2010 forums. Which SharePoint product are you asking about?

    Jason Warren
    Infrastructure Specialist

    Wednesday, June 6, 2012 7:42 PM
  • Please don't cross post the same question to multiple forums. You've posted this question in both pre-2010 and 2010 forums. Which SharePoint product are you asking about?

    Jason Warren
    Infrastructure Specialist

    Wednesday, June 6, 2012 7:42 PM
  • Hi,

    Have you check the "DisableLoopBackCheck" parameter in your regedit?
    Like this : http://salaudeen.blogspot.fr/2011/01/dns-issue-in.html

    Hope this helps.


    Visit my blog : http://rmatayron.blogspot.com/

    Wednesday, June 6, 2012 8:18 PM
  • About the loopback check, isn't it only when i am browsing from the server on which the site is hosted? But in my case i am getting this error when i am browsing from other machines too.

    Thursday, June 7, 2012 4:00 AM
  • Hi Rudra K,

    How many Web Front Ends do you have in production?  If you have more than 1, I would suggest adding HOSTS file entries to each WFE to redirect the load balanced URL to 127.0.0.1.  This way when the request for the UserProfileService is made by Forms Services, the HOSTS file will prevent that request from leaving the server.  If you do not have the HOSTS file entries in place, the request would leave the server, which could end up on the other WFE.  This is called a double hop scenario, and would fail with a 401 Unauthorized.

    With a HOSTS file entry, you would also want to add the DisableLoopbackCheck registry entry to prevent the server from rejecting the request for being a possible reflection attack.

    If you do go the route of disabling the LoopbackCheck, I would highly suggest Method 1 over Method 2:  http://support.microsoft.com/kb/896861

    Please let me know if you do not have more than 1 WFE, as the above information would not apply.  Thanks!

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Regards,
    Ian Kavanagh
    Microsoft Online Community Support

    Tuesday, June 12, 2012 7:33 PM
  • Hi Ian,

    I have 3 environments -

    Stage - 1 WFE Server + 1 App Server - Works fine

    Dev - 1 WFE Server + 1 App Server - Throws Error

    Prod - 3 WFE Server + 2 App Servers + 1 Index Server - Throws Error

    I am getting this error in DEV too and the above case wouldn't apply to it. Though i tried Method 2 in my DEV environment but that didn't worked. Please suggest something.

    Note: When i used cross-site data connection to connect to my Stage Server Web Service from my DEV site, it works fine.

    Thanks,

    Rudra



    Wednesday, June 13, 2012 7:22 AM
  • Hi Rudra,

    Did you find the solution for this issue ?.

    I am also facing the same problem. In my case when i use the server name in the url instead of the dns its working fine. It seems some security related issue, but still searching solution for this.

    Please help me if you already find the solution.

    Thanks in advance..


    Tuesday, July 3, 2012 5:13 AM
  • I got the solution. There could be many reasons for the same 401 unauthorized error. For me it was combination of two issues-

    Loopback issue and double hop authentication.

    In most cases it is due to loopback check feature, follow below post to disable loopback check-

    http://support.microsoft.com/kb/896861

    For double hop authentication-

    http://blogs.msdn.com/b/infopath/archive/2006/06/14/advanced-server-side-authentication-for-data-connections-part-1.aspx

    http://blogs.msdn.com/b/infopath/archive/2006/06/27/advanced-server-side-authentication-for-data-connections-part-2.aspx

    http://blogs.msdn.com/b/infopath/archive/2006/07/03/655611.aspx

    (To resolve double hop authentication issue, you can simply add explicit credentials to your data connection file and enable the option in central administration to allow user to use explicit credentials, later you can opt for any of the methods available in above blogs)

    Load balancer didn't return the local host IP Issue-

    http://sharepointconnoisseur.blogspot.in/2011/04/how-to-resolve-401-unauthorized-error.html

    Hope this helps.

    Regards,

    Rudra


    Tuesday, July 3, 2012 7:56 PM
  • Hi Rudra,

    Thanks for your response.

    For me the issue is due to the loop back & the certificate issue with the trusted publishers.

    Thanks!..

    Wednesday, July 4, 2012 5:05 AM