Hey we are using ole for all our webservice stuff, here is an example for our File Upload. We still getting some errors from the filereadex function. But for the most files everything is fine. Pro Tip of the day: Use a lot try catch if you work with the powerbuilder file functions and ole xmlhttp :)
choose case FileEncoding(gs_ablage_path + is_ablage)
case EncodingANSI!
li_filenum = fileopen(gs_ablage_path + is_ablage, StreamMode!, Read!, LockWrite!, Append!, EncodingANSI!)
case EncodingUTF8!
li_filenum = fileopen(gs_ablage_path + is_ablage, StreamMode!, Read!, LockWrite!, Append!, EncodingUTF8!)
case EncodingUTF16LE!
li_filenum = fileopen(gs_ablage_path + is_ablage, StreamMode!, Read!, LockWrite!, Append!, EncodingUTF16LE!)
case EncodingUTF16BE!
li_filenum = fileopen(gs_ablage_path + is_ablage, StreamMode!, Read!, LockWrite!, Append!, EncodingUTF16BE!)
case else
li_filenum = fileopen(gs_ablage_path + is_ablage, StreamMode!, Read!, LockWrite!)
end choose
if li_filenum = -1 then
iou_kundenportal.uf_log(il_person_pers_id , '', 'Interner Fehler: fileopen fehlgeschlagen (Dokument konnten nicht gelesen werden)', '', '', 1, this.classname( ) + ' uf_post')
return -2
end if
if filereadex(li_filenum, lb_file) = -1 then
iou_kundenportal.uf_log(il_person_pers_id , '', 'Interner Fehler: filereadex fehlgeschlagen (Dokument konnten nicht gelesen werden)', '', '', 1, this.classname( ) + ' uf_post')
return -2
end if
if fileclose(li_filenum) = -1 then
iou_kundenportal.uf_log(il_person_pers_id , '', 'Interner Fehler: fileclose fehlgeschlagen (Dokument konnten nicht gelesen werden)', '', '', 1, this.classname( ) + ' uf_post')
return -2
end if
ls_adress = iou_kundenportal.is_kundenportal_domain + 'kundenportal/api/dokument_file/' + string(il_kundenportal_id)
lole_xmlhttp.open("PUT", ls_adress, false)
lole_xmlhttp.setRequestHeader("Authorization", "Token " + ls_token )
lole_xmlhttp.setRequestHeader("Content-Type", "*/*; charset=utf-8" )
lole_xmlhttp.setRequestHeader("Content-Disposition","attachment; filename=" + toolbox.uf_cleanfilename(extractfilename(is_ablage)))
lole_xmlhttp.setRequestHeader("Content-Length", string(len(lb_file)) )
lole_xmlhttp.send(lb_file)
ls_response = lole_xmlhttp.responsetext
choose case lole_xmlhttp.status
Thanks for your response.
a) I would really like to avoid FTP because it implies eventual firewall configurations, traffic limitations of some ISP's, etc.
b) The client will be installed on several servers (in different locations) and it will upload some compressed txt files to the Web Service located in a cloud server. Then, the Web Service will extract this files and load them to a database to do some proccessing. There is no connection other than that between client and WS.
Some ideas ?
Best regards.
__________________
Julián Tagarro
NeoSistemas SRL
However, since small files work - why the question?
Is performance an issue or file size limitation?
Hard to believe there is no way out.
Thanks anyway Chris.
Regards