Issue with handling xml post request within rails

I’m in the process of building a class for Zong mobile payments with my
rails site. I’ve created a GIST that houses everything related to this
issue. Please look it over here:

In the gist, the following holds true:

zong.rb houses the ruby class I’ve been trying to implement. In the
class I’ve supplied notes on what I’ve tried, and also I’ve posted the
responses received at the bottom of that file.

zongrequirements.txt houses the requirements that zong requires to
access this xml points page. It is necessary to access this page
because the page may change every 3 hours, so I have to cache it later

Last, zongreturn_expected.xml is an example xml that should be returned
once the xml post request has been successful.

Current Issues:

Currently, I’m unable to receive a correct response. The main response
is that the resource isn’t found. Even if my customer key were
incorrect, if I did receive a correct response, it should say forbidden.
So, something in my code is not working right.

I’ve gone through all of the net/https codes and examples and searched
dilligently to find a solution. I’m at a loss for what I’m doing wrong.
I have not worked with a lot of xml post requests or xml requests in
general, so this is something very new to me. However, I believe I’ve
implemented what I have read fine. Perhaps there is something more that
needs to be added.

If anyone tests this, you won’t need a customer key. You can supply
anything as once it is successful, you should be receiving a forbidden
page. At that point, I can supply the correct key. I’ve tried using
the class I created with the correct customer key and without a generic
customer key.

Any assistance would be appreciated.

Okay here’s a great example of the full URI string that works to achieve
the result I’m looking for:<?xml%20version="1.0"%20encoding="UTF-8"?> <requestMobilePaymentProcessEntrypoints%20xmlns=""%20xmlns:xsi=""%20xsi:schemaLocation=""> %20%20<customerKey>sometestkey</customerKey> %20%20<countryCode>US</countryCode> %20%20<items%20currency="USD"%20/> </requestMobilePaymentProcessEntrypoints>

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?

The breakdown is:

Request is (&request=[escaped xml string])

I figured it out myself.

All of my code was perfect except one piece:

#response =, @data, @headers)
response =, @data)

The @headers were causing the issue. Once I removed @headers everything
worked fine.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs