C#和Web Commcerce Services调用。

上一个搞出来了,他还说不是,非得是这个

WSDL地址:http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl 

 

using  System;
using  System.Collections.Generic;
using  System.ComponentModel;
using  System.Data;
using  System.Drawing;
using  System.Text;
using  System.Windows.Forms;
using  AmazonCommerceApplication.com.amazon.webservices;

namespace  AmazonCommerceApplication
{
    
public partial class Form1 : Form
    
{
        
private string bookSelected = "None Selected"

        
private Item[] items;
        
int amount;
        
int number=0;

        
private string m_isbn = string.Empty; 

        
private string[] m_Author; 

        
private string m_url = string.Empty; 

        
private string m_bookimg = string.Empty; 

        
private string m_title = string.Empty; 

        
private string m_price = string.Empty;

        
public string ISBN;

        
public Form1()
        
{
            InitializeComponent();
        }


        
private void button4_Click(object sender, EventArgs e)
        
{
            
this.Close();
        }


        
private void button1_Click(object sender, EventArgs e)
        
{
            AWSECommerceService ws 
= new AWSECommerceService();
            ItemSearchRequest request 
= new ItemSearchRequest();
            
            ItemSearch itemSearch 
= new ItemSearch();

            request.SearchIndex 
= "Books";
            request.Power 
= "title:" + this.textBox1.Text;
            request.ResponseGroup 
= new string[] "Medium" };
            request.Sort 
= "salesrank";
            ItemSearchRequest[] requests 
= new ItemSearchRequest[] { request };
            itemSearch.AWSAccessKeyId 
= "****";
            itemSearch.Request 
= requests;
            
try
            
{

                ItemSearchResponse response 
= ws.ItemSearch(itemSearch);

                Items info 
= response.Items[0];

                items 
= info.Item;
                amount 
= items.Length;
                
/*for (int i = 0; i < items.Length; i++)
                {

                    Item item = items[i];
                    item.

                    lstAmazonResults.Items.Add(item.ItemAttributes.Title);

                }
*/

                
this.richTextBox1.Text = items[number].ItemAttributes.Title;
                
this.pictureBox1.ImageLocation=items[number].LargeImage.URL;
                
if (items[number].ItemAttributes.Author != null)
                
{
                    
this.richTextBox2.Text = items[number].ItemAttributes.Author[0];
                }

                
else this.richTextBox2.Text = "aaaaaaaaaaaaaaaaaaaaa";
                number
++;

            }
catch
            
{
                
//do nothing 
            }

        }


        
private void button2_Click(object sender, EventArgs e)
        
{
            
if (number > 1)
            
{
                
this.pictureBox1.ImageLocation = items[number].LargeImage.URL;
                
this.richTextBox1.Text = items[number].ItemAttributes.Title;
                
if (items[number].ItemAttributes.Author != null)
                
{
                    
this.richTextBox2.Text = items[number].ItemAttributes.Author[0];
                }

                
else this.richTextBox2.Text = "aaaaaaaaaaaaaaaaaaaaa";
                number
--;
            }

            
        }


        
private void button3_Click(object sender, EventArgs e)
        
{
            
if (number < amount)
            
{
                
this.pictureBox1.ImageLocation = items[number].LargeImage.URL;
                
this.richTextBox1.Text = items[number].ItemAttributes.Title;
                
if (items[number].ItemAttributes.Author != null)
                
{
                    
this.richTextBox2.Text = items[number].ItemAttributes.Author[0];
                }

                
else this.richTextBox2.Text = "aaaaaaaaaaaaaaaaaaaaa";
                number
++;
            }

           
        }


    }

}

 

运行结果:

这个也就比上一多了一张图:)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值