Erin, the originator of this thread, writes that a SOAP SOE was written that successfully sends an array of strings as input. I have a working SOAP SOE that takes a custom type but have had no luck with sending arrays (either with my custom type or even with simple types). Does any one know of samples out there that show the correct syntax for this?
Tom,While I do not know of any online samples, I can at least provide you a few code snippets to illustrate how to use arrays as SOE method inputs.The first snippet is from the hand-rolled WSDL for the SOE. It demonstrates how to define a SOAP method with a string array input parameter.
<xs:element name="GetStuffByStringArray">
<xs:complexType>
<xs:sequence>
<xs:element name="aStringArray" type="ArrayOfString" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetStuffByStringArrayResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="resultString" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
Note that ArrayOfString is an XML type defined in the Esri namespace. On the ArcObjects side, this XML type can be translated as an IStringArray object as demonstrated in the code block below:
private void GetStuffByStringArray(IMessage request, IMessage response)
{
// Begin by parsing the string array from the request parameter.
IStringArray stringCollection;
int fieldIndex = Utility.FindFieldIndex("aStringArray", request.Parameters, true);
stringCollection = request.Parameters.GetObject(fieldIndex, Utility.EsriNamespace, "ArrayOfString") as IStringArray;
// Do something with the string values...
}
Creating an SOE method that takes an array of custom type objects involves a bit more work. I'm happy to provide more detail but here are the essential concepts:1) Create a new class (e.g. MyTypeCollection) that is derived from SerializableList<T> where T is your custom type that you want to pass a collection of. This collection class will be the type that the SOAP parameter can be deserialized into.2) Define a corresponding XML type for MyTypeCollection. It will look something like the following:
<xs:complexType name="MyTypeCollection">
<xs:sequence>
<xs:element minOccurs="0"
maxOccurs="unbounded"
name="MyType"
type="tns:MyType"/>
</xs:sequence>
</xs:complexType>
3) Then, in your SOE code itself, deserialize the input parameter using code similar to the following:
MyTypeCollection collection = new MyTypeCollection();
int fieldIndex = Utility.FindFieldIndex("myTypeCollectionInput", request.Parameters, true);
collection = request.Parameters.GetObject(fieldIndex, Utility.CustomTypesNamespace, "MyTypeCollection ") as MyTypeCollection;
Note that your custom types/classes will need to implement the Deserialize and Serialize methods of the IXMLSerialize interface, and each custom type will need an entry in your XML type mapping file. Those topics are covered in detail in Esri's SOE samples.Hope this helps!