I am trying to setup a new mobile payment solution and am having trouble
testing an xml post request that I need to make to the carrier’s site.
Here’s what I am using to test with right now. Keep in mind I’ve
changed the key to example for security reasons.
I am trying to setup a new mobile payment solution and am having trouble
testing an xml post request that I need to make to the carrier’s site.
Here’s what I am using to test with right now. Keep in mind I’ve
changed the key to example for security reasons.
require ‘net/http’
Try require ‘net/https’, and look in the source code for examples of how
to use it, e.g.
/usr/lib/ruby/1.8/net/https.rb or wherever it is on your system
(If you are on an older version of Debian or Ubuntu which breaks ruby
into shrapnel, then this file is missing by default. You’ll need to
apt-get install another package, I think it’s libopenssl-ruby1.8 or
something like that)
I already switched to net/https and posted the example in my previous
post. I’ll look through the code again, but I thought I was using it
correctly. I’m getting to the page and I’m not getting a forbidden but
its showing a not found.
I tested the lookup page using a manual page they gave me and I’m able
to get to it, just not with the implemented page. So, I’m doing
something wrong - I’m just not sure what.
All of the code I’m using is in my latest gist above or here. I even
supplied what I’m receiving in the gist.
If you click on this link, you’ll see the invalid customer key, which is
fine. If I place the customer key in the right spot and just paste the
URI in a browser, it works perfectly.
So, how can I translate this within the class I posted?
Okay, to make it easier to read, I wrote a simple class including all of
the various pieces, including comments on what I tried, and the return
values.
I updated the latest gist here:
It should be easy to follow. I’m following all of the requirements:
The xml is a post request.
The request parameter is using escaped xml. I even tried not escaping
it.
I’ve noticed that when I printed out the path, their ?method=lookup is
not in the path. So, I tried altering my own path and you’ll see
approx. 6 or 7 different @data variables that I tested trying to mimic
the request. I believe I’ve covered every data scenario I could post.
I cleaned up the ssl bit and again, I have checked everything regarding
net/https, including the examples. Everything should be working, but
it’s not. If I’m missing something I don’t know what it is.
Any help would be appreciated. For anyone that does help, you can still
place “any” key in. If you reach the right page and receive the right
response, you should retrieve a forbidden response. I’m not getting my
true response or a forbidden response.