Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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.util.List;
23
import java.util.ArrayList;
24
import com.amazonaws.mws.*;
25
import com.amazonaws.mws.model.*;
26
import com.amazonaws.mws.mock.MarketplaceWebServiceMock;
27
 
28
/**
29
 *
30
 * Get Feed Submission List  Samples
31
 *
32
 *
33
 */
34
public class GetFeedSubmissionListSample {
35
 
36
    /**
37
     * Just add a few required parameters, and try the service
38
     * Get Feed Submission List functionality
39
     *
40
     * @param args unused
41
     */
42
    public static void main(String... args) {
43
 
44
        /************************************************************************
45
         * Access Key ID and Secret Access Key ID, obtained from:
46
         * http://aws.amazon.com
47
         ***********************************************************************/
48
 
49
        final String accessKeyId = "AKIAII3SGRXBJDPCHSGQ";
50
        final String secretAccessKey = "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";
51
 
52
        final String appName = "Test";
53
        final String appVersion = "1.0";
54
 
55
        MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();
56
 
57
        /************************************************************************
58
         * Uncomment to set the appropriate MWS endpoint.
59
         ************************************************************************/
60
        // US
61
        // config.setServiceURL("https://mws.amazonservices.com");
62
        // UK
63
        // config.setServiceURL("https://mws.amazonservices.co.uk");
64
        // Germany
65
        // config.setServiceURL("https://mws.amazonservices.de");
66
        // France
67
        // config.setServiceURL("https://mws.amazonservices.fr");
68
        // Italy
69
        // config.setServiceURL("https://mws.amazonservices.it");
70
        // Japan
71
        // config.setServiceURL("https://mws.amazonservices.jp");
72
        // China
73
        // config.setServiceURL("https://mws.amazonservices.com.cn");
74
        // Canada
75
        // config.setServiceURL("https://mws.amazonservices.ca");
76
        // India
77
         config.setServiceURL("https://mws.amazonservices.in");
78
 
79
        /************************************************************************
80
         * You can also try advanced configuration options. Available options are:
81
         *
82
         *  - Signature Version
83
         *  - Proxy Host and Proxy Port
84
         *  - User Agent String to be sent to Marketplace Web Service
85
         *
86
         ***********************************************************************/
87
 
88
        /************************************************************************
89
         * Instantiate Http Client Implementation of Marketplace Web Service        
90
         ***********************************************************************/
91
 
92
        MarketplaceWebService service = new MarketplaceWebServiceClient(
93
                accessKeyId, secretAccessKey, appName, appVersion, config);
94
        // MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();
95
 
96
        // MarketplaceWebService service = new MarketplaceWebServiceClient(accessKeyId, secretAccessKey, config);
97
 
98
        /************************************************************************
99
         * Uncomment to try out Mock Service that simulates Marketplace Web Service 
100
         * responses without calling Marketplace Web Service  service.
101
         *
102
         * Responses are loaded from local XML files. You can tweak XML files to
103
         * experiment with various outputs during development
104
         *
105
         * XML files available under com/amazonaws/mws/mock tree
106
         *
107
         ***********************************************************************/
108
        // MarketplaceWebService service = new MarketplaceWebServiceMock();
109
 
110
        /************************************************************************
111
         * Setup request parameters and uncomment invoke to try out 
112
         * sample for Get Feed Submission List 
113
         ***********************************************************************/
114
 
115
        /************************************************************************
116
         * Marketplace and Merchant IDs are required parameters for all 
117
         * Marketplace Web Service calls.
118
         ***********************************************************************/
119
        final String merchantId = "AF6E3O0VE0X4D";
120
 
121
        GetFeedSubmissionListRequest request = new GetFeedSubmissionListRequest();
122
        request.setMerchant( merchantId );
123
 
124
        // @TODO: set request parameters here
125
 
126
        invokeGetFeedSubmissionList(service, request);
127
 
128
    }
129
 
130
 
131
 
132
    /**
133
     * Get Feed Submission List  request sample
134
     * returns a list of feed submission identifiers and their associated metadata
135
     *   
136
     * @param service instance of MarketplaceWebService service
137
     * @param request Action to invoke
138
     */
139
    public static void invokeGetFeedSubmissionList(MarketplaceWebService service, GetFeedSubmissionListRequest request) {
140
        try {
141
 
142
            GetFeedSubmissionListResponse response = service.getFeedSubmissionList(request);
143
 
144
 
145
            System.out.println ("GetFeedSubmissionList Action Response");
146
            System.out.println ("=============================================================================");
147
            System.out.println ();
148
 
149
            System.out.print("    GetFeedSubmissionListResponse");
150
            System.out.println();
151
            if (response.isSetGetFeedSubmissionListResult()) {
152
                System.out.print("        GetFeedSubmissionListResult");
153
                System.out.println();
154
                GetFeedSubmissionListResult  getFeedSubmissionListResult = response.getGetFeedSubmissionListResult();
155
                if (getFeedSubmissionListResult.isSetNextToken()) {
156
                    System.out.print("            NextToken");
157
                    System.out.println();
158
                    System.out.print("                " + getFeedSubmissionListResult.getNextToken());
159
                    System.out.println();
160
                }
161
                if (getFeedSubmissionListResult.isSetHasNext()) {
162
                    System.out.print("            HasNext");
163
                    System.out.println();
164
                    System.out.print("                " + getFeedSubmissionListResult.isHasNext());
165
                    System.out.println();
166
                }
167
                java.util.List<FeedSubmissionInfo> feedSubmissionInfoList = getFeedSubmissionListResult.getFeedSubmissionInfoList();
168
                for (FeedSubmissionInfo feedSubmissionInfo : feedSubmissionInfoList) {
169
                    System.out.print("            FeedSubmissionInfo");
170
                    System.out.println();
171
                    if (feedSubmissionInfo.isSetFeedSubmissionId()) {
172
                        System.out.print("                FeedSubmissionId");
173
                        System.out.println();
174
                        System.out.print("                    " + feedSubmissionInfo.getFeedSubmissionId());
175
                        System.out.println();
176
                    }
177
                    if (feedSubmissionInfo.isSetFeedType()) {
178
                        System.out.print("                FeedType");
179
                        System.out.println();
180
                        System.out.print("                    " + feedSubmissionInfo.getFeedType());
181
                        System.out.println();
182
                    }
183
                    if (feedSubmissionInfo.isSetSubmittedDate()) {
184
                        System.out.print("                SubmittedDate");
185
                        System.out.println();
186
                        System.out.print("                    " + feedSubmissionInfo.getSubmittedDate());
187
                        System.out.println();
188
                    }
189
                    if (feedSubmissionInfo.isSetFeedProcessingStatus()) {
190
                        System.out.print("                FeedProcessingStatus");
191
                        System.out.println();
192
                        System.out.print("                    " + feedSubmissionInfo.getFeedProcessingStatus());
193
                        System.out.println();
194
                    }
195
                    if (feedSubmissionInfo.isSetStartedProcessingDate()) {
196
                        System.out.print("                StartedProcessingDate");
197
                        System.out.println();
198
                        System.out.print("                    " + feedSubmissionInfo.getStartedProcessingDate());
199
                        System.out.println();
200
                    }
201
                    if (feedSubmissionInfo.isSetCompletedProcessingDate()) {
202
                        System.out.print("                CompletedProcessingDate");
203
                        System.out.println();
204
                        System.out.print("                    " + feedSubmissionInfo.getCompletedProcessingDate());
205
                        System.out.println();
206
                    }
207
                }
208
            } 
209
            if (response.isSetResponseMetadata()) {
210
                System.out.print("        ResponseMetadata");
211
                System.out.println();
212
                ResponseMetadata  responseMetadata = response.getResponseMetadata();
213
                if (responseMetadata.isSetRequestId()) {
214
                    System.out.print("            RequestId");
215
                    System.out.println();
216
                    System.out.print("                " + responseMetadata.getRequestId());
217
                    System.out.println();
218
                }
219
            } 
220
            System.out.println();
221
            System.out.println(response.getResponseHeaderMetadata());
222
            System.out.println();
223
 
224
 
225
        } catch (MarketplaceWebServiceException ex) {
226
 
227
            System.out.println("Caught Exception: " + ex.getMessage());
228
            System.out.println("Response Status Code: " + ex.getStatusCode());
229
            System.out.println("Error Code: " + ex.getErrorCode());
230
            System.out.println("Error Type: " + ex.getErrorType());
231
            System.out.println("Request ID: " + ex.getRequestId());
232
            System.out.print("XML: " + ex.getXML());
233
            System.out.println("ResponseHeaderMetadata: " + ex.getResponseHeaderMetadata());
234
        }
235
    }
236
 
237
}