Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

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