user3513929
user3513929

Reputation: 1

Invalid XML format

I'm having some issues with XML formatting. At the moment I am generating this XML in php from an order. However when I go to submit it, the API tells me that I have Invalid or Improperly Formatted XML.

<?xml version="1.0" encoding="iso-8859-1"?>
<orders>
  <username>xxxxxxxxx</username>
  <password>xxxxxxx</password>
  <sandbox>1</sandbox>
  <order>
    <REFNUM>xxxxx</REFNUM>
    <SHIPSETTINGS>
      <ITEM>
        <VENDOR>ELD</VENDOR>
        <VSHIPNATIVE>M02</VSHIPNATIVE>
      </ITEM>
    </SHIPSETTINGS>
    <ORDER_DATE>xx/xx/xxxx</ORDER_DATE>
    <PRODUCTS>
      <item>
        <pnum>xxxxxxxxx</pnum>
        <qty>x</qty>
      </item>
    </PRODUCTS>
    <LASTNAME>xxxx</LASTNAME>
    <FIRSTNAME>xxxxx</FIRSTNAME>
    <ADDRESS1>xxxxxx</ADDRESS1>
    <ADDRESS2></ADDRESS2>
    <CITY>xxxxxx</CITY>
    <STATE>xxxxx</STATE>
    <ZIPCODE>xxxxx</ZIPCODE>
    <COUNTRY>xx</COUNTRY>
    <PHONE1>xxxxxxxxx</PHONE1>
    <EMAIL2>xxxxxxx</EMAIL2>
  </order>
</orders>

This is the XML format that they say it needs to be in. I'm not sure what I'm doing wrong. Thanks for your help. Sorry I forgot to mention that if there is a * in their XML, it means that it is a required field.

<?xml version="1.0" encoding="iso-8859-1"?>

<orders>
   <username>*username</username>
   <password>*password</password>
   <sandbox>1</sandbox><-----------Add this parameter to test orders. Api will respond, but no order will be initiated!
   <order>
     <REFNUM>*dropshippers reference number</REFNUM>
     <SHIPSETTINGS>
        <ITEM>
          <VENDOR>MC</VENDOR>
          <VSHIPNATIVE>M02</VSHIPNATIVE>
        </ITEM>
      <ITEM>
          <VENDOR>ELD</VENDOR>
          <VSHIPNATIVE>UGR</VSHIPNATIVE>
        </ITEM>
          </SHIPSETTINGS>
          <ORDER_DATE>*5/16/08</ORDER_DATE>   
          <PRODUCTS>*
            <item>*
                <pnum>*ABC123</pnum>
                <qty>*1</qty>
            </item*>
            <item>
                <pnum>123ABC</pnum>
                <qty>3</qty>
            </item>
    </PRODUCTS>* 
    <LASTNAME>*Van Riper</LASTNAME> - Customer's shipping info.
    <FIRSTNAME>*Erik</FIRSTNAME> - Customer's shipping info.
    <COMPANY></COMPANY> - Customer's shipping info.  
    <ADDRESS1>*4720 Center Ave</ADDRESS1> - Customer's shipping info.
    <ADDRESS2>#515</ADDRESS2> - Customer's shipping info.  
    <CITY>*Wonder City</CITY> - Customer's shipping info.  
    <STATE>*NY</STATE> - Customer's shipping info.
    <ZIPCODE>*11109</ZIPCODE> - Customer's shipping info.
    <COUNTRY>*US</COUNTRY> - Customers 2 letter shipping country.
    <PHONE1>*(123) 555-1212</PHONE1> - Customer's Shipping phone # 1.
    <PHONE2>(555) 555-1212</PHONE2> - Customer's Shipping phone # 2.
    <EMAIL1>[email protected]</EMAIL1> - Customer's billing email.
    <EMAIL2>*[email protected]</EMAIL2> - Customer's shipping email. 
    </order>
</orders>

Upvotes: 0

Views: 189

Answers (2)

Michael Kay
Michael Kay

Reputation: 163262

The XML you posted is well-formed, so that's not the problem. They may require conformance to a particular DTD or schema, but we can't help on that unless you show it to us. The specimen XML that illustrates the format is in a proprietary and probably informal notation, so we have no tools to check compliance with that.

Essentially, there is no information in your post that enables us to help you.

Upvotes: 0

Andreas
Andreas

Reputation: 1250

Check </item*>, this should be </item>

Upvotes: 1

Related Questions