| 12459 |
kshitij.so |
1 |
/*******************************************************************************
|
|
|
2 |
* Copyright 2009 Amazon Services.
|
|
|
3 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
4 |
*
|
|
|
5 |
* You may not use this file except in compliance with the License.
|
|
|
6 |
* You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
|
|
|
7 |
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
|
8 |
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
|
9 |
* specific language governing permissions and limitations under the License.
|
|
|
10 |
* *****************************************************************************
|
|
|
11 |
*
|
|
|
12 |
* Marketplace Web Service Java Library
|
|
|
13 |
* API Version: 2009-01-01
|
|
|
14 |
* Generated: Wed Feb 18 13:28:48 PST 2009
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
package com.amazonaws.mws.samples;
|
|
|
21 |
|
|
|
22 |
import java.io.ByteArrayOutputStream;
|
|
|
23 |
import java.io.FileNotFoundException;
|
|
|
24 |
import java.io.FileOutputStream;
|
|
|
25 |
import java.io.OutputStream;
|
|
|
26 |
import java.util.List;
|
|
|
27 |
import java.util.ArrayList;
|
|
|
28 |
import com.amazonaws.mws.*;
|
|
|
29 |
import com.amazonaws.mws.model.*;
|
|
|
30 |
import com.amazonaws.mws.mock.MarketplaceWebServiceMock;
|
|
|
31 |
|
|
|
32 |
/**
|
|
|
33 |
*
|
|
|
34 |
* Get Feed Submission Result Samples
|
|
|
35 |
*
|
|
|
36 |
*
|
|
|
37 |
*/
|
|
|
38 |
public class GetFeedSubmissionResultSample {
|
|
|
39 |
|
|
|
40 |
/**
|
|
|
41 |
* Just add a few required parameters, and try the service
|
|
|
42 |
* Get Feed Submission Result functionality
|
|
|
43 |
*
|
|
|
44 |
* @param args unused
|
|
|
45 |
* @throws FileNotFoundException
|
|
|
46 |
*/
|
|
|
47 |
public static void main(String... args) throws FileNotFoundException {
|
|
|
48 |
|
|
|
49 |
/************************************************************************
|
|
|
50 |
* Access Key ID and Secret Access Key ID, obtained from:
|
|
|
51 |
* http://aws.amazon.com
|
|
|
52 |
***********************************************************************/
|
|
|
53 |
final String accessKeyId = "AKIAII3SGRXBJDPCHSGQ";
|
|
|
54 |
final String secretAccessKey = "B92xTbNBTYygbGs98w01nFQUhbec1pNCkCsKVfpg";
|
|
|
55 |
|
|
|
56 |
final String appName = "Test";
|
|
|
57 |
final String appVersion = "1.0";
|
|
|
58 |
|
|
|
59 |
MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();
|
|
|
60 |
|
|
|
61 |
/************************************************************************
|
|
|
62 |
* Uncomment to set the appropriate MWS endpoint.
|
|
|
63 |
************************************************************************/
|
|
|
64 |
// US
|
|
|
65 |
// config.setServiceURL("https://mws.amazonservices.com");
|
|
|
66 |
// UK
|
|
|
67 |
// config.setServiceURL("https://mws.amazonservices.co.uk");
|
|
|
68 |
// Germany
|
|
|
69 |
// config.setServiceURL("https://mws.amazonservices.de");
|
|
|
70 |
// France
|
|
|
71 |
// config.setServiceURL("https://mws.amazonservices.fr");
|
|
|
72 |
// Italy
|
|
|
73 |
// config.setServiceURL("https://mws.amazonservices.it");
|
|
|
74 |
// Japan
|
|
|
75 |
// config.setServiceURL("https://mws.amazonservices.jp");
|
|
|
76 |
// China
|
|
|
77 |
// config.setServiceURL("https://mws.amazonservices.com.cn");
|
|
|
78 |
// Canada
|
|
|
79 |
// config.setServiceURL("https://mws.amazonservices.ca");
|
|
|
80 |
// India
|
|
|
81 |
config.setServiceURL("https://mws.amazonservices.in");
|
|
|
82 |
|
|
|
83 |
/************************************************************************
|
|
|
84 |
* You can also try advanced configuration options. Available options are:
|
|
|
85 |
*
|
|
|
86 |
* - Signature Version
|
|
|
87 |
* - Proxy Host and Proxy Port
|
|
|
88 |
* - User Agent String to be sent to Marketplace Web Service
|
|
|
89 |
*
|
|
|
90 |
***********************************************************************/
|
|
|
91 |
|
|
|
92 |
/************************************************************************
|
|
|
93 |
* Instantiate Http Client Implementation of Marketplace Web Service
|
|
|
94 |
***********************************************************************/
|
|
|
95 |
|
|
|
96 |
MarketplaceWebService service = new MarketplaceWebServiceClient(
|
|
|
97 |
accessKeyId, secretAccessKey, appName, appVersion, config);
|
|
|
98 |
|
|
|
99 |
/************************************************************************
|
|
|
100 |
* Setup request parameters and uncomment invoke to try out
|
|
|
101 |
* sample for Get Feed Submission Result
|
|
|
102 |
***********************************************************************/
|
|
|
103 |
|
|
|
104 |
/************************************************************************
|
|
|
105 |
* Marketplace and Merchant IDs are required parameters for all
|
|
|
106 |
* Marketplace Web Service calls.
|
|
|
107 |
***********************************************************************/
|
|
|
108 |
final String merchantId = "AF6E3O0VE0X4D";
|
|
|
109 |
|
|
|
110 |
GetFeedSubmissionResultRequest request = new GetFeedSubmissionResultRequest();
|
|
|
111 |
request.setMerchant( merchantId );
|
|
|
112 |
//request.setFeedSubmissionId( "5090206194" );
|
|
|
113 |
//request.setFeedSubmissionId( "5090305962" );
|
|
|
114 |
//request.setFeedSubmissionId( "5090413384" );
|
|
|
115 |
request.setFeedSubmissionId("5598618360" );
|
|
|
116 |
// Note that depending on the size of the feed sent in, and the number of errors and warnings,
|
|
|
117 |
// the result can reach sizes greater than 1GB. For this reason we recommend that you _always_
|
|
|
118 |
// program to MWS in a streaming fashion. Otherwise, as your business grows you may silently reach
|
|
|
119 |
// the in-memory size limit and have to re-work your solution.
|
|
|
120 |
//
|
|
|
121 |
OutputStream processingResult = new FileOutputStream( "/home/vikram/feedSubmissionResult.xml" );
|
|
|
122 |
request.setFeedSubmissionResultOutputStream( processingResult );
|
|
|
123 |
|
|
|
124 |
invokeGetFeedSubmissionResult(service, request);
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
|
129 |
/**
|
|
|
130 |
* Get Feed Submission Result request sample
|
|
|
131 |
* retrieves the feed processing report
|
|
|
132 |
*
|
|
|
133 |
* @param service instance of MarketplaceWebService service
|
|
|
134 |
* @param request Action to invoke
|
|
|
135 |
*/
|
|
|
136 |
public static void invokeGetFeedSubmissionResult(MarketplaceWebService service, GetFeedSubmissionResultRequest request) {
|
|
|
137 |
try {
|
|
|
138 |
|
|
|
139 |
GetFeedSubmissionResultResponse response = service.getFeedSubmissionResult(request);
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
System.out.println ("GetFeedSubmissionResult Action Response");
|
|
|
143 |
System.out.println ("=============================================================================");
|
|
|
144 |
System.out.println ();
|
|
|
145 |
|
|
|
146 |
System.out.print(" GetFeedSubmissionResultResponse");
|
|
|
147 |
System.out.println();
|
|
|
148 |
System.out.print(" GetFeedSubmissionResultResult");
|
|
|
149 |
System.out.println();
|
|
|
150 |
System.out.print(" MD5Checksum");
|
|
|
151 |
System.out.println();
|
|
|
152 |
System.out.print(" " + response.getGetFeedSubmissionResultResult().getMD5Checksum());
|
|
|
153 |
System.out.println();
|
|
|
154 |
if (response.isSetResponseMetadata()) {
|
|
|
155 |
System.out.print(" ResponseMetadata");
|
|
|
156 |
System.out.println();
|
|
|
157 |
ResponseMetadata responseMetadata = response.getResponseMetadata();
|
|
|
158 |
if (responseMetadata.isSetRequestId()) {
|
|
|
159 |
System.out.print(" RequestId");
|
|
|
160 |
System.out.println();
|
|
|
161 |
System.out.print(" " + responseMetadata.getRequestId());
|
|
|
162 |
System.out.println();
|
|
|
163 |
}
|
|
|
164 |
}
|
|
|
165 |
System.out.println();
|
|
|
166 |
|
|
|
167 |
System.out.println("Feed Processing Result");
|
|
|
168 |
System.out.println ("=============================================================================");
|
|
|
169 |
System.out.println();
|
|
|
170 |
System.out.println( request.getFeedSubmissionResultOutputStream().toString() );
|
|
|
171 |
System.out.println(response.getResponseHeaderMetadata());
|
|
|
172 |
System.out.println();
|
|
|
173 |
System.out.println();
|
|
|
174 |
|
|
|
175 |
} catch (MarketplaceWebServiceException ex) {
|
|
|
176 |
|
|
|
177 |
System.out.println("Caught Exception: " + ex.getMessage());
|
|
|
178 |
System.out.println("Response Status Code: " + ex.getStatusCode());
|
|
|
179 |
System.out.println("Error Code: " + ex.getErrorCode());
|
|
|
180 |
System.out.println("Error Type: " + ex.getErrorType());
|
|
|
181 |
System.out.println("Request ID: " + ex.getRequestId());
|
|
|
182 |
System.out.print("XML: " + ex.getXML());
|
|
|
183 |
System.out.println("ResponseHeaderMetadata: " + ex.getResponseHeaderMetadata());
|
|
|
184 |
}
|
|
|
185 |
}
|
|
|
186 |
|
|
|
187 |
}
|