# Sending a file via XML RPC

**URL:** <https://www.ruby-forum.com/t/sending-a-file-via-xml-rpc/134025>\
**Category:** Ruby\
**Created:** [April 7, 2008, 12:46am UTC](https://www.ruby-forum.com/t/sending-a-file-via-xml-rpc/134025 "2008-04-07T00:46:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![e\_deleflie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/858c86/32.png) [@e\_deleflie](https://www.ruby-forum.com/u/e_deleflie)\
**Post date:** [April 7, 2008, 12:46am UTC](https://www.ruby-forum.com/t/sending-a-file-via-xml-rpc/134025/1 "2008-04-07T00:46:43Z")

</div>

Hi all,

I’m trying to send a file via XML RPC … the below code doesn’t  
work (some HTTP error) and I cant find any samples anywhere on Google  
… can someone shed some light?

@server = XMLRPC::Client.new2(“http://” + @loginName.to\_s + “:” +  
@password.to\_s + “@” + SITE\_URL + “/”)  
file = IO.read(“files/something.txt”)  
result = @server.call(“submitFile”, “first parameter” , “yada yada”,  
file )

---

<div class="post-metadata">

**Author:** ![e\_deleflie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/858c86/32.png) [@e\_deleflie](https://www.ruby-forum.com/u/e_deleflie)\
**Post date:** [April 7, 2008, 1:10am UTC](https://www.ruby-forum.com/t/sending-a-file-via-xml-rpc/134025/2 "2008-04-07T01:10:40Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

e deleflie wrote:  
| Hi all,  
|  
| I’m trying to send a file via XML RPC … the below code doesn’t  
| work (some HTTP error) and I cant find any samples anywhere on Google  
| … can someone shed some light?

And what would that error be?

* * *

Phillip G.  
Twitter: [twitter.com/cynicalryan](http://twitter.com/cynicalryan)

~ - You know you’ve been hacking too long when…  
…in a dream, you are walking down a path (using PostScript’s  
pathforall)  
and get woken up by a closepath.  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.8 (MingW32)  
Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org](http://enigmail.mozdev.org)

iEYEARECAAYFAkf5WEMACgkQbtAgaoJTgL8EtACfWXdfd1Wn4Cch1nZreqedNHny  
gB0AniRnWo2BAWEjBo6NgpsnT9xobPT3  
=3cbC  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![e\_deleflie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/858c86/32.png) [@e\_deleflie](https://www.ruby-forum.com/u/e_deleflie)\
**Post date:** [April 7, 2008, 4:45am UTC](https://www.ruby-forum.com/t/sending-a-file-via-xml-rpc/134025/3 "2008-04-07T04:45:51Z")

</div>

> e deleflie wrote:  
> | Hi all,  
> |  
> | I’m trying to send a file via XML RPC … the below code doesn’t  
> | work (some HTTP error) and I cant find any samples anywhere on Google  
> | … can someone shed some light?
> 
> And what would that error be?

HTTP-Error: 500 Internal Server Error

I suspect that the error is irrelevant, because I have no idea how to  
pass a file in an XML RPC request … and the error was generated  
from a wild guess (which is the code repeated below).

@server = XMLRPC::Client.new2(“http://” + @loginName.to\_s + “:” +  
@password.to\_s + “@” + SITE\_URL + “/”)  
file = IO.read(“files/something.txt”)  
result = @server.call(“submitFile”, “first parameter” , “yada yada”,  
file )

Etienne

---

<div class="post-metadata">

**Author:** ![e\_deleflie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/858c86/32.png) [@e\_deleflie](https://www.ruby-forum.com/u/e_deleflie)\
**Post date:** [April 7, 2008, 2:32pm UTC](https://www.ruby-forum.com/t/sending-a-file-via-xml-rpc/134025/4 "2008-04-07T14:32:23Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

e deleflie wrote:  
|\> e deleflie wrote:  
|\> | Hi all,  
|\> |  
|\> | I’m trying to send a file via XML RPC … the below code doesn’t  
|\> | work (some HTTP error) and I cant find any samples anywhere on Google  
|\> | … can someone shed some light?  
|\>  
|\> And what would that error be?  
|  
| HTTP-Error: 500 Internal Server Error

This is somewhat of a generic, catch-all error. Usually means that the  
server isn’t configured properly, or has troubles connecting to a  
database or somesuch thing.

If you have access to the server, you could check its logs.

* * *

Phillip G.  
Twitter: [twitter.com/cynicalryan](http://twitter.com/cynicalryan)

Watch out for off-by-one errors.  
~ - The Elements of Programming Style (Kernighan & Plaugher)  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.8 (MingW32)  
Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org](http://enigmail.mozdev.org)

iEYEARECAAYFAkf6FBgACgkQbtAgaoJTgL+QEACcDRJ/jXHvw3W69wkcZupgoqDV  
CdwAni7uQiwOw1r/peG0dEvJ/SrmDl9m  
=n7Nb  
-----END PGP SIGNATURE-----
