質問
SOAPで次のXMLを生成する必要があります。
...
<InternationalShippingServiceOption>
<ShippingService>StandardInternational</ShippingService>
<ShippingServiceCost currencyID="USD">39.99</ShippingServiceCost>
<ShippingServicePriority>1</ShippingServicePriority>
<ShipToLocation>CA</ShipToLocation>
</InternationalShippingServiceOption>
...
したがって、これを行うために、PHPに次の石鹸アレイがあります。
$params = array(
'InternationalShippingServiceOption' => array(
'ShippingService'=>'StandardInternational',
'ShippingServiceCost'=>39.99,
'ShippingServicePriority'=>1,
'ShipToLocation'=>'CA',
)
)
$client = new eBaySOAP($session); //eBaySOAP extends SoapClient
$results = $client->AddItem($params);
私が生成していないことを除いて、すべてがうまく機能します CurrencyId = "USD" XMLのShippingserviceCostタグの属性。どうすればいいですか?
解決
Soapvarを使用する必要はありません。これは機能します(少なくとも私にとっては):
$params = array(
'InternationalShippingServiceOption' => array(
'ShippingService'=>'StandardInternational',
'ShippingServiceCost' => array('_' => 39.99, 'currencyID' => 'USD')
'ShippingServicePriority'=>1,
'ShipToLocation'=>'CA',
)
)
PayPal Soap APIでこの手法を使用しています。
他のヒント
なぜ、私はあなたが尋ねたことをうれしく思います。今日はこれを解決しました。
$shippingsvccostwithid = new SoapVar(array('currencyID' => $whatever),SOAP_ENC_OBJECT, 'ShippingServiceCost', 'https://your.namespace.here.com/');
$params = array("InternationalShippingServiceOption" => array(
"ShippingService" => "StandardInternational",
"ShippingServiceCost" => $shippingsvccostwithid,
"ShippingServicePriority" => 1,
"ShipToLocation" => "CA"
);
そして、通常どおり続けます。
これ以上助けが必要な場合はお知らせください。
所属していません StackOverflow