Configuring and Testing the InfoPath SDK Samples

 <  Day Day Up  >  

Two XML Web service sample form templates are supplied with the InfoPath SDK. We will briefly look at using each of these in turn .

The Web Service Developer Form Template

The first sample is called the Web Service Developer Sample. To open it in design mode, open the Design a Form task pane and select the On My Computer option in the Open a Form in Design Mode section. The Open in Design Mode window opens.

Navigate to the c:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft Office InfoPath 2003 SDK\Samples\WebSvc directory. (Adjust the path if you chose a drive other than drive C : to install the SDK.) Highlight the WEBSVC.XSN InfoPath form template, and click the Open button. The form template opens in design mode (see Figure 8.8).

Figure 8.8. The WEBSVC.XSN form template in design mode.

graphics/08fig08.gif

Click the Preview Form button in the toolbar, and the form opens in form-filling mode (see Figure 8.9).

Figure 8.9. The WEBSVC.XSN form template in form-filling mode.

graphics/08fig09.gif

From the drop-down menu, select a name and click the Run Query button. The results of a sample query are shown in Figure 8.10.

Figure 8.10. Results of a sample query.

graphics/08fig10.gif

A description of the methods of the XML Web service can be accessed at http://localhost/infopathsdk/infopathwebservicesample/infopathwebservicesample.asmx or at a URL modified for the server on which you chose to run the Web service.

The WSDL description of the Web service can be accessed at http://localhost/infopathsdk/infopathwebservicesample/infopathwebservicesample.asmx?WSDL (see Figure 8.11).

Figure 8.11. The WSDL description of the sample XML Web service.

graphics/08fig11.jpg

SHOP TALK
WHEN A WEB SERVICE FALLS OVER FOR NO REASON

InfoPath's connection to Web services can fall over for no obvious reason ( assuming that you got the configuration correct as described earlier in this chapter) and can stay broken! See Figure 8.12 for the error message. I wasted many hours trying to fix a problem with Web services and my IIS configuration, and even went to the lengths of a complete reinstallation of IIS and the InfoPath SDK on one occasion. But despite the fact that InfoPath indicates a Web service error, the Web service might be working fine. So where does the problem come from?

Figure 8.12. The misleading error message in InfoPath caused by Internet Explorer deciding to work offline.

graphics/08fig12.gif

It has been my experience over several years that Internet Explorer at times suddenly imagines itself offline for no obvious reason on both Windows 2000 and Windows XP. When you are running Internet Explorer, you are offered a window to go online again. Irritating, but not particularly damaging .

Remember that InfoPath 2003 uses the Internet Explorer rendering engine. So, when Internet Explorer switches itself into Work Offline mode, InfoPath 2003 just stops working with XML Web services ”and stays stopped ! Unlike in Internet Explorer, you get no warning that InfoPath thinks it is working offline and imagines it can't connect to the Web service. It is all too easy to waste hours trying to diagnose a problem with the Web service or the IIS configuration, when the problem is that Internet Explorer (and therefore InfoPath) wrongly imagines it is offline. Look on the File menu of Internet Explorer and uncheck the Work Offline setting, and magically all Web services start working again.


The Web service sample also has an Order Information view to enter information for a new product (see Figure 8.13).

Figure 8.13. The Order Information view of the sample XML Web service.

graphics/08fig13.gif

Configuring the Purchase Order Sample

Assuming the proper configuration of Internet Information Services, the InfoPath SDK, and SQL Server has been carried out, you are ready to configure the Purchase Order sample form template.

On Windows XP Professional, select Start, All Programs, Microsoft Office 2003 Developer Resources, Microsoft Office InfoPath 2003 SDK, Setup, Purchase Order Web Service Sample Setup. The InfoPath SDK Configuration: PO WebService Developer Sample window opens (see Figure 8.14).

Figure 8.14. The InfoPath SDK Configuration: PO WebService Developer sample window.

graphics/08fig14.gif

Enter a user ID in the User Id text box and a password in the Password text box. A connection string is created automatically in the Your Connection String Is text box.

Click the Execute button. If the connection is successful with the provided User ID and password, the Status, displayed to the left of the Execute button, will change to Complete.

Finally, assuming that configuration of the Web Service was completed successfully, click the Execute button in the Update and Register the PO Web Service Form Templates section. If all is correct, the Status will change to Complete.

INTERACTION BETWEEN CONFIGURATION AND OTHER OPEN INFOPATH FORM TEMPLATES

When updating and registering the Purchase Order Web Service Form Template, you might find that InfoPath wants to close one or more open form templates. If they have not been recently saved, you will be asked if you want to save changes. However, if you have multiple windows open, you might not realize that the configuration is not completing because InfoPath is waiting for a response from you.


The first time you open the Purchase Order, it won't appear on the list of recently used forms. So, open the Fill Out a Form task pane, select More Forms in the Fill Out a Form section, and select the Custom Installed Forms tab of the Forms window (see Figure 8.15).

Figure 8.15. The Custom Installed Forms tab of the Forms window.

graphics/08fig15.gif

Select the Purchase Order form. Figure 8.16 shows how a developer with a taste for seafood might fill in the form.

Figure 8.16. The Purchase Order form.

graphics/08fig16.gif

There is also an invoice component to the sample that you can take time to explore on your own.

 <  Day Day Up  >  


Microsoft Office InfoPath 2003 Kick Start
Microsoft Office InfoPath 2003 Kick Start
ISBN: 067232623X
EAN: 2147483647
Year: 2004
Pages: 206

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net