I have a SOAP service that returns an array of a complex type. The definition in NuSOAP in PHP looks like this:
// The type itself
$server->wsdl->addComplexType(
"Clip",
"complexType",
"struct",
"all",
"",
array(
"Id" => array(
"name" => "id",
"type" => "xsd:int"
)
// ---snip---
)
);
// The type of the array
$server->wsdl->addComplexType(
"ClipList",
"complexType",
"array",
"sequence",
"",
array(
"clip" => array(
"name" => "clip",
"type" => "tns:Clip",
"minOccurs" => "0",
"maxOccurs" => "unbounded"
)
),
array(),
"tns:Clip"
);
// The service
$server->register(
"GetClipList",
array(),
array(
"clips" => "tns:ClipList"
),
"urn:MyNamespace",
"urn:MyNamespace#GetClipList",
"rpc",
"encoded",
"Retrieves a list of all clips."
);
Now in my VisualStudio2010 C# project I added a new service based on the generated WSDL. VS created a proxy class for me to use which contains a class ClipList
which has a single data member of type Clip[]
.
So far so good. Now when I call GetClipList()
on my proxy I get a CommunicationException
telling me that it cannot assign an object of type Clip[]
to an object of type ClipList
.
So I am assuming it deserialized the returned data into a Clip[]
and now wants to satisfy the return type of the GetClipList
method (which would be ClipList
).
When changing the return value of GetClipList()
in the proxy to Clip[]
manually, the application runs fine. But I want to avoid changing the auto-generated class for obvious reasons.
So, why does it not instantiate a ClipList
and fill the data member? Or alternatively, why doesn't VS generate the proxy class so that GetClipList
directly returns a Clip[]
.