summaryrefslogtreecommitdiff
path: root/sample/wsdl/amazon/AmazonSearchDriver.rb
blob: bf532b75a590aa6a4cf152d4cf5f67f7611a79ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
require 'AmazonSearch.rb'

require 'soap/rpc/driver'

class AmazonSearchPort < SOAP::RPC::Driver
  MappingRegistry = ::SOAP::Mapping::Registry.new

  MappingRegistry.set(
    KeywordRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "KeywordRequest") }
  )
  MappingRegistry.set(
    ProductInfo,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "ProductInfo") }
  )
  MappingRegistry.set(
    DetailsArray,
    ::SOAP::SOAPArray,
    ::SOAP::Mapping::Registry::TypedArrayFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "Details") }
  )
  MappingRegistry.set(
    PowerRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "PowerRequest") }
  )
  MappingRegistry.set(
    BrowseNodeRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "BrowseNodeRequest") }
  )
  MappingRegistry.set(
    AsinRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "AsinRequest") }
  )
  MappingRegistry.set(
    BlendedRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "BlendedRequest") }
  )
  MappingRegistry.set(
    ProductLineArray,
    ::SOAP::SOAPArray,
    ::SOAP::Mapping::Registry::TypedArrayFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "ProductLine") }
  )
  MappingRegistry.set(
    UpcRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "UpcRequest") }
  )
  MappingRegistry.set(
    AuthorRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "AuthorRequest") }
  )
  MappingRegistry.set(
    ArtistRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "ArtistRequest") }
  )
  MappingRegistry.set(
    ActorRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "ActorRequest") }
  )
  MappingRegistry.set(
    ManufacturerRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "ManufacturerRequest") }
  )
  MappingRegistry.set(
    DirectorRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "DirectorRequest") }
  )
  MappingRegistry.set(
    ListManiaRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "ListManiaRequest") }
  )
  MappingRegistry.set(
    WishlistRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "WishlistRequest") }
  )
  MappingRegistry.set(
    ExchangeRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "ExchangeRequest") }
  )
  MappingRegistry.set(
    ListingProductDetails,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "ListingProductDetails") }
  )
  MappingRegistry.set(
    MarketplaceRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "MarketplaceRequest") }
  )
  MappingRegistry.set(
    MarketplaceSearch,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "MarketplaceSearch") }
  )
  MappingRegistry.set(
    MarketplaceSearchDetailsArray,
    ::SOAP::SOAPArray,
    ::SOAP::Mapping::Registry::TypedArrayFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "MarketplaceSearchDetails") }
  )
  MappingRegistry.set(
    SellerProfileRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "SellerProfileRequest") }
  )
  MappingRegistry.set(
    SellerProfile,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "SellerProfile") }
  )
  MappingRegistry.set(
    SellerProfileDetailsArray,
    ::SOAP::SOAPArray,
    ::SOAP::Mapping::Registry::TypedArrayFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "SellerProfileDetails") }
  )
  MappingRegistry.set(
    SellerRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "SellerRequest") }
  )
  MappingRegistry.set(
    SellerSearch,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "SellerSearch") }
  )
  MappingRegistry.set(
    SellerSearchDetailsArray,
    ::SOAP::SOAPArray,
    ::SOAP::Mapping::Registry::TypedArrayFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "SellerSearchDetails") }
  )
  MappingRegistry.set(
    SimilarityRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "SimilarityRequest") }
  )
  MappingRegistry.set(
    GetShoppingCartRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "GetShoppingCartRequest") }
  )
  MappingRegistry.set(
    ShoppingCart,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "ShoppingCart") }
  )
  MappingRegistry.set(
    ItemArray,
    ::SOAP::SOAPArray,
    ::SOAP::Mapping::Registry::TypedArrayFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "Item") }
  )
  MappingRegistry.set(
    ClearShoppingCartRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "ClearShoppingCartRequest") }
  )
  MappingRegistry.set(
    AddShoppingCartItemsRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "AddShoppingCartItemsRequest") }
  )
  MappingRegistry.set(
    AddItemArray,
    ::SOAP::SOAPArray,
    ::SOAP::Mapping::Registry::TypedArrayFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "AddItem") }
  )
  MappingRegistry.set(
    RemoveShoppingCartItemsRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "RemoveShoppingCartItemsRequest") }
  )
  MappingRegistry.set(
    ItemIdArray,
    ::SOAP::SOAPArray,
    ::SOAP::Mapping::Registry::TypedArrayFactory,
    { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") }
  )
  MappingRegistry.set(
    ModifyShoppingCartItemsRequest,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "ModifyShoppingCartItemsRequest") }
  )
  MappingRegistry.set(
    ItemQuantityArray,
    ::SOAP::SOAPArray,
    ::SOAP::Mapping::Registry::TypedArrayFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "ItemQuantity") }
  )
  MappingRegistry.set(
    Details,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "Details") }
  )
  MappingRegistry.set(
    ProductLine,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "ProductLine") }
  )
  MappingRegistry.set(
    MarketplaceSearchDetails,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "MarketplaceSearchDetails") }
  )
  MappingRegistry.set(
    SellerProfileDetails,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "SellerProfileDetails") }
  )
  MappingRegistry.set(
    SellerSearchDetails,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "SellerSearchDetails") }
  )
  MappingRegistry.set(
    Item,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "Item") }
  )
  MappingRegistry.set(
    AddItem,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "AddItem") }
  )
  MappingRegistry.set(
    ItemQuantity,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("http://soap.amazon.com", "ItemQuantity") }
  )
  
  Methods = [
    ["KeywordSearchRequest", "keywordSearchRequest", [
      ["in", "KeywordSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "KeywordRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["PowerSearchRequest", "powerSearchRequest", [
      ["in", "PowerSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "PowerRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["BrowseNodeSearchRequest", "browseNodeSearchRequest", [
      ["in", "BrowseNodeSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "BrowseNodeRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["AsinSearchRequest", "asinSearchRequest", [
      ["in", "AsinSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "AsinRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["BlendedSearchRequest", "blendedSearchRequest", [
      ["in", "BlendedSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "BlendedRequest"]],
      ["retval", "return",
       [::SOAP::SOAPArray, "http://soap.amazon.com", "ProductLine"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["UpcSearchRequest", "upcSearchRequest", [
      ["in", "UpcSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "UpcRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["AuthorSearchRequest", "authorSearchRequest", [
      ["in", "AuthorSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "AuthorRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["ArtistSearchRequest", "artistSearchRequest", [
      ["in", "ArtistSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ArtistRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["ActorSearchRequest", "actorSearchRequest", [
      ["in", "ActorSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ActorRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["ManufacturerSearchRequest", "manufacturerSearchRequest", [
      ["in", "ManufacturerSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ManufacturerRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["DirectorSearchRequest", "directorSearchRequest", [
      ["in", "DirectorSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "DirectorRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["ListManiaSearchRequest", "listManiaSearchRequest", [
      ["in", "ListManiaSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ListManiaRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["WishlistSearchRequest", "wishlistSearchRequest", [
      ["in", "WishlistSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "WishlistRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["ExchangeSearchRequest", "exchangeSearchRequest", [
      ["in", "ExchangeSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ExchangeRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ListingProductDetails"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["MarketplaceSearchRequest", "marketplaceSearchRequest", [
      ["in", "MarketplaceSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "MarketplaceRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "MarketplaceSearch"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["SellerProfileSearchRequest", "sellerProfileSearchRequest", [
      ["in", "SellerProfileSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "SellerProfileRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "SellerProfile"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["SellerSearchRequest", "sellerSearchRequest", [
      ["in", "SellerSearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "SellerRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "SellerSearch"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["SimilaritySearchRequest", "similaritySearchRequest", [
      ["in", "SimilaritySearchRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "SimilarityRequest"]],
      ["retval", "return",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["GetShoppingCartRequest", "getShoppingCartRequest", [
      ["in", "GetShoppingCartRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "GetShoppingCartRequest"]],
      ["retval", "ShoppingCart",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ShoppingCart"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["ClearShoppingCartRequest", "clearShoppingCartRequest", [
      ["in", "ClearShoppingCartRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ClearShoppingCartRequest"]],
      ["retval", "ShoppingCart",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ShoppingCart"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["AddShoppingCartItemsRequest", "addShoppingCartItemsRequest", [
      ["in", "AddShoppingCartItemsRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "AddShoppingCartItemsRequest"]],
      ["retval", "ShoppingCart",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ShoppingCart"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["RemoveShoppingCartItemsRequest", "removeShoppingCartItemsRequest", [
      ["in", "RemoveShoppingCartItemsRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "RemoveShoppingCartItemsRequest"]],
      ["retval", "ShoppingCart",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ShoppingCart"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"],
    ["ModifyShoppingCartItemsRequest", "modifyShoppingCartItemsRequest", [
      ["in", "ModifyShoppingCartItemsRequest",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ModifyShoppingCartItemsRequest"]],
      ["retval", "ShoppingCart",
       [::SOAP::SOAPStruct, "http://soap.amazon.com", "ShoppingCart"]]],
     "http://soap.amazon.com", "http://soap.amazon.com"]
  ]

  DefaultEndpointUrl = "http://soap.amazon.com/onca/soap2"

  def initialize(endpoint_url = nil)
    endpoint_url ||= DefaultEndpointUrl
    super(endpoint_url, nil)
    self.mapping_registry = MappingRegistry
    init_methods
  end

private 

  def init_methods
    Methods.each do |name_as, name, params, soapaction, namespace|
      qname = XSD::QName.new(namespace, name_as)
      @proxy.add_method(qname, soapaction, name, params)
      add_rpc_method_interface(name, params)
    end
  end
end