1

There is how I Build an xml file and Build an requestModel to submitfeed. I have a problem where send mws submitfeed api.the contentType is POST_FBA_INBOUND_CARTON_CONTENTS .

The error message is

the Content-MD5 HTTP header you passed for your feed did not match the Content-MD5 we calculated for your feed.

My md5contenttype is equal the md5 in Amazon MWS Scratchpad .

    XmlDocument xmldoc = new XmlDocument();
            string xmlString = "";
            xmlString += "<?xml version='1.0' encoding='utf-8'?>";
            xmlString += "<AmazonEnvelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='amzn-envelope.xsd'>";
            xmlString += "<Header>";
            xmlString += "<DocumentVersion>1.01</DocumentVersion>";
            xmlString += $"<MerchantIdentifier>{sellerID}</MerchantIdentifier>";
            xmlString += "</Header>";
            xmlString += "<MessageType>CartonContentsRequest</MessageType>";
            xmlString += "<Message>";
            xmlString += "<MessageID>1</MessageID>";
            xmlString += "<CartonContentsRequest>";
            xmlString += $"<ShipmentId>{shipmentID}</ShipmentId>";
            xmlString += $"<NumCartons>{amzCartons.Count}</NumCartons>";
            amzCartons.ForEach(x =>
            {
                xmlString += "<Carton>";
                xmlString += $"<CartonId>{x.CartonId}</CartonId>";
                x.CartonDetails.ForEach(y =>
                {
                    xmlString += "<Item>";
                    xmlString += $"<SKU>{y.SKU}</SKU>";
                    xmlString += $"<QuantityShipped>{y.QuantityShipped}</QuantityShipped>";
                    xmlString += $"<QuantityInCase>{y.QuantityInCase}</QuantityInCase>";
                    xmlString += $"<ExpirationDate>{y.ExpirationDate}</ExpirationDate>";
                    xmlString += "</Item>";
                });
                xmlString += "</Carton>";
            });
            xmlString += "</CartonContentsRequest>";
            xmlString += "</Message>";
            xmlString += "</AmazonEnvelope>";
            xmlStr = xmlString;
            xmldoc.LoadXml(xmlString);
            return xmldoc;

    var storeinfo = ReportGear._().GetSideCode(storeName);
                IStore store = (IStore)storeinfo[1];
                string marketplaceId = storeinfo[0].ToString();
                var xmlStr = "";
                var md5hash_base64 = "";
                var xmlDoc = GetXMlByPOSTFBAINBOUNDCARTONCONTENTSFEED(store.SellerId, shipmentID, amzCartons,ref xmlStr);
                MemoryStream ms = new MemoryStream();
                xmlDoc.Save(ms);
    
                ms.Seek(0, SeekOrigin.Begin);
                using (var md5 = MD5.Create())
                {
                    var md5hash = md5.ComputeHash(Encoding.UTF8.GetBytes(xmlStr));
                    md5hash_base64 = Convert.ToBase64String(md5hash);
                }
               
                var request = new SubmitFeedRequest
                {
                    FeedType = "_POST_FBA_INBOUND_CARTON_CONTENTS_",
                    MarketplaceIdList = new IdList { Id = new List<string> { marketplaceId } },
                    FeedContent = ms,
                    Merchant = store.SellerId,
                    ContentMD5 = md5hash_base64,
                 //   ContentType = new ContentType(MediaType.XMLStream)
                };
                
                var response = FeedsClient._(store).SubmitFeed(request);

enter image description here

Prateek Gupta
  • 2,422
  • 2
  • 16
  • 30
chen ye
  • 11
  • 1
  • Does this answer your question? [Amazon MWS SubmitFeed Content-MD5 HTTP header did not match the Content-MD5 calculated by Amazon](https://stackoverflow.com/questions/40180070/amazon-mws-submitfeed-content-md5-http-header-did-not-match-the-content-md5-calc) – ivion Jun 20 '20 at 13:02

0 Answers0