Partager via


WebServiceAdapter2.Operation - Propriété

Obtient ou définit la chaîne XML ('outer XML') correspondant à l'élément operation contenu dans le fichier de définition de formulaire (.xsf) de l'objet WebServiceAdapterObject.

Espace de noms :  Microsoft.Office.Interop.InfoPath.SemiTrust
Assembly :  Microsoft.Office.Interop.InfoPath.SemiTrust (dans Microsoft.Office.Interop.InfoPath.SemiTrust.dll)

Syntaxe

'Déclaration
Property Operation As String
    Get
    Set
'Utilisation
Dim instance As WebServiceAdapter2
Dim value As String

value = instance.Operation

instance.Operation = value
string Operation { get; set; }

Valeur de propriété

Type : System.String

Implémentations

WebServiceAdapter.Operation

Remarques

L'élément operation du fichier .xsf contient des informations sur le service Web, telles que le nom de la méthode Web, la méthode utilisée pour extraire et envoyer des données et son URL (Uniform Resource Locator).

Important

Seuls les formulaires qui s’exécutent dans le même domaine que le formulaire actuellement ouvert ou les formulaires disposant d’autorisations inter-domaines peuvent accéder à ce membre.

Exemples

Dans l'exemple suivant, la propriété Operation de l'objet WebServiceAdapterObject est utilisée pour récupérer les propriétés de l'élément operation dans le fichier .xsf. L'serviceUrl de l'WebServiceAdapter est mise à jour, puis la méthode Query de l'WebServiceAdapter est appelée :

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.Operation = tempDom.xml;

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

Voir aussi

Référence

WebServiceAdapter2 interface

WebServiceAdapter2 - Membres

Operation - Surcharge

Microsoft.Office.Interop.InfoPath.SemiTrust - Espace de noms