This is an article discussion thread for discussing the SitePoint article, “Use Amazon Web Services in ASP.NET”
I’ve been wanting to do exactly this. Thanks for the article!
This is great, but is there a way to do it with either PHP 4 or ASP 3.0?
Thanks in advance
I’ve been rifling through work just to have a moment to get to it and start playing. This is great!
I’ve run into a snag building it (the first example) with VWD2005 Express Beta and maybe it’s the way I’ve interpretted your instruction.
I’m using C# and by default code is generated in a code behind Default.aspx.cs
When I double clicked my button I get the event handler in my code behind:
void Button1_Click(object sender, EventArgs e)
I copied and pasted your example into the area that executes when the button is clicked.
After pasting the code in, both the code editor in VWD2005 and the page when built shows me a syntax error indicating:
using com_webservices_amazon has a syntax error, ‘(’ expected
Simple enough, I enclose it with ()
I still have trouble… I receive another error:
CS1023: Embedded statement cannot be a declaration or labeled statement
That is in reference to:
Line 18: AWSECommerceService aws = new AWSECommerceService();
I did add the web reference as per your directions and can see that the WebReferences directory has been create with the associated sub directories and files. My Web.Config has also been added with an added key for the Amazon web service.
I’m playing with it on WinXP SP2 and of course have the beta of Dot.Net 2.0 running with VWD2005 Express Beta.
I understand Philip is busy with his PHD.
Has anyone else built an example based on this article? I’ve spent the better part of the evening over at the Developer Board at Amazon but I’ve yet to find a useful solution to one of the bugs I’m receiving. Apparently there are a lot of bugs yet to be resolved with Amazon’s wsdl and the .NET developers are pretty much up in arms about it.
I spent some time with the AWSECommerceService.wsdl file messing about with different versions before finally going back to the one that VWD2005 created in the first place.
I did have to change the namespace before it would build to:
* It’s a bit different than the namespace in the example but it wouldn’t build with the original code.
I managed to get my example to build and run but as soon as I run a query It crashes with the following error.
Types ‘com_amazon_webservices.CustomerReviews1’ and ‘com_amazon_webservices.CustomerReviews’ both use the XML type name, ‘CustomerReviews’, from namespace ‘http://webservices.amazon.com/AWSECommerceService/2004-10-19’. Use XML attributes to specify a unique XML name and/or namespace for the type.
Using VS.NET 2003 this post on the Amazon forums resolves the problem for me http://forums.prospero.com/n/mb/message.asp?webtag=am-assocdevxml&msg=6777.1&ctx=0
However I can’t even find the Reference.cs file using Web Dev 2005
I have a thread running here and found the same thing:
I’ve also been playing with the Amazon Search Web Service:
It is pretty much identical in the setup to the Ecommerce Web Service and have run into absolutely no issues. Again I set it up with Visual Web Dev 2005 there is no reference.cs. There’s a discomap and the wsdl but in this case it works perfectly. (strangely you don’t even have to use your developer token. I left it blank and it returned results)
If anyone’s interested I’ll upload the code. It’s very simple and uses an isbn to return information about a book, but it does work.
Hopefully I’ll get some more feedback/direction from the Amazon board and I’ll post any fixes when they arrive.
cool. post it.
I’ve attached amazonws.aspx.txt
It’s really quite simple but makes for a good introduction on how to use the Web Service.
In Visual Web Dev 2005, I added a WebReference and in the "add web reference " window I renamed it AmazonWS.
Use this: http://soap.amazon.com/schemas3/AmazonWebServices.wsdl
* You can rename it what you like and update the amazon.aspx file.
VWD2005’s Intellisense picks it up just as if it was local and lets me select whatever I want using its code completion.
Now if I can just get the Ecommerce Web Service working…
I cant figure it out either.
Im assuming its an issue with VS 2005, i created the project in 2003 and it works fine, then try and convert it and it rips out the reference.cs file.
I found this in the help of 2005.
Visual studio 2005 help
Would be nice if Philip could assist.
I think there must be some pretty intense comaptability probs with the AWSECommerceService and anything .NET v1.1 and above.
I built it for .NET v1.1 and used the wsdl.exe tool to create my C# source and the compiled it to a .dll. That was great but I still needed to do a workaround described HERE. It describes a workaround for VS2003 but it really should be labeled for .NET 1.1. There are 2 parts and both need to be applied to get good results. The bottom line is that it does work if you build it for .NET version 1.1 and now I can carry on with the articles code and add a datagrid and cache the results.
I’m still at a loss to get .NET 2.0 beta to work with VWD2005 or through developing and compiling using the wsdl.exe that came with it. The good folks at Amazon from all outside appearances are still working on it.
I’m using the version of .NET 2.0 beta that was released some time ago. I wonder if theree have been some updates that affect this issue as Philips article didn’t mention any bugs.
By the way… your link to VS2005 Help goes to a Multiple Sclirosis help website in Mozilla browsers and page not found in IE.
why I can’t figure out it ? there is error when I debug ,but there is nothing return on our page when I run ??Please help me !thanks!
Hmmm what version of .NET are you running and what’s the error your debugger spits out?
Are you using VS, Matrix, or VWD
The XMLSerialization services generates this error when compiling the temporary .dll for the Amazon web service. Has anyone received this error and solved it?
c:\Documents and Settings\SAICJAX05\ASPNET\Local Settings\Temp\ch8vxo6c.0.cs(3862,128): error CS0030: Cannot convert type ‘string’ to ‘string’
c:\Documents and Settings\SAICJAX05\ASPNET\Local Settings\Temp\ch8vxo6c.0.cs(13582,147): error CS0029: Cannot implicitly convert type ‘string’ to ‘string’
See the posted fix here: http://forums.prospero.com/n/mb/message.asp?webtag=am-assocdevxml&msg=6777.1&ctx=128
I followed Phillip’s example shown in “Use Amazon Web Services in ASP.NET”, but the web reference doesn’t seem to work.
It doesn’t recognize:
using com_amazon_webservices; AWSECommerceService aws = new AWSECommerceService();
obleberean\WebForm1.aspx.cs(12): The type or namespace name ‘com_amazon_webservices’ could not be found (are you missing a using directive or an assembly reference?)
Can someone help please? Thanks!
Finally it worked!
Make sure these parameters are correct:
itemSearch.AssociateTag = " “;
itemSearch.SubscriptionId =” ";
If not, it won’t work…
Just wondering… what are the possible money-making opportunities to using this web service? Why wouldn’t someone just go directly to Amazon.com? Not being sarcastic, just want to know…
because you can make affiliate fees with it, a percentage of the sales if they come through your site.
I’ve just got it running in VS 2005 (not Express) Beta with .NET 2.0 with 3 changes.
- Change the initial using statement to
where YourProjNamespace is the name of your project namespace, which is the same as the name of your project unless you’ve changes anything.
- and 3. Follow the 2 workarounds given here:
and quoted previously.
Compiles, runs and retrieves results :agree:.
Thanks for the article Philip.