CallMethod
The CallMethod method executes an IDO method that can either be code in a custom assembly
or in a stored procedure.
Syntax
public object CallMethod( string strSessionToken, string strIDOName, string strMethodName, ref string strMethodParameters )
Parameters
Name | Description |
---|---|
strSessionToken | This is the session token obtained through a call to the CreateSessionToken API. |
strIDOName | This is the name of the IDO that publishes the method. |
strMethodName | This is the name of the IDO to call. |
strMethodParameters | This parameter is an XML-formatted string that contains the
parameters to pass to the method. The argument for this parameters looks like this:
<Parameters>
<Parameter ByRef="Y|N">value</Parameter>
...etc...
</Parameters>
|
Output
Returns the value that was returned to it by the method.
Example
string sessionToken = "b/XdI6IQzCviZOGJ0E+002…5vl903teP0jSDwkFs"; string ido = "UserNames"; string idoMethod = "GetUserAttributes"; List<Parameter> parameters = new List<Parameter> { new Parameter() { Text = "sa", ByRef = "Y" }, new Parameter() { Text = string.Empty, ByRef = "Y" }, new Parameter() { Text = string.Empty, ByRef = "Y" }, new Parameter() { Text = string.Empty, ByRef = "Y" }, new Parameter() { Text = string.Empty, ByRef = "Y" } }; XmlDocument xdoc = new XmlDocument(); XPathNavigator nav = xdoc.CreateNavigator(); using ( XmlWriter writer = nav.AppendChild() ) { XmlSerializer serializer = new XmlSerializer( typeof( List<Parameter> ), new XmlRootAttribute( "Parameters" ) ); serializer.Serialize( writer, parameters ); } IDOWebService.DOWebServiceSoapClient soapClient = new IDOWebService.DOWebServiceSoapClient(); // provide the ido parameters as payload string idoParameters = xdoc.OuterXml; object result = soapClient.CallMethod( sessionToken, ido, idoMethod, ref idoParameters );
Helper classes for the example
You can use these classes to help construct the request as demonstrated in the code snippets above:
[XmlRoot( ElementName = "Parameter" )] public class Parameter { [XmlAttribute( AttributeName = "ByRef" )] public string ByRef { get; set; } [XmlText] public string Text { get; set; } } [XmlRoot( ElementName = "Parameters" )] public class Parameters { [XmlElement( ElementName = "Parameter" )] public Parameter Parameter { get; set; } }