Edit

Share via


WebServiceConnection Class

Definition

Represents a connection to an XML Web service.

public ref class WebServiceConnection abstract : Microsoft::Office::InfoPath::DataConnection
public abstract class WebServiceConnection : Microsoft.Office.InfoPath.DataConnection
type WebServiceConnection = class
    inherit DataConnection
Public MustInherit Class WebServiceConnection
Inherits DataConnection
Inheritance
WebServiceConnection

Examples

In the following example, a reference to the WebServiceConnection object that represents the connection named "Main query" is set by passing the name to the Item[String] property of the DataConnectionCollection class, and then casting the returned object to the WebServiceConnection type.

WebServiceConnection wsConnection = (WebServiceConnection)this.DataConnections["Main query"];
Dim wsConnection As WebServiceConnection = _
   DirectCast(Me.DataConnections("Main query"), WebServiceConnection)

After the reference has been set, you can use the properties of the WebServiceConnection object as shown in the following example, which sets a string variable to the value returned by the ServiceUrl property.

string wsServiceURL = wsConnection.ServiceUrl.ToString();
Dim wsServiceURL As String = _
   string wsServiceURL = wsConnection.ServiceUrl.ToString()

Remarks

The WebServiceConnection class represents a data connection created in InfoPath using the Data Connection Wizard that specifies all the information necessary for retrieving data from and submitting data to an external data source using a Web service.

The WebServiceConnection provides properties that can be used to get and set information about the data connection's input and operation strings. It also provides a property for getting the Uniform Resource Locator (URL) of the Web Services Description Language (WSDL) file of the XML Web service.

The WebServiceConnection object associated with the data connection is accessible using the DataConnections property of the XmlForm class to return the connection from the DataConnectionCollection of the form template.

In addition to the default Execute() method inherited from the DataConnection base class that performs a query or submit operation using the values that were declaratively defined in InfoPath form template design mode, the WebServiceConnection class also provides the Execute(XPathNavigator, XPathNavigator, XPathNavigator) method, which allows you to specify a different source of data to submit, a different location to insert the returned data, and a way to retrieve errors returned by the connection.

The WebServiceConnection class corresponds to the WebServiceAdapterObject interface of the Microsoft Office InfoPath 2003 object model.

Constructors

WebServiceConnection()

Properties

Name

Gets the name of the data connection.

(Inherited from DataConnection)
ServiceUrl

Gets or sets the Uniform Resource Locator (URL) that is used to invoke the Web service associated with a WebServiceConnection object.

SoapAction

Gets or sets the value of the soapAction attribute of the Web service associated with a WebServiceConnection object.

Timeout

Gets or sets the time-out value in seconds for data connection associated with a WebServiceConnection object.

WsdlUrl

Gets the Uniform Resource Locator (URL) of the Web Services Description Language (WSDL) file for the Web service associated with the WebServiceConnection object.

Methods

Execute()

Depending on which ConnectionTypeConnection class it is called from, executes a submit or query operation on the data connection using the declaratively defined values for the submitted data, query parameters, or data to retrieve.

(Inherited from DataConnection)
Execute(XPathNavigator, XPathNavigator, XPathNavigator)

Overrides the default Execute() method inherited from the DataConnection base class to allow specifying a different source of data to submit, a different location to insert the data that is returned, or a location to insert any error text returned.

GenerateDataSetDiffGram()

For a data connection that uses an ADO .NET DataSet and returns a DiffGram that identifies any differences between original and current versions of data elements.

Applies to