aspose file tools*
The moose likes Web Services and the fly likes Up and Running, not so much. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Up and Running, not so much." Watch "Up and Running, not so much." New topic
Author

Up and Running, not so much.

Karl Krasnowsky
Ranch Hand

Joined: Jan 16, 2009
Posts: 97
Hi folks,
I've seen references in the forum mentioning the use of Martin Kalin's book "Java Web Services: Up and Running" as a good jumping off book into the wonderful world of Web Services.
I've been working through it and hit a stumbling bump in chapter 2 (specifically instructions leading up to and including the Wrapped Style client code that's presented on pages 41-42) that uses the Amazon E-Commerce site as a model for building clients against the wsdl generated access code.
Can others here who have used this book vouch for the reliability of this example code? I'm getting an error:


which I believe indicates that the item that I'm attempting to use as a search index (Books) is no longer valid? I've tried this with my code and the example code directly for the book.

Sorry to be posting this here, I can't find a forum specifically for this book (if there is one you know of, please send the link my way).

thanks in advance for any help on this,
Karl

[SCJP 6]
[SCBCD in process]
Karl Krasnowsky
Ranch Hand

Joined: Jan 16, 2009
Posts: 97
Given that nobody had anything to contribute to this topic, I'll answer it myself and provide pointers for others who might be using this book.
The example I'm sighting from this book is now out of date due to an added security layer added by the Amazon ECommerce API.
For those interested a couple of additions need to be provided to source and dependencies to support this.

1) You need to get a copy of the AwsHandlerResolver class and add it to your project.
2) You also need to add commons-codec-1.3.jar to your project's dependencies.
I got these from here (Amazon's development site)

BTW, you need to change the name of the AwsHandlerResolver java file to match the class name, download will format it all lower case.

now the code change:



Of course you can set this up any way you like. I added a 2nd argument that passes in the "Secret" amazon ID.

Hope this helps someone out there...

~Karl
Denis Zjukow
Ranch Hand

Joined: Mar 15, 2006
Posts: 39
Thanks Karl,

AwsHandlerResolver works fine!
Wiked Vicky Malhotra
Greenhorn

Joined: Dec 11, 2010
Posts: 10
Thanks karl!!!

I was feeling outrageous after not getting the code in the book to run. I am new to JAX-WS and started reading this book.

I would appreciate you sharing the resolution.

Wiked Vicky Malhotra
Greenhorn

Joined: Dec 11, 2010
Posts: 10
Hello,

I have an issue with another example in this book. The WS Security example in chapter 5 does not run according to the book.

I submitted the issue at following link:

http://www.coderanch.com/t/533209/Web-Services/java/WS-Security-example-not-running


Karl, Could you help me on this? Have you tried this WS security example.

Regards
Naresh Chaurasia
Ranch Hand

Joined: May 18, 2005
Posts: 356
I am also getting same error while executing AmazonClientW. I have made the changes as suggested, but what would be the value of secret_key.


SCJP 1.4, SCWCD1.4, OCA(1Z0-007)
Joey Jackson
Greenhorn

Joined: Dec 08, 2011
Posts: 4
I am attempting to run this book exercise and have followed the steps outlined in the above recommendation. my client file looks like this: when I run the client java -cp .;commons-codec-1.3.jar AmazonClientW nothing gets printed and I dont get any exceptions. any one have any suggestions why?

An Tran
Greenhorn

Joined: Jan 25, 2012
Posts: 2
I got into the same problem and found a solution at https://forums.aws.amazon.com/thread.jspa?messageID=143146

The last post attached a revised copy of AwsHandlerResolver which prints request/response xml.

It turned out that AssociateTag is required, so I added search.setAssociateTag(""); and the example worked.
Jakob Havstein Eriksen
Greenhorn

Joined: Mar 20, 2012
Posts: 1
This is what I had to do to get the code example working:

Generate stubs from this version of the wsdl:

Remove search.getSubscriptionId() from call to port.itemSearch() in AmazonClientW.java.

Add search.setAssociateTag("") on the ItemSearch variable.

Get the AwsHandlerResolver.java from this post: https://forums.aws.amazon.com/thread.jspa?messageID=259215#259215

Add the line service.setHandlerResolver(new AwsHandlerResolver("<Your Secret Key>")) to set the HandlerResolver on the AWSECommerceService in AmazonClientW.java.
Cosmin Nicolae Vacaroiu
Ranch Hand

Joined: Feb 10, 2011
Posts: 52

Worked for me. Thanks.


SCJP 6 (93%), SQL Expert 11g (95%), SCWCD 6 (84%), OCE-EJBD 6 (98%), OCE-JPAD 6 (93%)
Narayanan Ramachandran
Greenhorn

Joined: Dec 18, 2012
Posts: 3
Cosmin Nicolae Vacaroiu wrote:Worked for me. Thanks.


Hi Team,

The SOAP call was successful and the operation succeeded without any issue. But the call is always returning 0 records. Any idea? I have done all the changes as suggested by Karl.

Also I am not able to submit this using SOAP UI also. It is always throwing the below fault. Please advise on the same as well.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aws="http://webservices.amazon.com/AWSFault/2005-15-09">
<soapenv:Body>
<soapenv:Fault>
<faultcode>aws:Client.MissingParameter</faultcode>
<faultstring>The request must contain the parameter Signature.</faultstring>
<detail>
<aws:RequestId>cf96391c-5ca2-4df1-94bb-3df1aaae3f6a</aws:RequestId>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

Please advise.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Up and Running, not so much.