Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 500将订单过帐到Prestashop API时出现内部服务器错误_Xml_Api_Prestashop 1.7 - Fatal编程技术网

Xml 500将订单过帐到Prestashop API时出现内部服务器错误

Xml 500将订单过帐到Prestashop API时出现内部服务器错误,xml,api,prestashop-1.7,Xml,Api,Prestashop 1.7,我在尝试向Prestashop1.7API发送XML时遇到了这个一般性问题。我的程序是ASP.NET核心C#,我有我的序列化程序类 我在这里停留了一段时间,我的XML看起来很好,API没有返回任何有意义的错误消息 这是我的XML: <?xml version="1.0"?> <prestashop xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="h

我在尝试向Prestashop1.7API发送XML时遇到了这个一般性问题。我的程序是ASP.NET核心C#,我有我的序列化程序类

我在这里停留了一段时间,我的XML看起来很好,API没有返回任何有意义的错误消息

这是我的XML:

<?xml version="1.0"?>
<prestashop xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <order>
    <id_address_delivery>78</id_address_delivery>
    <id_address_invoice>78</id_address_invoice>
    <id_cart>356</id_cart>
    <id_lang>1</id_lang>
    <id_currency>1</id_currency>
    <id_customer>76</id_customer>
    <id_carrier>1</id_carrier>
    <current_state>15</current_state>
    <module>free_order</module>
    <invoice_number>0</invoice_number>
    <invoice_date>0000-00-00 00:00:00</invoice_date>
    <delivery_number>0</delivery_number>
    <delivery_date>0000-00-00 00:00:00</delivery_date>
    <valid>0</valid>
    <date_add>2020-10-07 09:06:22</date_add>
    <date_upd>2020-10-07 09:06:22</date_upd>
    <shipping_number />
    <id_shop_group>1</id_shop_group>
    <id_shop>1</id_shop>
    <secure_key />
    <payment>Free order</payment>
    <recyclable>0</recyclable>
    <gift>0</gift>
    <gift_message />
    <mobile_theme>0</mobile_theme>
    <total_discounts>0</total_discounts>
    <total_discounts_tax_incl>0</total_discounts_tax_incl>
    <total_discounts_tax_excl>0</total_discounts_tax_excl>
    <total_paid>0</total_paid>
    <total_paid_tax_incl>0</total_paid_tax_incl>
    <total_paid_tax_excl>0</total_paid_tax_excl>
    <total_paid_real>0</total_paid_real>
    <total_products>0</total_products>
    <total_products_wt>0</total_products_wt>
    <total_shipping>0</total_shipping>
    <total_shipping_tax_incl>0</total_shipping_tax_incl>
    <total_shipping_tax_excl>0</total_shipping_tax_excl>
    <carrier_tax_rate>0</carrier_tax_rate>
    <total_wrapping>0</total_wrapping>
    <total_wrapping_tax_incl>0</total_wrapping_tax_incl>
    <total_wrapping_tax_excl>0</total_wrapping_tax_excl>
    <round_mode>0</round_mode>
    <round_type>0</round_type>
    <conversion_rate>1</conversion_rate>
    <reference />
    <associations>
      <order_rows>
        <order_row>
          <product_id>4</product_id>
          <product_attribute_id>0</product_attribute_id>
          <product_quantity>2</product_quantity>
          <product_name>VITROCOOL 1003 refrigerante en contenedor de 1000 kg (cantidad en Kg)</product_name>
          <product_reference>30070003</product_reference>
          <product_ean13>30070003</product_ean13>
          <product_isbn />
          <product_upc />
          <product_price>0</product_price>
          <unit_price_tax_incl>0</unit_price_tax_incl>
          <unit_price_tax_excl>0</unit_price_tax_excl>
        </order_row>
        <order_row>
          <product_id>9</product_id>
          <product_attribute_id>0</product_attribute_id>
          <product_quantity>2</product_quantity>
          <product_name>VITROCRUST 1812 en garrafas de 10 kg</product_name>
          <product_reference>30070011</product_reference>
          <product_ean13>30070011</product_ean13>
          <product_isbn />
          <product_upc />
          <product_price>0</product_price>
          <unit_price_tax_incl>0</unit_price_tax_incl>
          <unit_price_tax_excl>0</unit_price_tax_excl>
        </order_row>
        <order_row>
          <product_id>3</product_id>
          <product_attribute_id>0</product_attribute_id>
          <product_quantity>9</product_quantity>
          <product_name>VITROCOOL 1003 refrigerante en bidones de 220 Kg (cantidad en Kg)</product_name>
          <product_reference>30070002</product_reference>
          <product_ean13>30070002</product_ean13>
          <product_isbn />
          <product_upc />
          <product_price>0</product_price>
          <unit_price_tax_incl>0</unit_price_tax_incl>
          <unit_price_tax_excl>0</unit_price_tax_excl>
        </order_row>
        <order_row>
          <product_id>9</product_id>
          <product_attribute_id>0</product_attribute_id>
          <product_quantity>2</product_quantity>
          <product_name>VITROCRUST 1812 en garrafas de 10 kg</product_name>
          <product_reference>30070011</product_reference>
          <product_ean13>30070011</product_ean13>
          <product_isbn />
          <product_upc />
          <product_price>0</product_price>
          <unit_price_tax_incl>0</unit_price_tax_incl>
          <unit_price_tax_excl>0</unit_price_tax_excl>
        </order_row>
        <order_row>
          <product_id>3</product_id>
          <product_attribute_id>0</product_attribute_id>
          <product_quantity>1003</product_quantity>
          <product_name>VITROCOOL 1003 refrigerante en bidones de 220 Kg (cantidad en Kg)</product_name>
          <product_reference>30070002</product_reference>
          <product_ean13>30070002</product_ean13>
          <product_isbn />
          <product_upc />
          <product_price>0</product_price>
          <unit_price_tax_incl>0</unit_price_tax_incl>
          <unit_price_tax_excl>0</unit_price_tax_excl>
        </order_row>
      </order_rows>
    </associations>
  </order>
</prestashop>

78
78
356
1.
1.
76
1.
15
免费订购
0
0000-00-00 00:00:00
0
0000-00-00 00:00:00
0
2020-10-07 09:06:22
2020-10-07 09:06:22
1.
1.
自由秩序
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1.
4.
0
2.
VITROCOOL 1003制冷剂含1000千克(cantidad含1000千克)
30070003
30070003
0
0
0
9
0
2.
Vitrocrost 1812 en garrafas de 10 kg
30070011
30070011
0
0
0
3.
0
9
VITROCOOL 1003制冷剂(比多涅单位:220千克)(康蒂达单位:千克)
30070002
30070002
0
0
0
9
0
2.
Vitrocrost 1812 en garrafas de 10 kg
30070011
30070011
0
0
0
3.
0
1003
VITROCOOL 1003制冷剂(比多涅单位:220千克)(康蒂达单位:千克)
30070002
30070002
0
0
0
这就是Prestashop API所期望的(空白XML):


据我所知,唯一必须填写的字段是标有
required
的字段,但由于这给了我500个内部服务器错误,我尝试用我拥有的数据尽可能多地填写


我尝试了邮递员和通过我的汇编发送,但都没有成功。我不知道还能尝试什么,我一直在纠正问题,但同样的错误一再出现。

我过去也遇到过类似的问题,这是由于有效载荷/XML与返回车厢一起发送的缘故-似乎Prestashop不喜欢它。看看这个,如果这没有帮助,请确保添加从Web服务器错误日志中获得的完整错误,谢谢您的响应伙伴,但是我的xml中似乎没有任何返回框(或者至少我如何发现它们)。如何发现隐藏的回车符?不确定如何在C#中处理它,但在我的PHP项目中,我只是替换了源XML中的所有“\n”和“\r”字符,然后将其发送到Prestashop服务器。谢谢,我将调试字符串,看看它们是否有任何回车符,tomorow将看到结果并在这里发布。
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <order>
        <id_address_delivery required="true" format="isUnsignedId"/>
        <id_address_invoice required="true" format="isUnsignedId"/>
        <id_cart required="true" format="isUnsignedId"/>
        <id_currency required="true" format="isUnsignedId"/>
        <id_lang required="true" format="isUnsignedId"/>
        <id_customer required="true" format="isUnsignedId"/>
        <id_carrier required="true" format="isUnsignedId"/>
        <current_state format="isUnsignedId"/>
        <module required="true" format="isModuleName"/>
        <invoice_number/>
        <invoice_date/>
        <delivery_number/>
        <delivery_date/>
        <valid/>
        <date_add format="isDate"/>
        <date_upd format="isDate"/>
        <shipping_number notFilterable="true" format="isTrackingNumber"/>
        <id_shop_group format="isUnsignedId"/>
        <id_shop format="isUnsignedId"/>
        <secure_key format="isMd5"/>
        <payment required="true" format="isGenericName"/>
        <recyclable format="isBool"/>
        <gift format="isBool"/>
        <gift_message format="isMessage"/>
        <mobile_theme format="isBool"/>
        <total_discounts format="isPrice"/>
        <total_discounts_tax_incl format="isPrice"/>
        <total_discounts_tax_excl format="isPrice"/>
        <total_paid required="true" format="isPrice"/>
        <total_paid_tax_incl format="isPrice"/>
        <total_paid_tax_excl format="isPrice"/>
        <total_paid_real required="true" format="isPrice"/>
        <total_products required="true" format="isPrice"/>
        <total_products_wt required="true" format="isPrice"/>
        <total_shipping format="isPrice"/>
        <total_shipping_tax_incl format="isPrice"/>
        <total_shipping_tax_excl format="isPrice"/>
        <carrier_tax_rate format="isFloat"/>
        <total_wrapping format="isPrice"/>
        <total_wrapping_tax_incl format="isPrice"/>
        <total_wrapping_tax_excl format="isPrice"/>
        <round_mode format="isUnsignedId"/>
        <round_type format="isUnsignedId"/>
        <conversion_rate required="true" format="isFloat"/>
        <reference/>
        <associations>
            <order_rows nodeType="order_row" virtualEntity="true">
                <order_row>
                    <id/>
                    <product_id required="true"/>
                    <product_attribute_id required="true"/>
                    <product_quantity required="true"/>
                    <product_name read_only="true" readOnly="true"/>
                    <product_reference read_only="true" readOnly="true"/>
                    <product_ean13 read_only="true" readOnly="true"/>
                    <product_isbn read_only="true" readOnly="true"/>
                    <product_upc read_only="true" readOnly="true"/>
                    <product_price read_only="true" readOnly="true"/>
                    <unit_price_tax_incl read_only="true" readOnly="true"/>
                    <unit_price_tax_excl read_only="true" readOnly="true"/>
                </order_row>
            </order_rows>
        </associations>
    </order>
</prestashop>