Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

WebServiceAdapter2.Input Property

Gets or sets the XML string ('outer XML') corresponding to the input element in the form definition (.xsf) file.

This property is not CLS-compliant.  

Namespace: Microsoft.Office.Interop.InfoPath.SemiTrust
Assembly: Microsoft.Office.Interop.InfoPath.SemiTrust (in microsoft.office.interop.infopath.semitrust.dll)

In the case of a Web service adapter used to submit data, the input element of the form definition (.xsf) file contains information about the parts of the secondary data source, specified by the partFragment elements, that will be provided as parameters to the Web method that is invoked for the Submit method operation.

NoteNote:

The Input property of the WebServiceAdapterObject is available for secondary data sources. The Input property for a main data source always returns an empty string since the queryFields group serves as the input for the WebServiceAdapter when querying the Web service.

ImportantImportant:

This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

In the following example, the Input property of the WebServiceAdapterObject is loaded into a temporary XML DOM, then displayed in a message box. A new XML node is then loaded into the temporary DOM from a resource file, "NewSource.xml", which is part of the form template. The Input property is then set to the updated temporary DOM, which changes how the WebServiceAdapter will submit data to the Web service:

const string newSourceXmlFileName = "NewSource.xml";

// Get the Main Data Source WebServiceAdapter object
WebServiceAdapter2 webServiceAdapter = thisXDocument.DataAdapters[0] as WebServiceAdapter2;
if (webServiceAdapter == null)
{
 thisXDocument.UI.Alert("A secondary WebServiceAdapter does not exist.");
 return;
}

// Load the xsf:input element into an XML DOM
IXMLDOMDocument2 tempDom = thisXDocument.CreateDOM() as IXMLDOMDocument2;
if (tempDom == null)
{
 thisXDocument.UI.Alert("Could not create a temporary DOM.");
 return;
}
tempDom.validateOnParse = false;
tempDom.preserveWhiteSpace = false;
tempDom.loadXML(webServiceAdapter.Input);

// Get the source attribute from the xsf:Input element
IXMLDOMNode sourceAttribute = tempDom.documentElement.attributes.getNamedItem("source");

// Show the source attribute value of the xsf:input element before the change
thisXDocument.UI.Alert(sourceAttribute.text);

// Change the source file name
sourceAttribute.text = newSourceXmlFileName;

// Show the source after the change
thisXDocument.UI.Alert(sourceAttribute.text);

// Save the changes from the tempDom back to the Input property
webServiceAdapter.Input = tempDom.xml;

Community Additions

Show:
© 2015 Microsoft