First, in your SharePoint site, if you haven’t created a Data Connection Library already, create one. This is where you will publish the new Data Connection which you create.
In InfoPath 2010, click the ‘Data’ page in the ribbon. From there, click the Data Connections button to create a secondary dataconnection. When the dialog comes up, click the ‘Add’ button. Choose the default radio button (‘Create a new connection to’ and ‘Receive data’). Once that’s done, click the next button.
Since we’re talking about a web service here, on the next page of the wizard, choose ‘SOAP Web service’ and, again, click the ‘Next’ button.
On the next page, you’ll enter the url of your web service. There will be an example of how it should look below the textbox. Once that’s entered, again, click the ‘Next’ button. In the next wizard page, select the web service operation you need to use and click the ‘Next’ button once again. Then, click the ‘Next’ button twice.
In this page, enter a name for the data connection, and if this is a secondary operation on the page (not needed when the template loads), uncheck the checkbox which says “Automatically retrieve data when form is opened”.
Once this is done, click the ‘Finish’ button, but we’re not quite finished at this point. In the Data Connection dialog, select the connection you just created and click the ‘Convert to Connection File’ button. Here, you will type in the URL for the Data Connection Library, along with whatever you want the Data Connection to be named. At this point, just click the ‘OK’ button, and you’re off to the races!
All Things DotNet Discussed – Winforms/ASP.Net/SharePoint/WPF