2013-09-30 152 views
0

我正在創建一個stdobject,通過帶有_soapcall的SOAP發送到wsdl wevservice。php stdClass對象重複

它發揮作用時,我只發送一個參數,但有時我需要發送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 
    ) 
    ) 
) 

創建的肥皂需要看起來像這樣用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> 
+1

你有WSDL嗎? –

回答

1

如果您在WSDL定義的方法,您可以發送多個SearchObjects它應該爲你做的工作,當你傳遞兩個:

$args = array($SearchObj1, $SearchObj2) 

$res = $client->__soapCall('ListOfSearchObjects', $args); 
+0

是的,它允許發送muktiple對象。事實上,我已經送了很多。唯一的問題是發送2具有相同的名稱....它有格式正確。 – user2831075