我有一个SOAP服务器(使用Zend_Soap_AutoDiscover作为WSDL),它的类映射作为参数创建。
当我的" ManageOrder"函数被调用,接收到的输入具有类映射中定义的所有成员类型,除了数组中的那些(它们被视为" stdclass"对象,即使它们在类映射中指定)。
用PHP声明的类:
class TManageOrderInput // Has been simplified for the sake of readability
{
/** @var Torder **/
public $orderHeader; // This will be detected as Torder
/** @var Torderdetailtax[] **/ // orderDetailTaxes[0] will be of type stdclass
public $orderDetailTaxes;
}
WSDL中的orderdetail和orderdetail数组类型:
<xsd:complexType name="ArrayOfTorderdetailtax">
<xsd:complexContent>
<xsd:restriction base="soap-enc:Array">
<xsd:attribute ref="soap-enc:arrayType" wsdl:arrayType="tns:Torderdetailtax[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="Torderdetailtax">
<xsd:all>
<xsd:element name="orderdetailid" type="xsd:string"/>
<xsd:element name="taxid" type="xsd:string"/>
<xsd:element name="taxamount" type="xsd:double"/>
</xsd:all>
</xsd:complexType>
以下是classmap和SOAP服务器创建:
$classMap = array( 'classmap' => array(
'TManageOrderInput' => 'TManageOrderInput',
'TManageOrderOutput' => 'TManageOrderOutput',
'Torder' => 'Torder',
'Torderdetailtax' => 'Torderdetailtax'
)
);
$server = new Zend_Soap_Server($wsdl,$classMap);
$server->setClass('MDGSS');
$server->handle();
为什么数组中的对象类型仍然被检测为stdclass?
我是否遗漏了某些内容,或者只是SOAP服务器未处理的内容?