-2

I have code that looks like this to create a XML Request. I've tried a few variations, but only get errors. Can anyone help?

// create the XML request
$xmlRequest  = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
$xmlRequest .= "<AddItemRequest xmlns=\"urn:ebay:apis:eBLBaseComponents\">";
$xmlRequest .= "<ErrorLanguage>en_US</ErrorLanguage>";
$xmlRequest .= "<WarningLevel>High</WarningLevel>";
$xmlRequest .= "<Item>";
$xmlRequest .= "<Title>" . $addTitle . "</Title>";
$xmlRequest .= "<Description>" . $addDesc . "</Description>";
$xmlRequest .= "<PrimaryCategory>";
$xmlRequest .= "<CategoryID>" . $addCatID . "</CategoryID>";
$xmlRequest .= "</PrimaryCategory>";
$xmlRequest .= "<StartPrice>" . $addSPrice . "</StartPrice>";
$xmlRequest .= "<ConditionID>1000</ConditionID>";
$xmlRequest .= "<CategoryMappingAllowed>true</CategoryMappingAllowed>";
$xmlRequest .= "<Country>US</Country>";
$xmlRequest .= "<Currency>USD</Currency>";
$xmlRequest .= "<DispatchTimeMax>3</DispatchTimeMax>";
$xmlRequest .= "<ListingDuration>Days_7</ListingDuration>";
$xmlRequest .= "<ListingType>Chinese</ListingType>";
$xmlRequest .= "<PaymentMethods>PayPal</PaymentMethods>";
$xmlRequest .= "<PayPalEmailAddress>yourpaypal@emailaddress.com</PayPalEmailAddress>";
$xmlRequest .= "<PictureDetails>";
$xmlRequest .= "<PictureURL>" . $addPicture . "</PictureURL>";
$xmlRequest .= "</PictureDetails>";
$xmlRequest .= "<PostalCode>05485</PostalCode>";
$xmlRequest .= "<Quantity>1</Quantity>";
$xmlRequest .= "<ReturnPolicy>";
$xmlRequest .= "<ReturnsAcceptedOption>ReturnsAccepted</ReturnsAcceptedOption>";
$xmlRequest .= "<RefundOption>MoneyBack</RefundOption>";
$xmlRequest .= "<ReturnsWithinOption>Days_30</ReturnsWithinOption>";
$xmlRequest .= "<Description>" . $addDesc . "</Description>";
$xmlRequest .= "<ShippingCostPaidByOption>Buyer</ShippingCostPaidByOption>";
$xmlRequest .= "</ReturnPolicy>";
$xmlRequest .= "<ShippingDetails>";
$xmlRequest .= "<ShippingType>Flat</ShippingType>";
$xmlRequest .= "<ShippingServiceOptions>";
$xmlRequest .= "<ShippingServicePriority>1</ShippingServicePriority>";
$xmlRequest .= "<ShippingService>USPSMedia</ShippingService>";
$xmlRequest .= "<ShippingServiceCost>2.50</ShippingServiceCost>";
$xmlRequest .= "</ShippingServiceOptions>";
$xmlRequest .= "</ShippingDetails>";
$xmlRequest .= "<Site>US</Site>";
$xmlRequest .= "<UUID>" . $uuid . "</UUID>";
$xmlRequest .= "</Item>";
$xmlRequest .= "<RequesterCredentials>";
$xmlRequest .= "<eBayAuthToken>" . AUTH_TOKEN . "</eBayAuthToken>";
$xmlRequest .= "</RequesterCredentials>";
$xmlRequest .= "<WarningLevel>High</WarningLevel>";
$xmlRequest .= "</AddItemRequest>";

I'm thinking it would be something like this, but this didn't work.

<GlobalShippingEnabled>1</GlobalShippingEnabled>
Cray
  • 2,774
  • 7
  • 22
  • 32
Jay Jee
  • 317
  • 1
  • 3
  • 7
  • 1
    Circumventing the rules by stuffing your post with a bunch of profane railing against the site you're trying to post to? Great idea. – user229044 Aug 08 '14 at 01:43

1 Answers1

1

The field is GlobalShipping and needs to appear within the ShippingDetails element.

$xmlRequest .= "<ShippingDetails>";
$xmlRequest .= "<GlobalShipping>1</GlobalShipping>";
    .
    . Rest of your shipping details.
    .
$xmlRequest .= "</ShippingDetails>";