Link a Form to a Web Service

Another way to use a shared data source with InfoPath is to link the form to a web service. You can’t just use any web service with InfoPath. If you try to use the Amazon or Google web services, for example, you’ll get the error shown in Figure 7-34.

InfoPath rejecting an RPC-encoded web service

Figure 7-34. InfoPath rejecting an RPC-encoded web service

The InfoPath SDK installs these examples that demonstrate how to write a web service that can be used by InfoPath forms:

  • localhost/infopathsdk/infopathwebservicesample/infopathwebservicesample.asmx

  • localhost/infopathsdk/DataSubmit/SubmitService.asmx

Note

Web services provide a way to link InfoPath forms to non- Microsoft databases.

Tip

To install the InfoPath SDK web service examples locally, you must be running Windows XP Pro with IIS installed.

How to do it

The SDK has pretty good instructions on how the sample web services work and how to use them from InfoPath. I won’t repeat those here, but to make your life a little easier, I’ve installed those services at http:// www.mstrainingkits.com/Excel and modified the sample forms to work with that location. This means that you can run the samples without installing the SDK (Figure 7-35).

SDK web service sample (modified)

Figure 7-35. SDK web service sample (modified)

In addition to changing the data source for the web ...

Get Excel 2003 Programming: A Developer's Notebook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.