xml - rails storing HTTP POST into variable -


i trying build rails app receive http post huge xml payload. goal parse xml , store parts of content database. first goal able store xml contents variable , parse variable line line. q&a available here, able use below code receive http post.

the problem rails app spitting xml content right browser. want rails app receive xml, store , return 200 ok browser now. how can done?

routes

post '/request' => 'application#receives_data' 

controller

def receives_data   myxmlpost = render :text => request.raw_post end 

when try following code

def receives_data   myxmlpost = request.raw_post end 

i error in development.log

actionview::missingtemplate (missing template application/receives_data {:locale=>[:en], :formats=>[:html, :text, :js, :css, :ics, :csv, :vcf, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. searched in: * "/opt/rails/cch/app/views"

thanks reading

 render :text => request.raw_post 

this part says "render text raw xml post browser" - if want not render xml - don't have line.

if want render 200, render 200. can header-only render

head :success 

so:

def receives_data   myxmlpost = request.raw_post   head :success end 

"creating xml" exercise i'll leave reader (that's you)... it's pretty standard part of rails, means covered standard tutorials on rails.... suggest research on google rails tutorials involve xml eg "rails tutorials xml"


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -