I've a special problem. I've a BSP for uploading files from Windows XP-Clients. The file should be transferred to a .NET web service where the file is written to disc (1:1, means the binary is written like it is to disc). The transfer from the file to the web service must be in base64.
My problem is, that the web service write a file with exact the same size as the file I uploaded, but I couldnt read the file correctly. Only text files (.csv, .txt, ...) works correctly. I compared the uploaded file with the written file and there are some characters which could not converted in ABAP (hex 23 instead of the correct char). So I think I've a problem with the codepages.
I use a Unicode WAS 6.20 with UTF-8.
Please see my code:
************
Layout *
************
<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>
<%@ extension name="xhtmlb" prefix="xhtmlb" %>
<htmlb:content design="design2003">
<htmlb:page title = "Testupload">
<htmlb:form method= "post"
encodingType = "multipart/form-data"
id = "FRM_Pflege">
<htmlb:fileUpload id = "and"
size = "40" />
<htmlb:button id = "file_upload_and"/>
</htmlb:form>
</htmlb:page>
</htmlb:content>
**************************
oninputprocessing *
**************************
here you see an extract from my code.
the myfile64 will be transfered to the web service
************************************************************
CASE event->server_event.
WHEN 'file_upload_and'.
TRY.
fileupload ?= cl_htmlb_manager=>get_data(
request = runtime->server->request
name = 'fileUpload'
id = 'and').
IF fileupload IS NOT INITIAL.
name = fileupload->file_name.
content = fileupload->file_content.
length = fileupload->file_length.
content_type = fileupload->file_content_type.
ENDIF.
conv = cl_abap_conv_in_ce=>create(
encoding = '1160'
endian = 'L'
input = fileupload->file_content ).
conv->read( IMPORTING data = input_string len = len ).
CREATE OBJECT obj.
CALL METHOD obj->encode_base64
EXPORTING
unencoded = input_string
RECEIVING
encoded = myfile64.
CLEAR wf_string .
************************************
the string myfile64 will be used for sending to the webservice