Hello Gurus,
I am struggling with an error using a proxy consumer service from ABAP. The proxy was generated using the WSDL from the web service provider. For a specific method we need to send a rawstring as seen bellow:
The file to be sent on this call is a ZIP file XAdES-BES signed and on BASE64. I’ve implemented the proper code to get the original file from local PC, and convert it to BASE64 before moving the content to the webservice structure and call the service proxy. At SOAMANAGER I also configured the webservice and the proper port with the WSDL:
The communication is working properly but my problem is with the binary content. When calling the webservice the response is that the structure of the file is wrong. I found it very strange since I used a tiny SOAPUI project with the same WSDL and it worked with no problem.
After debugging I could see that the content moved to the rawdata string before calling the proxy does not match the content that I can see from the call payload on web services util (srt_util)!
So the sample code for my method:
* get the file from the specified folder
call function 'GUI_UPLOAD'
exporting
filename = ld_zipfilename
filetype = 'BIN'
importing
filelength = zip_size
tables
data_tab = t_zip_data[]
exceptions
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17.
* convert to string
clear buffer_zip.
call function 'SCMS_BINARY_TO_STRING'
exporting
input_length = zip_size
importing
text_buffer = buffer_string
tables
binary_tab = t_zip_data[]
exceptions
failed = 1
others = 2.
* encode base 64
perform encode_base64 using buffer_string
buffer_zip.
form encode_base64 using in_string type string
out_string type xstring.
data: l_sbuff type string.
* convert the file to BASE64
call method cl_http_utility=>encode_base64
exporting
unencoded = in_string
receiving
encoded = l_sbuff.
call function 'SCMS_STRING_TO_XSTRING'
exporting
text = l_sbuff
importing
buffer = out_string
exceptions
failed = 1
others = 2.
endform. "encode_base64
calling the webservice:
l_input-xxxx-dokument = buffer_zip.
try.
call method l_proxy_test->webservice
exporting
input = l_input
importing
output = l_output.
catch cx_ai_soap_fault into lr_exc_soap_fault.
endtry.
From my understanding rawstring should be the same as ABAP xstring. If I debug the program and check the content of the l_input-dokument before calling the proxy I get binary content: “Izw/eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9InV0Zi04Ij8…” that is in fact correct
If I check the payload after call I can see that the binary content sent on the XML is not the same, in fact it is totally different: ”SXp3L2VHMXNJSFpsY25OcGIyNDlJakV1TUNJZ1pXNWpiMlJw…” !!
I’ve tried a lot of different conversions, changed configuration on the communication, port, etc and nothing seems to work. I really can’t figure out why the binary content on the call is not the same as I move to the webservice structure.
If I use the project from SOAP UI and send the proper binary content, that is “Izw/eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9InV0Zi04Ij8…” it works perfectly and the response is successfully.
Anyone has a clue what could be causing this?
Appreciate any kind of input.
Regards,
João Silva Pinto.