WebServiceAdapter2.Input 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置与表单定义 (.xsf) 文件中的 input 元素相对应的 XML 字符串 ('outer XML')。
public:
property System::String ^ Input { System::String ^ get(); void set(System::String ^ value); };
public string Input { get; set; }
member this.Input : string with get, set
Public Property Input As String
属性值
实现
示例
在以下示例中, 的 WebServiceAdapterObjectInput 属性将加载到临时 XML DOM 中,然后显示在消息框中。 然后,会将一个新的 XML 节点从资源文件“NewSource.xml”(表单模板的一部分)加载到这个临时的 DOM 中。 Input 属性随后被设置为更新的临时 DOM,它会更改 WebServiceAdapter 向 Web 服务提交数据的方式:
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.<span class="label">Input</span>);
// 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;
注解
对于用于提交数据的 Web 服务适配器,表单定义 (.xsf) 文件的 输入 元素包含有关辅助数据源部分的信息(由 partFragment 元素指定),这些部分将作为参数提供给为 Submit() 方法操作调用的 Web 方法。
注意:的 WebServiceAdapterObjectInput 属性可用于辅助数据源。 主数据源的 Input 属性总是返回空字符串,这是由于在查询 Web 服务时,queryFields 组充当 WebServiceAdapter 的输入。
重要提示:此成员只能由与当前打开的窗体在同一域中运行的表单访问,或者由已授予跨域权限的表单访问。