Intermittent InfoPath Forms Services Error

If you’ve worked with InfoPath Forms Services I’m sure you’ve seen this insightful error message before:

I recently came across this baby quite frequently when developing a form that used the user profile web service to automatically populate a ‘contact information’ section. For step by step instructions on how to achieve this, check out Itay Shakury’s terrific blog here: http://blogs.microsoft.co.il/blogs/itaysk/archive/2007/04/05/InfoPath-_2D00_-Get-the-current-user-without-writing-code.aspx

Anyway, despite this solution working for me on a single server environment, when I migrated it to a multi-server farm (NTLM) it intermittently stopped working. Although it didn’t seem necessary as the web service was a local resource rather than an external one; I looked into UDC files and Administrator approved form publishing. The authentication token was obviously being lost between serving the form and making the request to the web service because I was seeing these kinds of errors in the logs:

04/15/2008 17:01:05.39 w3wp.exe Forms Server Forms Services Runtime – Data C 82fy Warning The following query failed: GetUserProfileByName (User: ***, Form Name: ***, IP: , Request: *** Form ID: urn:schemas-microsoft-com:office:infopath:***, Type: DataAdapterException, Exception Message: The remote server returned an error: (401) Unauthorized. The remote server returned an error: (401) Unauthorized.)

After some digging through the server logs it became clear that the web service request was being sent via the load balancing server which was assigning it to 1 of the 3 MOSS servers in the farm. If the server that was serving the form got the request, the form worked perfectly and displayed the user details but if another server received the request then the error above was displayed because the server had no idea where the original request was from.
So after playing around with the web service data connection for a while- trying to use localhost or the server name instead of the host header (which Forms Services doesn’t like), I finally added a simple entry to all 3 server hosts files and mapped the host header name to 127.0.0.1. This ensured that once a server was assigned a request by the LB, any secondary requests to a farm resource would then be served by the same server (localhost) instead of being directed back to the LB.

Advertisements

3 thoughts on “Intermittent InfoPath Forms Services Error

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s