Thank you in advance for any and all help.
I've been having a ridiculous issue with trying to get my rails 4 app to take in data from an email parsing API that sends an XML response to a specified url within my application. For whatever reason I can't seem to find, the data is not getting into my application via the HTTP Post from the API.
When I test out using requestb.in and Advanced Rest Client everything works great, however when I try to send the data to my app, no dice. I'm currently sending to my dev branch via Pow.cx so it has a specific url to send to. I've been testing using google's Advanced Rest Client and requestb.in and using requestbin I've had no problem getting the data to show up on Advanced Rest Client, however it will not get into my App. Any help will be super appreciated. Thank you!!
My Routes:
get 'worldmate/receive', to: 'worldmate#receive'
post 'worldmate/receive', to: 'worldmate#receive'
In My Controller:
require 'nokogiri'
require 'net/http'
require 'open-uri'
require 'json'
class WorldmateController < ActionController::Base
def receive
@request = request
@xml = @request.body
@string = @request.body.read
@size = @request.body.size
end
My erb:
<p> Request: <%= @string %> <p>
<br>
<p> Less Detailed Request: <%= @xml %> </p>
<br>
<p> Size: <%= @size %> </p>
I have no idea why my app isn't taking this data in. When I send a post request using Advanced Rest Client it works totally fine. Any and all help is SUPER appreciated. Many thanks.
My guess is that you have configured your email parsing service to POST the data to a URL which is only accessible from your local system, for instance a pow.cx style ".dev" URL.
The reason this works using your test utility is I'm assuming the test client is also on your local machine and therefore your local server is addressable from there.
The way I've worked around this is using tunneling. Ngrok is a nice, low-config tool for tunneling, but there are many solutions out there to make your local dev environment accessible from the web for testing purposes.