WsUpload

Neste exemplo foi utilizado o SOAPpy.

Servidor

   1 #!/usr/bin/env python
   2 # -*- coding: iso-8859-1 -*-
   3 import sys
   4 import os
   5 
   6 from SOAPpy import *
   7 
   8 def upload_file(file, name):
   9         out = open(name,'wb')
  10         out.write(str(file.decode('base64')))
  11         out.close()
  12     
  13 server = SOAPServer(('localhost',8080))
  14 server.registerFunction(upload_file)
  15 server.serve_forever()

Cliente

   1 #!/usr/bin/env python
   2 # -*- coding: iso-8859-1 -*-
   3 from SOAPpy import *
   4 import os
   5 server = SOAPProxy('http://localhost:8080')
   6 file_name = 'upf.zip'
   7 file=open(file_name, 'rb')
   8 data=file.read()
   9 server.upload_file(data.encode('base64'), file_name)
  10 file.close()

WsUpload (editada pela última vez em 2009-12-24 06:39:34 por newacct)