当我在SoapUI中测试请求时,它看起来像这样:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<offers:getOffersResponse xmlns:offers="http://www.pontis.com/integration/common/offers/v1" xmlns:kartel-offers="http://www.pontis.com/integration/kartel/offers/v1" xmlns:common="http://www.pontis.com/integration/common/integration-common/v1">
<common:result>
<common:code>0</common:code>
</common:result>
<categories>
<category id="myPromotion">
<offers>
<offer id="DB-_Ui03_1966_3a8f1c986c_ca6aa">
<type>BAU</type>
<selectionMode>not-available</selectionMode>
<selectionParams>
<code>789</code>
</selectionParams>
<kartel-offers:digitalPresentationInfo>
<text>Vivamus, WEB Russian mea Lesbia, atque amemus, rumoresque senum severiorum omnes unius aestimemus assis!
soles occidere et redire possunt; nobis, cum semel occidit brevis lux, nox est perpetua una dormienda.</text>
<bannerId>catullus5_web.png</bannerId>
</kartel-offers:digitalPresentationInfo>
<kartel-offers:digitalOfferAdditionalInfo>
<shortDescription>one WEB RU of the most famous poems by Catullus</shortDescription>
<amount>25</amount>
<price>22</price>
<unitType>MINUTES</unitType>
<validity>29</validity>
</kartel-offers:digitalOfferAdditionalInfo>
</offer>
</offers>
<kartel-offers:digitalPresentationInfo>
<text>myPromotion</text>
</kartel-offers:digitalPresentationInfo>
</category>
</categories>
</offers:getOffersResponse>
</soapenv:Body>
</soapenv:Envelope>
但是当我从php打电话时,它会遗漏一些属性(digitalPresentationInfo,digitalOfferAdditionalInfo等):
stdClass Object ( [result]
=> stdClass Object ( [code]
=> 0 )
[categories]
=> stdClass Object ( [category]
=> stdClass Object ( [offers]
=> stdClass Object ( [offer]
=> stdClass Object ( [type]
=> BAU [selectionMode]
=> not-available [selectionParams]
=> stdClass Object ( [code]
=> 789 ) [id]
=> DB-_Ui03_1966_3a8f1c986c_ca6aa ) ) [id]
=> myPromotion ) ) )
为什么在php调用期间缺少属性?
PHP代码:
$wsdlUrl = 'kartel/kartel-offers.wsdl';
$soapClientOptions = array(
'exceptions'=>true,
'cache_wsdl'=>WSDL_CACHE_NONE,
'encoding'=>'utf-8'
);
$client = new \SoapClient($wsdlUrl,$soapClientOptions);
$params = [
'msisdn' => '7773277581',
'requestedOfferType' => 'bau',
'language' => 'ru',
'channel' => 'web'
];
$result = $client->getOffers($params);
print_r($result);
UPD PHP代码(在html部分中)制作soap调用和XSD架构(在js部分中):https://jsfiddle.net/j5v8eoyf/