Web Services are wonderful devices that allow us to run code from almost anywhere we have access to. The best part of all is that it is as easy as deploying the code's output to a shared location, and then adding a web reference to it. However, creating a SharePoint web service is a bit more involved. Below is my simplified (from MSDN) method of creating these web services from scratch.
Back in InfoPath, the URL of the SharePoint web service just deployed would be http://<server name>/_vti_bin/<web service class name>.asmx. Enter this in the Data Connection wizard after choosing a web service as the source of data. InfoPath will read the .wsdl file and give you a list of the web methods available.
After choosing the method, InfoPath will also execute the code. If the method takes parameters, you may optionally give them a sample value. If you don't, the default value for the data type is used (black for strings, zeros for integers, etc.) If this default value will crash the code, then the Data Connection wizard will fail.
For example, consider a web method that takes a string parameter corresponding to the name of a SharePoint list. The code goes into a WSS site and opens that list. Since you can't have lists with blank names, then this code will fail since it couldn't open the list. Therefore, set the sample value equal to the name of an existing list in the WSS site, or place the offending code in a Try...Catch construct. Remember, the code doesn't necessary have to work; it needs to simply not fail and throw and exception.
However, you must be careful with the Try...Catch situation. Once InfoPath can successfully test the method, a schema will be built based upon the result. For example, consider a web method that returns a System.Data.Dataset, where the code blows up (but is handled) before a data table can be added. The wizard will be successful, but if you attempt to bind a drop down list to this data source, you'll find that there is no repeating section available!
The final topic to mention regarding SharePoint web services is redeployment. If any code is changed, but the web methods signatures are exactly the same, you only need to copy the new .dll file to the to server's web service's bin folder (the same folder as in Step #10). Since the signatures and return types are the same the .wsdl file will not change, so only the new code needs to be copied over.
If the web methods are changed or deleted, or new ones are added, but the class and project names stay the same, repeat Steps #1-5 and then copy over the new .dll. The .disco file never needs to be altered, unless for some reason the name of the class or project namespace changes. If this is the case, repeat the entire process.