php - 如何为 Ingram 微集成创建正确的订单测试?

标签 php xml curl request

我正在尝试为 ingram micro 创建一个订单测试,但我没有取得结果。

这是要发送的 xml 请求:

<OrderRequest>
   <Version>2.0</Version>
   <TransactionHeader>
      <SenderID>123456789</SenderID>
      <ReceiverID>987654321</ReceiverID>
      <CountryCode>MD</CountryCode>
      <LoginID>ingram_login</LoginID>
      <Password>ingram_password</Password>
      <TransactionID>54321</TransactionID>
   </TransactionHeader>
   <OrderHeaderInformation>
      <BillToSuffix />
      <AddressingInformation>
         <CustomerPO>TEST PO ONLY - DO NOT SHIP</CustomerPO>
         <ShipToAttention>Mrs Jones</ShipToAttention>
         <EndUserPO>EndUserPO_1</EndUserPO>
         <ShipTo>
            <Address>
               <ShipToAddress1>Red House Company</ShipToAddress1>
               <ShipToAddress2>1730 105TH ST</ShipToAddress2>
               <ShipToAddress3/>
               <ShipToCity>NEW RICHMOND</ShipToCity>
               <ShipToProvince>WI</ShipToProvince>
               <ShipToPostalCode>54017</ShipToPostalCode>
            </Address>
         </ShipTo>
      </AddressingInformation>
      <ProcessingOptions>
         <CarrierCode>F2</CarrierCode>
         <AutoRelease>H</AutoRelease>
         <ThirdPartyFreightAccount/>
         <KillOrderAfterLineError>N</KillOrderAfterLineError>
         <ShipmentOptions>
            <BackOrderFlag>Y</BackOrderFlag>
            <SplitShipmentFlag>N</SplitShipmentFlag>
            <SplitLine>N</SplitLine>
              <ShipFromBranches>10</ShipFromBranches>
            <DeliveryDate>20090901</DeliveryDate>
         </ShipmentOptions>
      </ProcessingOptions>
      <DynamicMessage>
         <MessageLines>Deliver to Mrs Jones</MessageLines>
      </DynamicMessage>
   </OrderHeaderInformation>
   <OrderLineInformation>
      <ProductLine>
         <SKU>TSXML3</SKU>
         <Quantity>1</Quantity>
         <CustomerLineNumber/>
         <ReservedInventory>
            <ReserveCode>C</ReserveCode>
             <ReserveSequence>01</ReserveSequence>
         </ReservedInventory>
         <CustomerPartNumber/>
         <UPC/>
         <ManufacturerPartNumber/>
         <ShipFromBranchAtLine>10</ShipFromBranchAtLine>
      </ProductLine>
      <CommentLine>
         <CommentText>TEST PO ONLY - DO NOT SHIP</CommentText>
      </CommentLine>
   </OrderLineInformation>
   <ShowDetail>1</ShowDetail>
</OrderRequest>

英格拉姆微回复:

<OrderResponse>
    <Version>2.0</Version>
    <TransactionHeader>
        <SenderID>987654321</SenderID>
        <ReceiverID>123456789</ReceiverID>
        <ErrorStatus ErrorNumber="20196">
ERROR: One Productline can not have multiple parts in it when ShowDetail='2'
</ErrorStatus>
        <DocumentID>{5535EC2F-DB51-4D35-B492-6425A0B9F62D}</DocumentID>
        <TransactionID>54321</TransactionID>
        <TimeStamp>2016-01-27T11:45:19</TimeStamp>
    </TransactionHeader>
</OrderResponse>

我一直在尝试和研究响应 ErrorStatusProductline,但我还没有找到解决方案。 提前致谢

抱歉,没有ingram-micro标签

最佳答案

只看IM-XML documentation我发现,<ProductLine> 有几个明显的问题你的例子的元素部分:

<ManufacturerPartNumber> Manufacturer Part Number - Do not specify if <SKU> or <UPC> are included

<UPC> EAN/UPC Number - Do not specify if <ManufacturerPartNumber> or <SKU> are included

<SKU> Ingram Micro product code Number - Do not specify if <ManufacturerPartNumber> or <UPC> are included

显然您应该只指定上述元素的值之一,您的示例指定了 SKU 的值和 UPC

<ReservedInventory> Contains reserved Inventory information. - Unless required, do not specify.

我对文档的快速浏览并不清楚何时需要这样做,但是您为此元素指定了一个值,并且我在示例中的其他任何地方都看不到任何明确的指示来说明为什么会这样在您的示例案例中需要。因此,让我们将此称为“可能”问题。

<ShipFromBranchAtLine>

我在文档中找不到对此元素的任何引用,因此它可能无效。我能找到的与该元素最接近的匹配项是 <ShipFromBranches> , 这不属于 <ProductLine>元素。

<CustomerPartNumber>

同样,我在文档中找不到对此的任何引用。

<RequestedPrice> Special Bid Price Parent : <SpecialBid>

你有 <RequestedPrice>作为 ProductLine 的直系子代, 当它应该在 <SpecialBid> 的内部时元素。

因此,考虑到以上所有因素,我注释掉了看起来错误的部分(或者可能是错误的,对于我们来说),如下所示:

    <ProductLine>
        <SKU>NV9159</SKU>
        <Quantity>1</Quantity>
        <CustomerLineNumber/>
        <!-- ResvervedInventory : Unless required, do not specify
        <ReservedInventory>
            <ReserveCode>C</ReserveCode>
            <ReserveSequence>01</ReserveSequence>
        </ReservedInventory>
        -->
        <!-- CustomerPartNumber element not defined in spec.
        <CustomerPartNumber/>
        -->
        <!-- UPC : Do not specify if SKU included
        <UPC>SP-RACKTRAY</UPC>
         -->
        <!-- ManufacturerPartNumber : Do not specify if SKU included
        <ManufacturerPartNumber/>
         -->
        <!-- ShipFromBranchAtLine element not defined in spec.
        <ShipFromBranchAtLine>10</ShipFromBranchAtLine>
        -->
        <!-- RequestedPrice : parent = SpecialBid
        <RequestedPrice>163.36</RequestedPrice>
        -->
    </ProductLine>

如果我们只是将这些部分拉出来(假设它们都不应该在那里)并将它们设置为空元素,它可能看起来像:

    <ProductLine>
        <SKU>NV9159</SKU>
        <Quantity>1</Quantity>
        <CustomerLineNumber/>
    </ProductLine>

最后,直接引用您返回的错误:

One Productline can not have multiple parts in it when ShowDetail='2'

我假设这直接是由于您为 <SKU> 设置了一个值和 <UPC> ,这可能会使系统误以为您在(非法)指定这两个元素的值时试图包括“多个部件”(例如,两个不同的部件代码可能用于两个不同的实际部件)。

但即使情况并非如此,鉴于该错误的实际措辞,这似乎是最容易尝试做的事情,可能是尝试简单地更改 ShowDetail元素值来自:

<ShowDetail>2</ShowDetail>

<ShowDetail>1</ShowDetail>

我鼓励用 ProductLine 解决其他问题元素,但单独出现响应错误,您是否尝试更改 ShowDetail看看这是否有所作为?

关于php - 如何为 Ingram 微集成创建正确的订单测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35066941/

相关文章:

xml - Cocoa:加载 XML 文件(数组);

java - JAXB 解析 Null

xml - 谷歌电子表格 : ImportXML from Google Drive . txt

linux - Linux上的curl命令打破json文本并获取反斜杠

ruby - 如果它支持 Cloudflare 的反 DDos 保护,我如何使用 ruby​​ 获取 API

php - 错误的请求。通过主机和系统上的 curl 连接到站点

php - 空合并运算符是否调用一个函数两次?

php - 我不明白 PHP sleep() 行为

php - 使用 ID 进行 INSERT 查询

php - 尝试打开表时出现未知列错误