Php SOAP服务器类映射数组不能处理数组中的对象
我创建了一个SOAP服务器(对WSDL使用Zend_SOAP_AutoDiscover),并将其类映射作为参数传递 调用我的“ManageOrder”函数时,接收到的输入具有类映射中定义的所有成员类型,但数组中的成员类型除外(即使在类映射中指定了它们,它们仍被视为“stdclass”对象) 用PHP声明的类:Php SOAP服务器类映射数组不能处理数组中的对象,php,soap,Php,Soap,我创建了一个SOAP服务器(对WSDL使用Zend_SOAP_AutoDiscover),并将其类映射作为参数传递 调用我的“ManageOrder”函数时,接收到的输入具有类映射中定义的所有成员类型,但数组中的成员类型除外(即使在类映射中指定了它们,它们仍被视为“stdclass”对象) 用PHP声明的类: class TManageOrderInput // Has been simplified for the sake of readability { /** @v
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>
为什么数组中的对象类型仍然会被检测为stdclass
我是缺少了什么,还是仅仅是SOAP服务器没有处理的问题?我也有同样的问题,但与SOAP客户端类映射有关。你成功地解决了这个问题吗?没有,据我记忆所及,我从来没有解决过这个问题(我认为这不是我这边的拦截器,有一些解决办法)@sidonThis是PHP中的一个;也许,我能帮助你。此错误与来自官方RFC的错误相关,在RFC中,您似乎需要精确指定数组中有多少项,除非使用minOccurs/maxOccurs,否则[]不会剪切它。
$classMap = array('classmap' => array(
'TManageOrderInput' => 'TManageOrderInput',
'TManageOrderOutput' => 'TManageOrderOutput',
'Torder' => 'Torder',
'Torderdetailtax' => 'Torderdetailtax'
));
$server = new Zend_Soap_Server($wsdl, $classMap);
$server->setClass('MDGSS');
$server->handle();