WebServiceAdapter Object

Microsoft Office InfoPath

Show All Show All

WebServiceAdapter Object

WebServiceAdapter

Represents a connection to an XML Web service. The WebServiceAdapter object is a type of Microsoft Office InfoPath 2003 data adapter that contains all the information necessary for retrieving data from and submitting data to an external data source.

Remarks

The WebServiceAdapter object provides properties that can be used to get and set information about the data adapter'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.

Using the WebServiceAdapter object

For secondary data sources, the WebServiceAdapter object is accessible through the QueryAdapter property of the DataObject object, and DataObject objects are accessible through the DataObjects property of the XDocument object.

If a Web service is used as the primary data source for a form, the WebServiceAdapter object is accessible through the QueryAdapter property of the XDocument object.

In the following example, a reference to the WebServiceAdapter object is set by using the QueryAdapter property of the DataObject object by passing the name of the DataObject object to the Item property of the DataObjects collection:

    var objWSAdapter;

objWSAdapter = XDocument.DataObjects("GetCityList").QueryAdapter;
  

After the reference has been set, you can use the properties of the WebServiceAdapter object as shown in the following example, which sets a reference to the XML node returned by the Input property:

    var objInputNode;

objInputNode = XDocument.DataObjects("GetCityList").QueryAdapter.Input;
  

Note that in this case, the QueryAdapter property was used to access the Input property of the WebServiceAdapter object.

For more information about using the WebServiceAdapter object, see Accessing external data sources.

 

The WebServiceAdapter object contains the following properties:

Property Description
ErrorsLocation A property of type IXMLDOMNode that sets or retrieves the errors node under which the WebServiceAdapter object will write the error details returned by the Web service. The initial value is null.
Input Sets or retrieves a string that contains the source XML of the input element contained in the form definition file (.xsf).
Name A read-only property of type String that returns the name of the WebServiceAdapter object.
Operation Sets or retrieves a string that contains the source XML of the operation element contained in the form definition (.xsf) file.
OutputLocation A property of type IXMLDOMNode that sets or retrieves the output node under which the WebServiceAdapter object will copy the returned XML.
QueryAllowed A read-only property of type Boolean that corresponds to the queryAllowed attribute in the form definition (.xsf) file.
SubmitAllowed A read-only property of type Boolean that corresponds to the submitAllowed attribute in the form definition file (.xsf).
Timeout A property of type Long that sets or retrieves the length of time, in seconds, for the WebServiceAdapter object to time-out on subsequent requests. The default value is 30 seconds.
WSDLURL A read-only property that returns a string that contains the Uniform Resource Locator (URL) of the Web Services Description Language (WSDL) file for the Web service associated with the WebServiceAdapter object.

The WebServiceAdapter object contains the following methods:

Method Property
GenerateDataSetDiffGram Returns an ADO.Net DataSet containing an inline schema describing the data and the DiffGram of the DataSet. The DiffGram for the input dataDom is generated, using the sibling node OriginalData to compute the difference between the OriginalData and the input dataDom.
Query Executes the Query method on the WebServiceAdapter object. Fails if the QueryAllowed property is False.
Submit Executes the Submit method on the WebServiceAdapter object. Fails if the SubmitAllowed property is False.