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.io.ByteArrayOutputStream;
23
import java.util.List;
24
import java.util.ArrayList;
25
import com.amazonaws.mws.*;
26
import com.amazonaws.mws.model.*;
27
import com.amazonaws.mws.mock.MarketplaceWebServiceMock;
28
 
29
/**
30
 *
31
 * Get Feed Submission Result  Samples
32
 *
33
 *
34
 */
35
public class GetFeedSubmissionResultSample {
36
 
37
    /**
38
     * Just add a few required parameters, and try the service
39
     * Get Feed Submission Result functionality
40
     *
41
     * @param args unused
42
     */
43
    public static void main(String... args) {
44
 
45
        /************************************************************************
46
         * Access Key ID and Secret Access Key ID, obtained from:
47
         * http://aws.amazon.com
48
         ***********************************************************************/
49
        final String accessKeyId = "<Your Access Key ID>";
50
        final String secretAccessKey = "<Your Secret Access Key>";
51
 
52
        final String appName = "<Your Application or Company Name>";
53
        final String appVersion = "<Your Application Version or Build Number or Release Date>";
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
 
95
        /************************************************************************
96
         * Setup request parameters and uncomment invoke to try out 
97
         * sample for Get Feed Submission Result 
98
         ***********************************************************************/
99
 
100
        /************************************************************************
101
         * Marketplace and Merchant IDs are required parameters for all 
102
         * Marketplace Web Service calls.
103
         ***********************************************************************/
104
        final String merchantId = "<Your Merchant ID>";
105
 
106
        GetFeedSubmissionResultRequest request = new GetFeedSubmissionResultRequest();
107
        request.setMerchant( merchantId );
108
 
109
        request.setFeedSubmissionId( "<Feed Submission ID>" );
110
 
111
        // Note that depending on the size of the feed sent in, and the number of errors and warnings,
112
        // the result can reach sizes greater than 1GB. For this reason we recommend that you _always_ 
113
        // program to MWS in a streaming fashion. Otherwise, as your business grows you may silently reach
114
        // the in-memory size limit and have to re-work your solution.
115
        //
116
        // OutputStream processingResult = new FileOutputStream( "feedSubmissionResult.xml" );
117
        // request.setFeedSubmissionResultOutputStream( processingResult );
118
 
119
        // invokeGetFeedSubmissionResult(service, request);
120
    }
121
 
122
 
123
 
124
    /**
125
     * Get Feed Submission Result  request sample
126
     * retrieves the feed processing report
127
     *   
128
     * @param service instance of MarketplaceWebService service
129
     * @param request Action to invoke
130
     */
131
    public static void invokeGetFeedSubmissionResult(MarketplaceWebService service, GetFeedSubmissionResultRequest request) {
132
        try {
133
 
134
            GetFeedSubmissionResultResponse response = service.getFeedSubmissionResult(request);
135
 
136
 
137
            System.out.println ("GetFeedSubmissionResult Action Response");
138
            System.out.println ("=============================================================================");
139
            System.out.println ();
140
 
141
            System.out.print("    GetFeedSubmissionResultResponse");
142
            System.out.println();
143
            System.out.print("    GetFeedSubmissionResultResult");
144
            System.out.println();
145
            System.out.print("            MD5Checksum");
146
            System.out.println();
147
            System.out.print("                " + response.getGetFeedSubmissionResultResult().getMD5Checksum());
148
            System.out.println();
149
            if (response.isSetResponseMetadata()) {
150
                System.out.print("        ResponseMetadata");
151
                System.out.println();
152
                ResponseMetadata  responseMetadata = response.getResponseMetadata();
153
                if (responseMetadata.isSetRequestId()) {
154
                    System.out.print("            RequestId");
155
                    System.out.println();
156
                    System.out.print("                " + responseMetadata.getRequestId());
157
                    System.out.println();
158
                }
159
            } 
160
            System.out.println();
161
 
162
            System.out.println("Feed Processing Result");
163
            System.out.println ("=============================================================================");
164
            System.out.println();
165
            System.out.println( request.getFeedSubmissionResultOutputStream().toString() );
166
            System.out.println(response.getResponseHeaderMetadata());
167
            System.out.println();
168
            System.out.println();
169
 
170
        } catch (MarketplaceWebServiceException ex) {
171
 
172
            System.out.println("Caught Exception: " + ex.getMessage());
173
            System.out.println("Response Status Code: " + ex.getStatusCode());
174
            System.out.println("Error Code: " + ex.getErrorCode());
175
            System.out.println("Error Type: " + ex.getErrorType());
176
            System.out.println("Request ID: " + ex.getRequestId());
177
            System.out.print("XML: " + ex.getXML());
178
            System.out.println("ResponseHeaderMetadata: " + ex.getResponseHeaderMetadata());
179
        }
180
    }
181
 
182
}