Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Professionals
|
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 22nd, 2011, 05:24 AM
Registered User
 
Join Date: May 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Amazon.com Mashups Francis Shanahan

i wantt to run this example from ebook :
Amazon.com®
Mashups
Francis Shanahan

The Battle Plan
This chapter shows two separate examples that are each applications in their own right. Each
example builds on the previous one.
The first example is a single page, entirely self-contained. The plan here is to create a simple search
form. The form submits and displays the results in HTML. This is no big deal, but this example
illustrates the SOAP calls to Amazon.

code:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using com.amazon.webservices;
using System.Xml.Serialization;
using System.IO;

public partial class _default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}

string SearchAmazon(string strKeywords, string strSearchIndex)
{
// Create a new instance of the proxy class
AWSECommerceService myProxy = new AWSECommerceService();

// Create a new instance of the ItemSearch class
ItemSearch mySearch = new ItemSearch();

// ItemSearchRequest stores the actual request parameters
ItemSearchRequest mySearchRequest = new ItemSearchRequest();

// Set some parameters, Keyword and Search Index
mySearchRequest.Keywords = strKeywords;
mySearchRequest.SearchIndex = strSearchIndex;

// Just need Small results, not the full enchilada
mySearchRequest.ResponseGroup = new string[] { "Medium", "Request"};

// Set the subscription and associate tags here
mySearch.SubscriptionId = ConfigurationManager.AppSettings;
mySearch.AssociateTag = ConfigurationManager.AppSettings;

// Setup request
mySearch.Request = new ItemSearchRequest[] { mySearchRequest };

// Execute the request and get the response
ItemSearchResponse myResponse = myProxy.ItemSearch(mySearch);

// Parse the response and return the results in HTML
string strHTML = "";
foreach (Items myItems in myResponse.Items)
{
foreach (Item myItem in myItems.Item)
{
// Get the results in HTML
strHTML += FormatAsHTML(myItem);
}
}
return strHTML;
}

/// <summary>
/// Returns HTML for a specific Amazon Item
/// </summary>
/// <param name="myItem">The Item instance</param>
/// <returns>a string of HTML</returns>
string FormatAsHTML(Item myItem)
{
// Will contain the results
string strHTML ="";

// Check for null
if (myItem != null)
{
// Begin the item HTML
strHTML += "<div class=\"item\">";
// Add the title
strHTML += "<h2>" + myItem.ItemAttributes.Title + "</h2>";

// Add the item image if present
if (myItem.SmallImage != null)
{
strHTML += "<img src=" + myItem.SmallImage.URL;
strHTML += " width=" + myItem.SmallImage.Width;
strHTML += " height=" + myItem.SmallImage.Height;
strHTML += " align=\"left\" >";
}

// Add the ASIN
strHTML += "ASIN: " + myItem.ASIN + "
";

// Add the price if present
if (myItem.OfferSummary != null)
{
if (myItem.OfferSummary.LowestNewPrice != null)
{
strHTML += "Lowest Price: " +
myItem.OfferSummary.LowestNewPrice.FormattedPrice
+ "
";
}
}
// Add a link to the details
strHTML += "<a href=\"" + myItem.DetailPageURL + "\">View Details
";

// Close the output
strHTML += "</div>";
}
return strHTML;
}

protected void cmdSubmit_ServerClick(object sender, EventArgs e)
{
string strKeywords = Request.Params;
string strSearchIndex = Request.Params;
myResults.Text = SearchAmazon(strKeywords, strSearchIndex);
}
}

but error in this line :

ItemSearchResponse myResponse = myProxy.ItemSearch(mySearch);

{"The request must contain the parameter Signature."}

System.Web.Services.Protocols.SoapException was unhandled by user code
Message="The request must contain the parameter Signature."
Source="System.Web.Services"
Actor=""
Lang=""
Node=""
Role=""
StackTrace:
at System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String methodName, Object[] parameters)
at com.amazon.webservices.AWSECommerceService.ItemSea rch(ItemSearch ItemSearch1) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files\07_01_amazonhtml\b818a5fe\eb5b9a12\App_WebRe ferences.pk6wzloj.0.cs:line 181
at _default.SearchAmazon(String strKeywords, String strSearchIndex) in h:\Mashup\ebook\9780470097779_Code\ch07 code\Ch07 Code\07_01_AmazonHTML\default.aspx.cs:line 46
at _default.cmdSubmit_ServerClick(Object sender, EventArgs e) in h:\Mashup\ebook\9780470097779_Code\ch07 code\Ch07 Code\07_01_AmazonHTML\default.aspx.cs:line 114
at System.Web.UI.HtmlControls.HtmlInputButton.OnServe rClick(EventArgs e)
at System.Web.UI.HtmlControls.HtmlInputButton.RaisePo stBackEvent(String eventArgument)
at System.Web.UI.HtmlControls.HtmlInputButton.System. Web.UI.IPostBackEventHandler.RaisePostBackEvent(St ring eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:

help me PLZ





Similar Threads
Thread Thread Starter Forum Replies Last Post
Can we get an Amazon Ebook for this title? [email protected] BOOK: Professional Enterprise .NET 0 November 16th, 2010 11:48 PM
Amazon S3 Storage jimibt BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 June 5th, 2007 11:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.