gpt4 book ai didi

java.net.UnknownHostException : fba-outbound. amazonaws.com

转载 作者:太空宇宙 更新时间:2023-11-04 12:59:06 25 4
gpt4 key购买 nike

尝试使用 Amazon FWS 出站 api 时,无法从中创建订单。出现未知异常。我发现 fws 端点主机不工作。有人可以帮助我使用 fws api 创建订单吗?

    com.amazonaws.fws.outbound.AmazonFWSOutboundException: Internal Error
at com.amazonaws.fws.outbound.AmazonFWSOutboundClient.invoke(AmazonFWSOutboundClient.java:481)
at com.amazonaws.fws.outbound.AmazonFWSOutboundClient.createFulfillmentOrder(AmazonFWSOutboundClient.java:193)
at com.amazonaws.fws.outbound.samples.CreateFulfillmentOrderSample.invokeCreateFulfillmentOrder(CreateFulfillmentOrderSample.java:164)
at com.amazonaws.fws.outbound.samples.CreateFulfillmentOrderSample.main(CreateFulfillmentOrderSample.java:143)
Caused by: java.net.UnknownHostException: fba-outbound.amazonaws.com
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:618)
at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:451)
at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:140)
at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:81)
at org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$1.doit(ControllerThreadSocketFactory.java:90)
at org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$SocketTask.run(ControllerThreadSocketFactory.java:157)
at java.lang.Thread.run(Thread.java:745)

我的代码是::

    /**
* Just add few required parameters, and try the service
* Create Fulfillment Order functionality
*
* @param args unused
*/
public static void main(String... args) {

/************************************************************************
* Access Key ID and Secret Acess Key ID, obtained from:
* http://aws.amazon.com
***********************************************************************/
String accessKeyId = SystemParams.AWS_ACCESS_KEY_ID;
String secretAccessKey = SystemParams.AWS_SECRET_KEY;

/************************************************************************
* Instantiate Http Client Implementation of Amazon FWS Outbound
***********************************************************************/
AmazonFWSOutbound service = new AmazonFWSOutboundClient(accessKeyId, secretAccessKey);

/************************************************************************
* Uncomment to try advanced configuration options. Available options are:
*
* - Signature Version
* - Proxy Host and Proxy Port
* - Service URL
* - User Agent String to be sent to Amazon FWS Outbound service
*
***********************************************************************/
// AmazonFWSOutboundConfig config = new AmazonFWSOutboundConfig();
// config.setSignatureVersion("0");
// AmazonFWSOutbound service = new AmazonFWSOutboundClient(accessKeyId, secretAccessKey, config);

/************************************************************************
* Uncomment to try out Mock Service that simulates Amazon FWS Outbound
* responses without calling Amazon FWS Outbound service.
*
* Responses are loaded from local XML files. You can tweak XML files to
* experiment with various outputs during development
*
* XML files available under com/amazonaws/fws/outbound/mock tree
*
***********************************************************************/
// AmazonFWSOutbound service = new AmazonFWSOutboundMock();

/************************************************************************
* Setup request parameters and uncomment invoke to try out
* sample for Create Fulfillment Order
***********************************************************************/
CreateFulfillmentOrder request = new CreateFulfillmentOrder();

String myOrderID = "TEST-00000002-1";

request.setMerchantFulfillmentOrderId(myOrderID);
request.setDisplayableOrderId(myOrderID);
request.setDisplayableOrderDateTime("20016-08-02T00:00:00Z");
request.setDisplayableOrderComment("Thank you for your order!");
request.setShippingSpeedCategory("Standard");

List<String> notificationEmails = new ArrayList<String>();
notificationEmails.add("email@domain.com"); //Email Address
request.setNotificationEmailList(notificationEmails);

Address address = new Address();
address.setName("Joe Smith");
address.setLine1("605 5th Ave. S");
address.setLine2("C/O Amazon.com");
address.setCity("Seattle");
address.setStateOrProvinceCode("WA");
address.setPostalCode("98104");
address.setCountryCode("US");
address.setPhoneNumber("206-266-1000");
request.setDestinationAddress(address);

List<CreateFulfillmentOrderItem> items = new ArrayList<CreateFulfillmentOrderItem>(1);

CreateFulfillmentOrderItem item1 = new CreateFulfillmentOrderItem();

item1.setMerchantSKU("B00THKEKEQ");

item1.setMerchantFulfillmentOrderItemId(myOrderID + "-1");
item1.setQuantity(2);
items.add(item1);

request.setItem(items);

/*try {
CreateFulfillmentOrderResponse response = service.createFulfillmentOrder(request);
System.out.println("Order : " + myOrderID + " successfully created by " +
"FWSOutboundService. You can check status of your " +
"order on the 'Manage Your Orders' page at " +
"http://sellercentral.amazon.com");
} catch (AmazonFWSOutboundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/



// @TODO: set request parameters here

invokeCreateFulfillmentOrder(service, request);

}



/**
* Create Fulfillment Order request sample
* Request for Amazon to send items from the merchant's inventory to a
* destination address.
*
* @param service instance of AmazonFWSOutbound service
* @param request Action to invoke
*/
public static void invokeCreateFulfillmentOrder(AmazonFWSOutbound service, CreateFulfillmentOrder request) {
try {

System.out.println ("CreateFulfillmentOrder Action Response");
System.out.println ("=============================================================================");
System.out.println ();

CreateFulfillmentOrderResponse response = service.createFulfillmentOrder(request);

System.out.println(" CreateFulfillmentOrderResponse");
System.out.println();
if (response.isSetResponseMetadata()) {
System.out.println(" ResponseMetadata");
System.out.println();
ResponseMetadata responseMetadata = response.getResponseMetadata();
if (responseMetadata.isSetRequestId()) {
System.out.println(" RequestId");
System.out.println();
System.out.println(" " + responseMetadata.getRequestId());
System.out.println();
}
}
System.out.println();


} catch (AmazonFWSOutboundException ex) {

System.out.println("Caught Exception: " + ex.getMessage());
System.out.println("Response Status Code: " + ex.getStatusCode());
System.out.println("Error Code: " + ex.getErrorCode());
System.out.println("Error Type: " + ex.getErrorType());
System.out.println("Request ID: " + ex.getRequestId());
System.out.print("XML: " + ex.getXML());
ex.printStackTrace();
}
}

}

最佳答案

-域的未知主机异常。这意味着您的服务器没有域。

设置DNS服务器ip或者插入(ip域信息)/etc/hosts - 如果不起作用,服务器正在寻找DNS,您可以更改查找本地“主机文件”的顺序

关于java.net.UnknownHostException : fba-outbound. amazonaws.com,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35079630/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com