Amazon Product Advertising API signed request with Java

后端 未结 4 586
清酒与你
清酒与你 2020-12-25 08:16

after many hours of tinkering and reading the whole internet several times I just can\'t figure out how to sign requests for use with the Product Advertising API.

So

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-25 08:35

    This discussion and the related Amazon post helped me get the client working. That being said, I felt that the solution could be improved with regards to the following:

    1. Setting WebService handlers in code is discouraged. A XML configuration file and a corresponding @HandlerChain annotation are recommended.
    2. A SOAPHandler is not required in this case, LogicalHandler would do just fine. A SOAPHandler has more reach than a LogicalHandler and when it comes to code, more access is not always good.
    3. Stuffing the signature generation, addition of a Node and printing the request in one handler seems like a little too much. These could be separated out for separation of responsibility and ease of testing. One approach would be to add the Node using a XSLT transformation so that the handler could remain oblivious of the transformation logic. Another handler could then be chained which just prints the request. Example

提交回复
热议问题