Methods and SOAP objects

When working with SOAP interfaces, it is common to encounter methods that need instances of objects presented by the SOAP service. The SearchElements method is an example of this type.

The SearchElements method requires an array of SOAP.SearchCondition as an argument. This is shown in the following by accessing the definition of the method:

PS> $service.SearchElements

OverloadDefinitions
-------------------
SOAP.Element[] SearchElements(SOAP.SearchCondition[] searchConditions)

An instance of SearchCondition may be created as follows:

$searchCondition = [SOAP.SearchCondition]::new()

Exploring the object with Get-Member shows that the operator property is another type from the SOAP service. This is an enumeration, as shown here:

PS> [SOAP.ComparisonOperator]

IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True ComparisonOperator System.Enum

A set of search conditions may be constructed and passed to the method:

$searchConditions = @(
[SOAP.SearchCondition]@{
PropertyName = 'AtomicNumber'
Operator = 'ge'
Value = 1
}
[SOAP.SearchCondition]@{
PropertyName = 'AtomicNumber'
Operator = 'lt'
Value = 6
}
)
$service.SearchElements($searchConditions)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.97.248