|
Posted by Ralfeus on 01/22/08 10:00
Hi
I have a web service written on the PHP. The appropriate WSDL looks
like this:
<s:complexType name="ArrayOfObjectData">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="ObjectData"
nillable="true" type="tns:ObjectData" />
</s:sequence>
</s:complexType>
<s:complexType name="ObjectData" abstract="true">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="ID" type="s:string" /
>
<s:element minOccurs="1" maxOccurs="1" name="ParentID"
type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="Name"
type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="Status"
type="tns:ObjectStatus" />
</s:sequence>
</s:complexType>
<s:complexType name="ProjectData">
<s:complexContent mixed="false">
<s:extension base="tns:ObjectData">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Form"
type="s:string" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
<s:element name="SynchronizeRequest">
<s:complexType>
<s:sequence>
<s:element name="ClientID" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="SynchronizeResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="SynchronizeResult"
type="tns:ArrayOfObjectData" />
</s:sequence>
</s:complexType>
</s:element>
There are one abstract object (ObjectData) and two inherited objects
(ProjectData and LocationData)
There is a method Synchronize, which returns an array of the objects
derived from the ObjectData.
There is a PHP code, which fill the array with ProjectData objects:
while ($object = mysql_fetch_array($result, MYSQL_ASSOC))
{
$newProject->ID = $object[object_id];
if ($object[version] == null)
{
$newProject->Status = "Deleted";
}
elseif ($object[object_version] == 0)
{
$newProject->Status = "New";
$newProject->Name = $object[name];
}
else
{
$newProject->Status = "Updated";
$newProject->Name = $object[name];
}
$objects[$objectCount++] = new SoapVar($newProject,
SOAP_ENC_OBJECT, "ProjectData");
}
return array("SynchronizeResult" => $objects);
The result, which SOAP server returns looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns1="http://informer.dataexchange/">
<SOAP-ENV:Body>
<ns1:SynchronizeResponse>
<ns1:SynchronizeResult>
<ns1:ObjectData xsi:type="ProjectData">
<ID>1</ID>
<Status>Updated</Status>
<Name>Project 1</Name>
</ns1:ObjectData>
</ns1:SynchronizeResult>
</ns1:SynchronizeResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
So it seems to be a normal array with one element.
The client is written on the C#. It normally calls the method
Synchronize and gets a result without errors. But result is empty
array, it has no elements.
How to fix it? Can it be a problem with object inheritance and forming
result at PHP code?
Thank you in advance
[Back to original message]
|