| Author | Message | 
		
		  | visasimbu | 
			  
				|  Posted: Mon Nov 02, 2015 8:55 pm    Post subject: REST API call - Amazon AWS integration using WMB 7.0.0.7 |   |  | 
		
		  |  Disciple
 
 
 Joined: 06 Nov 2009Posts: 171
 
 
 | 
			  
				| Hi All I have a simple WMB 7 flow as a Restconsumer like below. This flow is to test connectivity and fetch the amazon AWS response.
 
 Flow :
 HttpInputNode -> HttpRequestNode -> HttpReplyNode
 
 HTTPInput node - property
 Path Suffix for URL - /Products/2011-10-01
 
 HTTP Request Node - property
 Web service URL -
 
 https://mws.amazonservices.com/Products/2011-10-01?ASINList.ASIN.1=B002GKGL8M&AWSAccessKeyId=XXXXXXXXXXXX&Action=GetCompetitivePricingForASIN&MWSAuthToken=amzn.mws.XXXXXXfe-XXXX-XXXX-XXXX-XXXXXXXXX&MarketplaceId=ATVPDKIKX0DER&SellerId=XXXXXXXXXX&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2015-11-03T03%3A42%3A38Z&Version=2011-10-01&Signature=xxxXXXXXXXXXXXXXXXXXXXXXXeV18lrxN%2BXXXXXJ%2Bip%2BA%3D
 
 Note - In the URL, i have changed the some of the parameters with 'X'.
 
 HttpReply Node - property
 No change.
 
 Apart from flow properties, i have downloaded .cer file from amazon site and created JKS file using .cer file. Executed below statement in the command window.
 
 
 
   
	| Quote: |  
	| mqsichangeproperties MB7BROKER -o BrokerRegistry -n brokerKeystoreFile -v C:\SIMBU\KEY\amzkey.jks mqsichangeproperties MB7BROKER -o BrokerRegistry -n brokerTruststoreFile -v C:\SIMBU\KEY\amzkey.jks
 
 mqsisetdbparms MB7BROKER -n brokerKeystore::password -u temp -p changeit
 mqsisetdbparms MB7BROKER -n brokerTruststore::password -u temp -p changeit
 |  
 To test flow, I have created the SOAP UI rest project1 using below URL
 
 
 
   
	| Quote: |  
	| https://mws.amazonservices.com/Products/2011-10-01?ASINList.ASIN.1=B002GKGL8M&AWSAccessKeyId=XXXXXXXXXXXX&Action=GetCompetitivePricingForASIN&MWSAuthToken=amzn.mws.XXXXXXfe-XXXX-XXXX-XXXX-XXXXXXXXX&MarketplaceId=ATVPDKIKX0DER&SellerId=XXXXXXXXXX&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2015-11-03T03%3A42%3A38Z&Version=2011-10-01&Signature=xxxXXXXXXXXXXXXXXXXXXXXXXeV18lrxN%2BXXXXXJ%2Bip%2BA%3D |  
 and created another soap ui project2 using below URL.
 
 
 
   
	| Quote: |  
	| http://localhost:7080/Products/2011-10-01?ASINList.ASIN.1=B002GKGL8M&AWSAccessKeyId=XXXXXXXXXXXX&Action=GetCompetitivePricingForASIN&MWSAuthToken=amzn.mws.XXXXXXfe-XXXX-XXXX-XXXX-XXXXXXXXX&MarketplaceId=ATVPDKIKX0DER&SellerId=XXXXXXXXXX&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2015-11-03T03%3A42%3A38Z&Version=2011-10-01&Signature=xxxXXXXXXXXXXXXXXXXXXXXXXeV18lrxN%2BXXXXXJ%2Bip%2BA%3D |  
 Only change between two URL is host name and protocol as highlighted in bold.
 
 Post content is same for both of the URL.
 
 
   
	| Quote: |  
	| POST mws.amazonservices.com
 /Products/2011-10-01
 ASINList.ASIN.1=B002GKGL8M&AWSAccessKeyId=XXXXXXXXXXXX&Action=GetCompetitivePricingForASIN&MWSAuthToken=amzn.mws.XXXXXXfe-XXXX-XXXX-XXXX-XXXXXXXXX&MarketplaceId=ATVPDKIKX0DER&SellerId=XXXXXXXXXX&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2015-11-03T03%3A42%3A38Z&Version=2011-10-01
 |  
 
 I am getting successful response from amazon direct URL (project1). But the URL hitting WMB flow connecting is throwing below exception.
 
 
 
 
   
	| Quote: |  
	| <ErrorResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01"> <Error>
 <Type>Sender</Type>
 <Code>SignatureDoesNotMatch</Code>
 <Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.</Message>
 </Error>
 <RequestID>d2133470-8a47-407a-a683-ea8b65f8fa45</RequestID>
 </ErrorResponse>
 |  
 Note - I have went through the REST ful example using JSON from WMB examples.
 
 But still i could not get what went wrong in this simple flow.
 
 Could you please help me in this.
   
 Thanks in advance!
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | Vitor | 
			  
				|  Posted: Tue Nov 03, 2015 5:24 am    Post subject: Re: REST API call - Amazon AWS integration using WMB 7.0.0.7 |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 11 Nov 2005Posts: 26093
 Location: Texas, USA
 
 | 
			  
				| 
   
	| visasimbu wrote: |  
	| But still i could not get what went wrong in this simple flow. |  
 Seems quite clear:
 
 
 
   
	| visasimbu wrote: |  
	| 
   
	| Code: |  
	| <ErrorResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01"> <Error>
 <Type>Sender</Type>
 <Code>SignatureDoesNotMatch</Code>
 <Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.</Message>
 </Error>
 <RequestID>d2133470-8a47-407a-a683-ea8b65f8fa45</RequestID>
 </ErrorResponse>
 |  |  
 The secret key you're passing to AWS from the flow isn't the one they're expecting. I don't believe this has anything to do with the SSL configuration you're posted, which is used to establish the HTTPS connection with AWS and is presumably right or you'd have got an SSL error.
 
 Check how your flow code is populating that, and also check why you're using a version of broker that's out of support & doesn't have the explicit REST support modern versions do.
 _________________
 Honesty is the best policy.
 Insanity is the best defence.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | visasimbu | 
			  
				|  Posted: Tue Nov 03, 2015 7:23 am    Post subject: Re: REST API call - Amazon AWS integration using WMB 7.0.0.7 |   |  | 
		
		  |  Disciple
 
 
 Joined: 06 Nov 2009Posts: 171
 
 
 | 
			  
				| Thanks for your reply ! 
 
 
   
	| Vitor wrote: |  
	| The secret key you're passing to AWS from the flow isn't the one they're expecting. I don't believe this has anything to do with the SSL configuration you're posted, which is used to establish the HTTPS connection with AWS and is presumably right or you'd have got an SSL error.
 
 Check how your flow code is populating that, and also check why you're using a version of broker that's out of support & doesn't have the explicit REST support modern versions do.
 |  
 
 But as i said flow does not have any logic. It will just hit the amazon URL as like SOAP UI rest project. The request what i have built is valid for 15 mins. I am trying to hit both the URL (flow and SOAP UI direct amazon) url in few seconds interval. But Flow url is not working.
 
 I can understand that there is a difference in the HTTP headers/payload while hitting amazon from WMB flow.
 
 I like to know what is the difference between request sending from flow and request sending from SOAP UI project to amazon. For this i have verified the raw data element in soap ui and replicated the same HTTP header in the flow as well. This option is also not worked.
 
 Apart form this issue, We are in the initial state of migration to IIB10.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mqjeff | 
			  
				|  Posted: Tue Nov 03, 2015 7:30 am    Post subject: |   |  | 
		
		  | Grand Master
 
 
 Joined: 25 Jun 2008Posts: 17447
 
 
 | 
			  
				| You can use wireshark or a TCP/IP Monitor in Toolkit to examine the request being output by the flow - assuming you are running the flow on the same machine as the toolkit. 
 You can also use a Trace node to dump out the message tree just before the request.
 
 But you really should examine how you are building the "Signature=xxxXXXXXXXXXXXXXXXXXXXXXXeV18lrxN" part of the URL, because that's what it looks like Amazon is complaining about.
 _________________
 chmod  -R ugo-wx /
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | Vitor | 
			  
				|  Posted: Tue Nov 03, 2015 8:16 am    Post subject: |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 11 Nov 2005Posts: 26093
 Location: Texas, USA
 
 | 
			  
				| 
   
	| mqjeff wrote: |  
	| But you really should examine how you are building the "Signature=xxxXXXXXXXXXXXXXXXXXXXXXXeV18lrxN" part of the URL, because that's what it looks like Amazon is complaining about. |  
 
  _________________
 Honesty is the best policy.
 Insanity is the best defence.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |