One of the things that I have found very useful with InfoPath 2007 is the ability to query web services for data. In one of my recent projects I was asked to have an employee enter their ID and return some specific information about them to be used in an InfoPath form. The group involved wanted to make sure that the name of the employee was the official name found in the HR database.
So, my first thought was, great, I'm going to have to create a custom web part or field type for SharePoint -- then I discovered that InfoPath has the capability of querying web services. This changed my game-plan significantly. So, without further explanation of the project, here are the steps taken to query a web service using InfoPath.
Step One - Create The InfoPath Form
I begin my process by laying out the required data-source elements. The group wants to return the official name of the employee based on their employee ID. So, I create my data-source with the following nodes:
I now add my fields to the InfoPath form using the Layout task-pane. For the purposes of this demonstration, I have removed the additional data elements.
Because I don’t want the employee changing the first name and last name fields, I am going to set these both to read-only. This is accomplished by right clicking on the field and choosing Text Box Properties. One the display tab, you’ll see the read-only checkbox.
Now that these items are ready only, I’m ready to move on to step two.
Step 2 – Create the data connections