Closed amao1310 closed 1 year ago
It has been resolved, the exception of Illegal key size; this link can solve this exception: https://blog.csdn.net/dafeige8/article/details/76019911
Also this should be closed because all of this pointless crypto complexity was removed in the newer /feeds/2021-06-30/
endpoint.
This is a very old issue that is probably not getting as much attention as it deserves. We encourage you to check if this is still an issue after the latest release and if you find that this is still a problem, please feel free to open a new issue and make a reference to this one.
closed for inactivity
Calling the "createFeed" interface returns "Bad Request", and a message of "The encrypted feed document contents were not uploaded to S3." is found in debug.Below is my code `@Test public void createFeedDocumentTest() throws Exception { File fileinput = new File("D:\data\amazon\2021-07-27\productInfo_1627354726237.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(fileinput); DOMSource domSource = new DOMSource(doc); StringWriter writer = new StringWriter(); StreamResult result1 = new StreamResult(writer); TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(); transformer.transform(domSource, result1); String asXML = writer.toString(); System.out.println(asXML); CreateFeedDocumentSpecification body = new CreateFeedDocumentSpecification(); body.setContentType("text/xml; charset=UTF-8"); AmazonAuthorConfigDTO dto = new AmazonAuthorConfigDTO(); dto.setAccessKeyId(AmazonUtils.USER_ACCESS_KEY_ID); dto.setSecretKey(AmazonUtils.USER_SECRET_ACCESS_KEY); dto.setRoleArn(AmazonUtils.ROLE_ARN); dto.setRoleSessionName(AmazonUtils.ROLE_SESSION_NAME); dto.setClientId(AmazonUtils.APP_CLIENT_ID); dto.setClientSecret(AmazonUtils.APP_CLIENT_SECRET); dto.setRefreshToken(REFRESH_TOKEN); dto.setRegion("us-east-1"); dto.setSpEndPoint("https://sellingpartnerapi-na.amazon.com"); dto.setLwaEndpoint("https://api.amazon.com/auth/o2/token"); FeedsApi feedsApi = AmazonUtils.amazonAuthorizationGrantFeed(dto); CreateFeedDocumentResponse response = feedsApi.createFeedDocument(body); CreateFeedDocumentResult result = response.getPayload(); String feedDocumentId = result.getFeedDocumentId(); String url = result.getUrl(); String key = result.getEncryptionDetails().getKey(); String initializationVector = result.getEncryptionDetails().getInitializationVector(); UploadExample.encryptAndUploadFromString(key,initializationVector,url,asXML); System.out.println(feedDocumentId);