XMLRPC Binary Transfer
Frank H <[email protected]> Wed, 21 Jan 2009 09:34:09 -1000
| Newsgroups | gmane.comp.php.xml-rpc |
|---|---|
| Message-ID | <[email protected]> |
--===============1145448554==
Content-Type: multipart/alternative;
boundary="_b825f629-d6ae-4dd8-8eb9-eb1d104eac33_"
--_b825f629-d6ae-4dd8-8eb9-eb1d104eac33_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Hi all=2C
I am trying to create a function that allows me to send binary files from a=
client and have the server write it into a directory.
I have it working right now=2C but it errors when I try to send a file grea=
ter then about 300 Kb. Any file under that size will
transfer just fine.
Here is the function I have on the server...
function upload_file2($m)
{
$param1 =3D $m->getParam(0)=3B
$write_file =3D $param1->scalarval()=3B
$convert_file =3D fopen($write_file=2C "rb")=3B
$param2 =3D $m->getParam(1)=3B
$file_name =3D $param2->scalarval()=3B
$test_write =3D fopen("/tmp/".$file_name=2C "w")=3B
fwrite($test_write=2C $write_file)=3B
fclose($test_write)=3B
return new xmlrpcresp(new xmlrpcval($file_name))=3B
}
$upload_file2_sig =3D array(array($xmlrpcBase64=2C$xmlrpcBase64=2C $xmlrpcS=
tring))=3B
$upload_file2_doc =3D 'uploads a binary file'=3B
I am using a Python client to send the file. I was playing around with a P=
ython server to transfer files and the Python
server does not run into any problems with file size.
This is what I have on the python client...
import xmlrpclib
print("Trying to connect...")
server_url =3D 'http://some_url/new_server.php'=3B
server =3D xmlrpclib.Server(server_url)=3B
handle =3D open("nova.bmp")
file_name =3D "fetch_nova.bmp"
send_file =3D server.sendFile(xmlrpclib.Binary(handle.read())=2C file_name)
This is the error I get when trying to use the Python Client/Php Server com=
bo
Trying to connect...
Traceback (most recent call last):
File "testProc_client.py"=2C line 20=2C in ?
send_file =3D server.sendFile(xmlrpclib.Binary(handle.read())=2C file_n=
ame)
File "/usr/lib/python2.3/xmlrpclib.py"=2C line 1029=2C in __call__
return self.__send(self.__name=2C args)
File "/usr/lib/python2.3/xmlrpclib.py"=2C line 1316=2C in __request
verbose=3Dself.__verbose
File "/usr/lib/python2.3/xmlrpclib.py"=2C line 1070=2C in request
headers
xmlrpclib.ProtocolError: <ProtocolError for mmodev.jpl.nasa.gov/frank/xmlrp=
c/demo/server/new_server.php: -1 >
Any help would be greatly appreciated.
Thanks!
-Frank
_________________________________________________________________
Windows Live=99 Hotmail=AE:=85more than just e-mail.=20
http://windowslive.com/explore?ocid=3DTXT_TAGLM_WL_t2_hm_justgotbetter_expl=
ore_012009=
--_b825f629-d6ae-4dd8-8eb9-eb1d104eac33_
Content-Type: text/html; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<style>
.hmmessage P
{
margin:0px=3B
padding:0px
}
body.hmmessage
{
font-size: 10pt=3B
font-family:Verdana
}
</style>
</head>
<body class=3D'hmmessage'>
Hi all=2C<br><br>I am trying to create a function that allows me to send bi=
nary files from a client and have the server write it into a directory.<br>=
I have it working right now=2C but it errors when I try to send a file grea=
ter then about 300 Kb. =3B Any file under that size will<br>transfer ju=
st fine.<br><br><br><br>Here is the function I have on the server...<br><br=
>function upload_file2($m)<br>{<br> =3B =3B =3B $param1 =3D $m-=
>=3BgetParam(0)=3B<br> =3B =3B =3B $write_file =3D $param1-&g=
t=3Bscalarval()=3B<br> =3B =3B =3B $convert_file =3D fopen($wri=
te_file=2C "rb")=3B<br><br> =3B =3B =3B $param2 =3D $m->=3Bge=
tParam(1)=3B<br> =3B =3B =3B $file_name =3D $param2->=3Bscala=
rval()=3B<br><br> =3B =3B =3B $test_write =3D fopen("/tmp/".$fi=
le_name=2C "w")=3B<br> =3B =3B =3B fwrite($test_write=2C $write=
_file)=3B<br> =3B =3B =3B fclose($test_write)=3B<br><br> =
=3B =3B =3B return new xmlrpcresp(new xmlrpcval($file_name))=3B<br>=
}<br><br>$upload_file2_sig =3D array(array($xmlrpcBase64=2C$xmlrpcBase64=2C=
$xmlrpcString))=3B<br>$upload_file2_doc =3D 'uploads a binary file'=3B<br>=
<br><br><br>I am using a Python client to send the file. =3B I was play=
ing around with a Python server to transfer files and the Python<br>server =
does not run into any problems with file size.<br><br>This is what I have o=
n the python client...<br><br>import xmlrpclib<br><br>print("Trying to conn=
ect...")<br>server_url =3D 'http://some_url/new_server.php'=3B<br>server =
=3D xmlrpclib.Server(server_url)=3B<br><br>handle =3D open("nova.bmp")<br>f=
ile_name =3D "fetch_nova.bmp"<br>send_file =3D server.sendFile(xmlrpclib.Bi=
nary(handle.read())=2C file_name)<br><br><br>This is the error I get when t=
rying to use the Python Client/Php Server combo<br><br>Trying to connect...=
<br>Traceback (most recent call last):<br> =3B File "testProc_client.py=
"=2C line 20=2C in ?<br> =3B =3B =3B send_file =3D server.sendF=
ile(xmlrpclib.Binary(handle.read())=2C file_name)<br> =3B File "/usr/li=
b/python2.3/xmlrpclib.py"=2C line 1029=2C in __call__<br> =3B =3B&n=
bsp=3B return self.__send(self.__name=2C args)<br> =3B File "/usr/lib/p=
ython2.3/xmlrpclib.py"=2C line 1316=2C in __request<br> =3B =3B&nbs=
p=3B verbose=3Dself.__verbose<br> =3B File "/usr/lib/python2.3/xmlrpcli=
b.py"=2C line 1070=2C in request<br> =3B =3B =3B headers<br>xml=
rpclib.ProtocolError: <=3BProtocolError for mmodev.jpl.nasa.gov/frank/xml=
rpc/demo/server/new_server.php: -1 >=3B<br><br><br>Any help would be grea=
tly appreciated.<br>Thanks!<br><br>-Frank<br><br><br /><hr />Windows Live=
=99 Hotmail=AE:=85more than just e-mail. <a href=3D'http://windowslive.com=
/explore?ocid=3DTXT_TAGLM_WL_t2_hm_justgotbetter_explore_012009' target=3D'=
_new'>Check it out.</a></body>
</html>=
--_b825f629-d6ae-4dd8-8eb9-eb1d104eac33_--
--===============1145448554==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
phpxmlrpc mailing list
[email protected]
http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc
--===============1145448554==--