maheshwarirohit87 / typica

Automatically exported from code.google.com/p/typica
Apache License 2.0
0 stars 0 forks source link

Allow to use Typica with M/DB #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to connect to an M/DB instance with : 
new SimpleDB("aws-local", "1234567", false, "192.168.0.11/mdb/request.mgwsi")

2. call listDomains 

What is the expected output? What do you see instead?

The created request URL is malformed : 
http://192.168.0.11/mdb/request.mgwsi:80/?AWSAccessKeyId=aws-local&Action=ListDo
mains&MaxNumberOfDomains=10&SignatureMethod=HmacSHA256&SignatureVersion=2&Timest
amp=2009-07-14T17%3A28%3A09Z&Version=2007-11-07&Signature=oNKb7Ztpdc4xHa7vo5tc7z
08uZyCYx9cxzSMYesNLDQ%3D

I've tried to patch SimplDB class to remove the port from the url but M/DB
rejects the signature

What version of the product are you using? On what operating system?

typica 1.5.2a
M/DB Virtual Appliance (Free Open Source Build 25)
Java 1.6

Original issue reported on code.google.com by dev.mont...@gmail.com on 14 Jul 2009 at 5:32

GoogleCodeExporter commented 9 years ago
The best thing is to put M/DB into "trace mode" as follows:

- Fire up a Linux Terminal session or start a puTTY session and point it at the 
M/DB
VM (eg at 192.168.0.11)

- Log in using username=ewd password=1234567  (or whatever your M/DB system's
username/password is)

- type the following:

cd /usr/local/gtm/ewd
$gtm

You should now get the GTM prompt, ie:

GTM>

Now type:

s ^zewd("trace")=1

and hit Enter

This has set trace mode on.

Now re-run your MDB request from your client and wait till you get the response.

In your Terminal/puTTY session (at the GTM> prompt), type

zwr ^%zewdTrace

and let me know what it reports - this is a trace report that will confirm the 
string
to sign as determined by M/DB and compare the signature it generated with the 
one you
generated.  Ideally post the trace report into the M/DB Google Group which I 
monitor
all the time.

Tidy everything up by typing (at  the GTM> prompt):

s ^zewd("trace")=0
k ^%zewdTrace
h

You should now be back to the Linux shell.

Rob 

Original comment by rob.tw...@gmail.com on 25 Jul 2009 at 7:05

GoogleCodeExporter commented 9 years ago
I will try that with my patch but the main problem remains : Typica can not 
handle
endpoint URL with a path part. Look at the port part in the generated request 
URL in
my report.

Original comment by dev.mont...@gmail.com on 25 Jul 2009 at 1:46

GoogleCodeExporter commented 9 years ago
I'm afraid I can't do anything about that in M/DB! :-)

You could perhaps remap the URL in Apache on the M/DB Virtual Appliance, eg 
using
mod_rewrite, so you can address M/DB via an un-pathed URL from Typica.  
Alternatively
someone needs to modify Typica methinks...

Original comment by rob.tw...@gmail.com on 25 Jul 2009 at 2:52

GoogleCodeExporter commented 9 years ago
Where would you place the .htaccess file in order to implement the mod_rewrite 
in the
M/DB appliance?  I'm not that familiar with the file structure it uses for 
Apache. 
Thanks for your help.

Original comment by philip.j...@gmail.com on 27 Jul 2009 at 3:59

GoogleCodeExporter commented 9 years ago
If you're using the M/DB Virtual Appliance, you'll find that mod_rewrite is 
already
enabled.  Take a look in /etc/apache2/sites-available/default and you'll see 
there's
already a rewrite rule included, so just append your rule there and restart 
apache
(/etc/init.d/apache2 restart)

Original comment by rob.tw...@gmail.com on 27 Jul 2009 at 4:27

GoogleCodeExporter commented 9 years ago
Thanks for the info, however when I added the rule and test in the browser I 
always
get redirected to /ewd/mdb/index.mgwsi?.  Below is my rule:

^[^/mdb]/?(.*)$ /mdb/request.mgwsi$2 [R,L,PT,e=HTTP_CGI_AUTHORIZATION:%1]

I also tried:

^[^/mdb]/?(.*)$ /mdb/request.mgwsi$2 [R,L]

I am no Apache expert, as you can probably tell.  I am used to working with 
Tomcat
only.  You have been very helpful and patient.  Thank you for your help thus 
far.

Original comment by philip.j...@gmail.com on 27 Jul 2009 at 5:50

GoogleCodeExporter commented 9 years ago
Try

RewriteRule ^/xmdb(.*) /mdb/request.mgwsi$2 [PT]

Works for me:

http://192.168.1.113/xmdb?Action=Initialise

<Response>
<Errors>
<Error>
<Code>InvalidAction</Code>
<Message>M DB has already been initialised</Message>
<BoxUsage>0</BoxUsage>
</Error>
</Errors>
<RequestId>d8df6ec4-5682-45c3-5664-8e542bc790b2</RequestId>
</Response>

..which shows that it's correctly redirecting into the M/DB back-end system.

Try to avoid using /mdb itself as the triggering path because this is already 
used by
the m_apache gateway, as defined in the stuff you'll see above the mod_redirect
stuff, ie:

<Location /mdb>
  SetEnv MGWSI_M_UCI /usr/local/gtm/ewd/mumps.gld
  SetEnv MGWSI_M_FUNCTION mgwsiResponse^MDB
</Location>

Hence I'm suggesting using something different such as xmdb/ so it doesn't get 
confused.

Hope this helps

Rob

Original comment by rob.tw...@gmail.com on 29 Jul 2009 at 6:53

GoogleCodeExporter commented 9 years ago
Just a quick note.  Hopefully it's obvious, but if you do redirect in this way,
remember you'll have to change your "string to sign" logic appropriately using 
the
original rather than the rewritten URL path, eg:

GET
192.168.1.113
/xmdb
Action=GetVersion&AWSAccessKeyId=rob&SignatureMethod=HmacSHA1&SignatureVersion=2
&Timestamp=2009-07-29T07%3A59%3A08&Version=2009-04-15&db=mdbx

Apache passes the original path details to the back end, rather than the 
rewritten
URL information which is what you'd want/expect.

Original comment by rob.tw...@gmail.com on 29 Jul 2009 at 7:06

GoogleCodeExporter commented 9 years ago
One more follow up.  The rewrite rule should probably be written

RewriteRule ^/xmdb(.*) /mdb/request.mgwsi$1 [PT]

although the version I orginally posted with $2:

RewriteRule ^/xmdb(.*) /mdb/request.mgwsi$2 [PT]

seemed to work OK for me too.

Original comment by rob.tw...@gmail.com on 29 Jul 2009 at 7:10

GoogleCodeExporter commented 9 years ago
BTW, I added a method on the AWSConnection called setResourcePrefix() which 
allows you to specify a string 
that comes after the port, but before the rest of the request. I've been using 
this to talk to a Eucalyptus cluster. I 
hope it fixes this as well. Could someone please test and let me know?

Original comment by dkavan...@gmail.com on 16 Aug 2009 at 2:13

GoogleCodeExporter commented 9 years ago
It's been a while since 1.6 went out with this fix. I hope it addressed the 
problem for you! If not, feel free to open 
another issue. Better yet, if there was an M/DB endpoint for me to use for 
testing this.

Original comment by dkavan...@gmail.com on 13 Oct 2009 at 12:27

GoogleCodeExporter commented 9 years ago
Hello 

I would like to use typica to access my simpledb clone MD/B

So If I wanted to use typica to access my MD/B simpledb clone with a IP of
192.168.1.2 I would do the following: SimpleDB db = new SimpleDB(awsAccessKey,
awsSecretKey, false, "192.168.1.2", 80, resourcePrefix = "/mdb/request.mgwsi?") 
Is
this correct?
Thanks

Original comment by allhelle...@gmail.com on 18 Feb 2010 at 11:39