# Posting XML to remote Web Service

**URL:** <https://www.ruby-forum.com/t/posting-xml-to-remote-web-service/143463>\
**Category:** Rails\
**Created:** [July 18, 2008, 9:44pm UTC](https://www.ruby-forum.com/t/posting-xml-to-remote-web-service/143463 "2008-07-18T21:44:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CTOguy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@CTOguy](https://www.ruby-forum.com/u/CTOguy)\
**Post date:** [July 18, 2008, 9:44pm UTC](https://www.ruby-forum.com/t/posting-xml-to-remote-web-service/143463/1 "2008-07-18T21:44:22Z")

</div>

I have succeeded in building an XML document using Builder template  
which I would like to post to  
a remote service for credit card processing by doing an xml render  
with a controller. What’s the best way  
to grab this XML and send it off via an HTTP POST to the remote  
endpoint?

Thanks,  
Steve

---

<div class="post-metadata">

**Author:** ![CTOguy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@CTOguy](https://www.ruby-forum.com/u/CTOguy)\
**Post date:** [July 18, 2008, 11:38pm UTC](https://www.ruby-forum.com/t/posting-xml-to-remote-web-service/143463/2 "2008-07-18T23:38:04Z")

</div>

On Jul 18, 8:36 pm, CTOguy [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have succeeded in building an XML document using Builder template  
> which I would like to post to  
> a remote service for credit card processing by doing an xml render  
> with a controller. What’s the best way  
> to grab this XML and send it off via an HTTP POST to the remote  
> endpoint?

Well it’s easy enough to get a string containing the xml (eg use  
the :target option when you create the builder or the target! method  
afterwards).  
Then use Net::HTTP to post the data.

Fred
