Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7195861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:39:55+00:00 2026-05-28T20:39:55+00:00

I’m afraid I’ve not got much experience with posting documents (e.g. XML) over web-servers,

  • 0

I’m afraid I’ve not got much experience with posting documents (e.g. XML) over web-servers, so I apologise if my understanding of HTTP is lacking.

I have a basic Mongrel web server set up in a ruby app on 127.0.0.1 port 2000. (The server).

I am running a separate Ruby app on the same computer. (The client).

I need the client to POST an XML document to the server.

I have tried using Net::HTTP to do this, but I can’t find a clear example which tells me what I should do.
I’ve had a go, but encountered errors. I have broken the request down to make it as basic as possible:

http = Net::HTTP.new("127.0.0.1", 2000)
http.post('file', 'query=foo') #xc.rb line 6

but it results in the following error

    C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:141:in `read_nonblock': An existing connection was forcibly closed by the remote host. (Errno::ECONNRESET)
    from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:141:in `rbuf_fill'
    from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
    from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line'
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2551:in `read_new'
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_request'
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1293:in `request'
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1286:in `block in request'
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:745:in `start'
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1284:in `request'
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1307:in `send_entity'
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1096:in `post'
    from W:/Ruby/A/xc.rb:6:in `<main>'

I imagine I’m doing it totally wrong. Please can you give me an example (or point me to a tutorial) that should allow me to post some basic data, like "<tag1>text</tag1>". Hopefully, I will then be able to work out setting the appropriate headers and handling the response.

Also, I don’t need to use net/http; any free method that doesn’t come with extra commercial-use licencing restrictions is fine.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T20:39:56+00:00Added an answer on May 28, 2026 at 8:39 pm

    This is incredibly easy, when using the rest-client gem

    require 'rest-client'
    
    response = RestClient.post "http://127.0.0.1:2000", "<tag1>text</tag1>", :content_type => "text/xml"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
Seemingly simple, but I cannot find anything relevant on the web. What is the
i got an object with contents of html markup in it, for example: string
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.