我正在创建一个stdobject,它通过带有_soapcall的SOAP发送到wsdl wevservice。
当我只发送一个参数时,它有效,但有时我需要在同一个标签下发送2个参数,而我不知道它是不是很热。让我解释一下。
我创建了2个std对象:
对象1
$sObject4->PropertyToSearchName = 'State';
$sObject4->SearchComparer = 'Equals';
$sObject4->Value = new SoapVar(2, XSD_INT, 'int','http://www.w3.org/2001/XMLSchema');
$sObject3->SearchObject = $sObject4;
对象2
$sObject41->PropertyToSearchName = 'ProviderId';
$sObject41->SearchComparer = 'Equals';
$sObject41->Value = new SoapVar(21, XSD_INT, 'int','http://www.w3.org/2001/XMLSchema');
$sObject31->SearchObject = $sObject41;
所以我需要合并这2个对象,所以我最终会得到类似的东西:
[ListOfSearchObjects] => stdClass Object
(
[SearchObject] => stdClass Object
(
[PropertyToSearchName] => State
[SearchComparer] => Equals
[Value] => SoapVar Object
(
[enc_type] => 135
[enc_value] => 2
[enc_stype] => int
[enc_ns] => http://www.w3.org/2001/XMLSchema
)
)
[SearchObject] => stdClass Object
(
[PropertyToSearchName] => ProviderId
[SearchComparer] => Equals
[Value] => SoapVar Object
(
[enc_type] => 135
[enc_value] => 21
[enc_stype] => int
[enc_ns] => http://www.w3.org/2001/XMLSchema
)
)
)
创建的soap需要使用2 [SearchObject]:
<ns3:ListOfSearchObjects>
<ns3:SearchObject>
<ns3:PropertyToSearchName>State</ns3:PropertyToSearchName>
<ns3:SearchComparer>Equals</ns3:SearchComparer>
<ns3:Value xsi:type="xsd:int">2</ns3:Value>
</ns3:SearchObject>
<ns3:SearchObject>
<ns3:PropertyToSearchName>Providerid</ns3:PropertyToSearchName>
<ns3:SearchComparer>Equals</ns3:SearchComparer>
<ns3:Value xsi:type="xsd:int">21</ns3:Value>
</ns3:SearchObject>
</ns3:ListOfSearchObjects>
答案 0 :(得分:1)
如果您在wsdl中定义的方法允许您发送多个SearchObjects
,那么当您将其传递给它时,它应该为您完成工作:
$args = array( $SearchObj1, $SearchObj2 )
$res = $client->__soapCall( 'ListOfSearchObjects', $args );