• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Up and Running, not so much.

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Karl Krasnowsky
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Karl,

AwsHandlerResolver works fine!
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:

https://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
 
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 55
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Worked for me. Thanks.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic