Secondary Data Source Web Service Parameters using C# at Runtime in InfoPath
page 1 of 3
Published: 04 Aug 2004
Unedited - Community Contributed
This article explains how to pass parameters to a secondary data source web service at runtime using C# in InfoPath.
by Michelle Beall
Average Rating: 
Views (Total / Last 10 Days): 23625/ 22


When creating forms one thing users have become accustomed to is having dynamic forms with features such as cascading drop down lists.  Microsoft’s latest addition to the Office suite, InfoPath, provides the means to swiftly create structured data forms and with a little code some of these dynamic capabilities can also be implemented.


I tried to replicate some of the functionality I was able to provide in ASP.NET forms using Microsoft InfoPath SP1.  Since it is still a new product I found resources to be scarce, so I hope this article will help others adopt and use InfoPath meaningfully in a shorter time.


One of the more useful techniques is to know how to pass parameters to a web service at runtime.  This technique lends itself well to creating dependent drop down lists and runtime lookups or queries. This example will demonstrate how to set an InfoPath form’s secondary data source web service parameter using managed code and uses the following:

  • Microsoft Office InfoPath 2003 Service Pack 1 (SP1) Preview
  • InfoPath 2003 Toolkit for Visual Studio .NET
  • Microsoft Visual Studio .NET 2003 (1.1 Framework)
  • Microsoft Visual C#
  • Web service running on IIS 6.0

View Entire Article

User Comments

Title: Managed Code Question   
Name: Keith B
Date: 2005-02-06 1:19:33 AM
So far, all of my infopath developement has used Jscript, and the SP1 SDK provides some very useful JScript routines such as sorting an xml document object, etc. If I used managed code such as C#, or, will I need to re-create that Jscript funtionality, or can I use Jscript along with the managed code?
Title: Which Web Service does this example use?   
Name: Keith B
Date: 2005-02-06 1:15:29 AM
Thank you for the tutorial. I'm a newbie as far as Web Services are concerned. Here are some questions:
1) Your tutorial specifies a web service running under IIS 6.0. Why is that important? There are many online web services and some are not running under IIS 6.0. How would the example need to be different to work with a non-IIS 6.0 Web site?

2) I cannot find any reference in the tutorial to a specific web service. Probably, I do not know enough about Web Services to identify what aspects of the code relate to a specific web service. I guess another form of this question would be: If I followed the tutorial exactly and pasted your code from the code examples. Which web service would I be accessing when I run the example? Or, what do I need to do to provide the web service that this example uses?

Thanks again for creating this tutorial.
Title: Secondary Data Source Web Service Parameters using C# at Runtime in InfoPath   
Name: Anbukannan
Date: 2004-08-24 5:04:16 AM
It would be help for a web service newbie like me if this article covers abt writing web service bound as the secondary data source

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-07-23 5:25:55 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search