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

时间:2016-01-28 16:35:09

标签: 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代码

2 个答案:

答案 0 :(得分:2)

只要查看我能找到的IM-XML documentation,您的示例的<ProductLine>元素部分就会出现几个明显的问题:

  

<ManufacturerPartNumber>制造商部件号    - 请勿指定是否包含<SKU><UPC>

     

<UPC> EAN / UPC号码    - 请勿指定是否包含<ManufacturerPartNumber><SKU>

     

<SKU> Ingram Micro产品代码编号    - 请勿指定是否包含<ManufacturerPartNumber><UPC>

显然,您应该只指定上述元素的值之一,您的示例指定SKUUPC的值

  

<ReservedInventory>包含保留的广告资源信息。    - 除非必要,否则请勿指定。

当我需要快速浏览文档时,我不清楚这一点,但是您为此元素指定了一个值,并且我没有在示例中的任何其他位置看到任何明确的指示,表明它为什么会这样您的示例案例中需要。所以我们称之为“可能”问题。

  

<ShipFromBranchAtLine>

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

  

<CustomerPartNumber>

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

  

<RequestedPrice>特价   家长:<SpecialBid>

<RequestedPrice>作为ProductLine的直接子女,当它应位于<SpecialBid>元素内时。{/ p>

因此,考虑到以上所有因素,我评论出似乎错误的部分(或者可能是错误的部分),如此:

    <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>

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

  

当ShowDetail ='2'

时,一个Productline中不能包含多个部分

我认为这直接归因于您为<SKU><UPC>设置了一个值,这可能会让系统误以为您试图包含“多个部分”(例如两个)在指定(非法)这两个元素的值时,可能适用于两个不同实际部分的不同部分代码。

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

<ShowDetail>2</ShowDetail>

<ShowDetail>1</ShowDetail>

我会鼓励使用ProductLine元素修复其他问题,但是单独使用响应错误,您是否尝试更改ShowDetail以查看是否会产生影响?

答案 1 :(得分:1)

我正在尝试发送设置product line的数据,如下所示:

<ProductLine>
 <SKU>TSXML3</SKU>
 <Quantity>1</Quantity>
 <CustomerLineNumber/>
 <ReservedInventory>
    <ReserveCode>C</ReserveCode>
     <ReserveSequence>01</ReserveSequence>
 </ReservedInventory>
</ProductLine>

我收到了这个回复:

<?xml version="1.0" encoding="ISO-8859-1"?>
<OrderResponse>
    <Version>2.0</Version>
    <TransactionHeader>
        <SenderID>987654321</SenderID>
        <ReceiverID>123456789</ReceiverID>
        <ErrorStatus ErrorNumber="21340">Order Rejected</ErrorStatus>
        <DocumentID>{584B79A8-E320-4183-A1BB-3DEE24CA673A}</DocumentID>
        <TransactionID>54321</TransactionID>
        <TimeStamp>2016-02-08T05:49:12</TimeStamp>
    </TransactionHeader>
    <OrderInfo>
        <OrderNumbers>
            <BranchOrderNumber></BranchOrderNumber>
            <CustomerPO>TEST PO ONLY - DO NOT SHIP</CustomerPO>
            <ShipToAttention>Mrs Jones</ShipToAttention>
            <ThirdPartyFreightAccount></ThirdPartyFreightAccount>
            <ShipToAddress1></ShipToAddress1>
            <ShipToAddress2></ShipToAddress2>
            <ShipToCity></ShipToCity>
            <ShipToProvince></ShipToProvince>
            <ShipToPostalCode></ShipToPostalCode>
            <AddressErrorMessage AddressErrorType="  "></AddressErrorMessage>
            <ContractNumber></ContractNumber>
            <OrderSuffix Suffix="">
                <LineInformation>
                    <ProductLine>
                        <LineError></LineError>
                        <SKU>TSXML3</SKU>
                        <UnitPrice>0.00</UnitPrice>
                        <IngramLineNumber></IngramLineNumber>
                        <CustomerLineNumber>000</CustomerLineNumber>
                        <ShipFromBranch>10</ShipFromBranch>
                        <OrderQuantity>1</OrderQuantity>
                        <AllocatedQuantity>0</AllocatedQuantity>
                        <BackOrderedQuantity>0</BackOrderedQuantity>
                        <BackOrderETADate></BackOrderETADate>
                        <PriceDerivedFlag></PriceDerivedFlag>
                        <ForeignCurrency></ForeignCurrency>
                        <FreightRate>0.00</FreightRate>
                        <TransitDays>0</TransitDays>
                        <LineBillToSuffix>000</LineBillToSuffix>
                    </ProductLine>
                    <CommentLine>
                        <CommentText>TEST PO ONLY - DO NOT SHIP</CommentText>
                        <CommentLineNumber></CommentLineNumber>
                    </CommentLine>
                </LineInformation>
            </OrderSuffix>
        </OrderNumbers>
    </OrderInfo>
</OrderResponse>

我希望这对你有所帮助。