次の方法で共有


WebServiceAdapter2.Operation プロパティ

定義

オブジェクトのフォーム定義 (.xsf) ファイルに含まれる 操作 要素に対応する XML 文字列 ('outer XML') を WebServiceAdapterObject 取得または設定します。

public:
 property System::String ^ Operation { System::String ^ get(); void set(System::String ^ value); };
public string Operation { get; set; }
member this.Operation : string with get, set
Public Property Operation As String

プロパティ値

実装

次の例では、オブジェクトの Operation プロパティを WebServiceAdapterObject 使用して、.xsf ファイル内の operation 要素のプロパティを取得します。 WebServiceAdapterserviceUrl が更新されQuery()WebServiceAdapter のメソッドが呼び出されます。

const string newServiceUrl = "NewOperationName";

// 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.Operation);

// All available properties on the operation element: name, soapAction, serviceUrl
IXMLDOMNode nameAttribute = 
 tempDom.documentElement.attributes.getNamedItem("name");
IXMLDOMNode soapActionAttribute =
 tempDom.documentElement.attributes.getNamedItem("soapAction");
IXMLDOMNode serviceUrlAttribute =
 tempDom.documentElement.attributes.getNamedItem("serviceUrl");

// Show the serviceUrl attribute value of the xsf:operation element before the change
thisXDocument.UI.Alert(serviceUrlAttribute.text);

// Change the serviceUrl
serviceUrlAttribute.text = newServiceUrl;

// Show the serviceUrl after the change
thisXDocument.UI.Alert(serviceUrlAttribute.text);

// Save the changes from the tempDom back to the Operation property
webServiceAdapter.<span class="label">Operation</span> = tempDom.xml;

// Run a query with the changed serviceUrl
webServiceAdapter.Query();

注釈

.xsf ファイルの operation 要素には、Web メソッドの名前、データの取得や送信に使用するメソッド、Web サービスの URL (Uniform Resource Locator) など、Web サービスに関する情報が格納されます。

重要: このメンバーにアクセスできるのは、現在開いているフォームと同じドメインで実行されているフォーム、またはクロスドメインアクセス許可が付与されているフォームのみです。

適用対象