سؤال

أحتاج إلى إنشاء 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" سمة في علامة shippingservicecost في XML. كيف أقوم بهذا العمل؟

هل كانت مفيدة؟

المحلول

لا تحتاج إلى استخدام Soapvar. هذا يعمل (بالنسبة لي على الأقل):

$params =   array(
         'InternationalShippingServiceOption' => array(
            'ShippingService'=>'StandardInternational',
            'ShippingServiceCost' => array('_' => 39.99, 'currencyID' => 'USD')
            'ShippingServicePriority'=>1,
            'ShipToLocation'=>'CA',
        )
    )

أنا أستخدم هذه التقنية مع API PayPal SOAP.

نصائح أخرى

لماذا ، أنا سعيد لأنك سألت. أنا فقط حل هذا اليوم.

$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"
);

ثم تابع كالمعتاد.

واسمحوا لي أن أعرف إذا كنت بحاجة إلى المزيد من المساعدة.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top