There is a Web Service that is running in an external system. The Web Service expects an XML file which is Base64 encoded.
In my ABAP program, I have the XML that I want to post to the Web Service in a XSTRING variable.
The issue here is that the Base64 version of a string and a file which contains the the same string is inherently different.
The most direct solution that I know is to write the string to a file and then convert the file into Base64 and post it to the Web Service. The problem here is that the XML string that I have to too sensitive to be stored in the file system even temporarily.
So my question:
Is there a way to create a file during runtime in memory, add the XML that I have into that file in memory and finally convert it to a Base64 string, all during the runtime without ever using the actual file system.
DATA: lv_xstring TYPE xstring.
xstring = '<document>some xml data</document>'.
xstring --> into a file in memory --> convert to a Base64 string
You can directly convert string or xstring to base64 in ABAP. Check SCMS_BASE64_ENCODE_STR FM for xtsring to base64 string conversition.
On the other hand, generally binary data (xstring) transport as base64 encoded string in SOAP body. So may be you don't need to convert it to base64, just convert xml to xstring then assign it to method parameter.
Related
I'm trying to decode a string which is encoded using LZX algorithm with a LZX window size of 2 megabytes (binary) and then converted to base64.
I'm receiving this string in response from Microsoft's Update API (GetUpdateData).
As per Microsoft documentation for the lzx/lz77 algorithm, the XmlUpdateBlobCompressed field is:
compressed using a LZX variant of the Lempel-Ziv compression algorithm. The LZX window size used for compressing this field is 2 megabytes.
I tried to decode/decompress the string back to its original XML with no success. I tried the lz_string library (NodeJS/Ruby) and some other libraries but had no success so far.
Here is a sample I'm trying to decode/decompress back to the original XML:
TVNDRgAAAACPIwAAAAAAACwAAAAAAAAAAwEBAAEAAAAAAAAAQQAAAAIAAxVIwwAAAAAAAAAAAAAAAAAAYmxvYgCF1k7pgBgAgFuAgI0MIIQ0QRAABDMDNSMAYAAAaW+qrcgkd7l8ck7bM0VOsi0C+61/XVRtf4SU9i2F0gKBAO2Bv7e37Zu22t50m5yTNmlRiEcikSCfz+5ztUnyzQoR9BaupQIpgBYaiaUIHGOuCNSOXBj5SFWJcDqQuSIAmSGAmgMARjDL0O1rqggvgGaQNgADBjP2RgIHw83o+jG9NdKT1j66rC8nipxrKyXpu7a+U12KV1Y/Lp04nt1ciiLplJP1krgx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jrRdGe6856P4Eybd58uOHiBGmJWvOEbW/ldFXOvAwaXZq+jPQkJUoPkhZSydnYAegnOl7rY077wEOseWitVjnryYV4sh8d1GTi33nddf4fvGbwj1HH4SONsmK0fQcrwPfmy1hxiTXN/J6wwmAo51pjK3jNYBDx2Oi9+JSnwcoHJV4j2f7i1FU7Ibr3caR5po6rNZQ1TFO7Uh4jeO+JA+hkWw7muVAMZ7ITHQ9i6Ay4Ma6M7cKzfebYsnUhqZGPpw9Nx/a7W6NeNXEzZ7Tt6k7g3GTi59IzhO7SYdyl7E+d49BVee/KoxbUu2OMM6stRyAPodbtnRY/ds7dWqyK1SOF6leR98gxL3DHHMR6SvGFD2KO0rZwqZ2M9AXjotJomUg9WVqovPvnZ1FuiAR+tLY52c9hdrkz1JCZz4tLNEtW3q1UauvluOoBWXIfFmJLa7U53qJ3QsXw4MbbpRN/Om7hKN68u1udURZuK4TzqgJYAZ3G0LbnNuo8TmDtHO7ZXylns2nfcbjqCarY7FkL2mxWcXVU81a+IZjurno+rOVm4uPLZPVkNAPJSW6Z81ixzyOdwvujjTVBjkefGzZVufr3YAdxtHp+klnd2TjeOwyoLdZgcBu071fhzb+lenvbFc6XpiHn9wl0S49RxMDktEbbS1kO2huG7MBv//SgtEgFtHeNju6ducFUatT7te62cI0y3jqsPmYddFf7telkjleeq+mLHM+dd+M/G2Nbc13BBFdzxObiwJbPxU/kP62Uqq4zN7dY+bS0iKdG3r31Vc4xoV69dAULH3rxr4wYWgd1Mh6YB5vm7AacMYpk2UK6xcuALsrPJC49282vVLVBLY1cZiitzrTmfOnaOcrOV7RxBAAednIjwwNH2ZwCTO9VNxuBQVQPtAW7OQJjq1T4uj6Wavnni22Xj+My2O4YlTsNREWzgCL2Y2Gbb4GZiifMM2gLNyenuXRdU9TSwIw+RDrfuJyhcGxOpnccp5F/l++Qpu72rOJR7mxphiKYABw==
Has anybody had success doing this?
As added in comment by Dave, it was the cab file which was there in response.
I have saved the cab file & extracted it using libmspack
cab_file_path = "/Users/kalpesh/playground/xml.cab"
cab_file = File.open(cab_file_path, "wb")
# Save Cab file
cab_file.puts Base64.decode64(xml_blob) # xml_blob is the sample which I have given in description
# Extract cab file
blob_xml_path = "/Users/kalpesh/playground/xml_blob.txt"
cab_decompressor = LibMsPack::CabDecompressor.new
cab = cab_decompressor.open(cab_file_path)
cab_decompressor.extract(cab.files, blob_xml_path)
I've got a string variable containing a text that I need to encode and write to a file, in UTF-16LE code page.
Currently the following code generates a UTF-8 file and I don't see any option in the statement OPEN DATASET to generate the file in UTF-16LE.
REPORT zmyprogram.
DATA(filename) = `/tmp/myfile`.
OPEN DATASET filename IN TEXT MODE ENCODING DEFAULT FOR OUTPUT.
TRANSFER 'HELLO WORLD' TO filename.
CLOSE DATASET filename.
I guess one solution is to first encode the string in memory, then write the encoded bytes to the file.
Generally speaking, how to encode a string of characters into a given code page, in memory?
In the first part, I explain how to encode a string of characters into a given code page (all is done in memory), and in the second part, I explain specifically how to write files to the application server in a given code page.
General way (all in memory)
If a string of characters (type STRING) has to be encoded, the result has to be stored in a string of bytes, which corresponds to the built-in data type XSTRING.
There are several possibilities which depend on the ABAP version:
Since 7.53, use the class CL_ABAP_CONV_CODEPAGE:
DATA(xstring) = cl_abap_conv_codepage=>create_out( codepage = `UTF-16LE` )->convert( source = `ABCDE` ).
Since 7.02, use the class CL_ABAP_CODEPAGE:
DATA xstring TYPE xstring.
xstring = cl_abap_codepage=>convert_to( source = `ABCDE` codepage = `UTF-16LE` ).
Before 7.02, use the class CL_ABAP_CONV_OUT_CE (documentation provided with the class):
First, instantiate the conversion object, use a SAP code page number instead of the ISO name (list of values shown hereafter):
DATA: conv TYPE REF TO CL_ABAP_CONV_OUT_CE, xstring TYPE xstring.
conv = CL_ABAP_CONV_OUT_CE=>CREATE( encoding = '4103' ). "4103 = utf-16le
Then encode the string and retrieve the bytes encoded:
conv->RESET( ).
conv->WRITE( data = `ABCDE` ).
xstring = conv->GET_BUFFER( ).
Eventually, instead of using RESET, WRITE and GET_BUFFER, the method CONVERT was added in 6.40 and retroported :
conv->CONVERT( EXPORTING data = `ABCDE` IMPORTING buffer = xstring ).
With the class CL_ABAP_CONV_OUT_CE, you need to use the number of the SAP Code Page, not the ISO name. Here are the most common SAP code pages and their equivalent ISO names:
1100: ISO-8859-1
1101: US-ASCII
1160: Windows-1252 ("ANSI")
1401: ISO-8859-2
4102: UTF-16BE
4103: UTF-16LE
4104: UTF-32BE
4105: UTF-32LE
4110: UTF-8
Etc. (the possible values are defined in the table TCP00A, in lines with column CPATTRKIND = 'H').
Writing a file on the application server in a given code page
In ABAP, OPEN DATASET can directly specify the target code page, most code pages are supported including UTF-8, but not other UTF (code pages 41xx) which can be done only by the solution explained in 2.3 below (by first encoding in memory).
2.1) IN TEXT MODE ENCODING ...
Possible ENCODING values:
UTF-8: in this mode, it's possible to add the Byte Order Mark if needed, via the option WITH BYTE-ORDER MARK.
DEFAULT: will be UTF-8 in a SAP "Unicode" system (that you can check via the menu System > Status > Unicode System Yes/No), NON-UNICODE otherwise.
NON-UNICODE: will depend on the current ABAP linguistic environment; for language English, it's the character encoding iso-8859-1, for language Polish, it's the character encoding iso-8859-2, etc. (the equivalences are shown in table TCP0C.)
Example in ABAP version 7.52 to write to UTF-8 with the byte order mark:
REPORT zmyprogram.
DATA(filename) = `/tmp/dataset_utf_8`.
OPEN DATASET filename IN TEXT MODE ENCODING UTF-8 WITH BYTE-ORDER MARK FOR OUTPUT.
TRY.
TRANSFER `Witaj świecie` TO filename.
CATCH cx_sy_conversion_codepage INTO DATA(lx).
" Character not supported in language code page
ENDTRY.
CLOSE DATASET filename.
Example in ABAP version 7.52 to write to iso-8859-2 (Polish language here):
REPORT zmyprogram.
SET LOCALE LANGUAGE 'L'. " Polish
DATA(filename) = `/tmp/dataset_nonunicode_pl`.
OPEN DATASET filename IN TEXT MODE ENCODING NON-UNICODE FOR OUTPUT.
TRY.
TRANSFER `Witaj świecie` TO filename.
CATCH cx_sy_conversion_codepage INTO DATA(lx).
" Character not supported in language code page
ENDTRY.
CLOSE DATASET filename.
2.2) IN LEGACY TEXT MODE CODE PAGE ...
Use any code page number except code pages 41xx (i.e. UTF-8 and other UTF; see workaround in 2.3 below).
Example in ABAP version 7.52 to write to iso-8859-2 (code page 1401) :
REPORT zmyprogram.
DATA(filename) = `/tmp/dataset_iso_8859_2`.
OPEN DATASET filename IN LEGACY TEXT MODE CODE PAGE '1401' FOR OUTPUT. " iso-8859-2
TRY.
TRANSFER `Witaj świecie` TO filename.
CATCH cx_sy_conversion_codepage INTO DATA(lx).
" Character not supported in language code page
ENDTRY.
CLOSE DATASET filename.
2.3) UTF = general way + IN BINARY MODE
Example in ABAP version 7.52:
REPORT zmyprogram.
TRY.
DATA(xstring) = cl_abap_codepage=>convert_to( source = `Witaj świecie` codepage = `UTF-16LE` ).
CATCH cx_sy_conversion_codepage INTO DATA(lx).
" Character not supported in language code page
BREAK-POINT.
ENDTRY.
DATA(filename) = `/tmp/dataset_utf_16le`.
OPEN DATASET filename IN BINARY MODE FOR OUTPUT.
TRANSFER xstring TO filename.
CLOSE DATASET filename.
I'd like to create a file object from an image located at a specific url. I'm downloading the file with Net Http:
img = Net::HTTP.get_response(URI.parse('https://prium-solutions.com/wp-content/uploads/2016/11/rails-1.png'))
file = File.read(img.body)
However, I get ArgumentError: string contains null byte when trying to read the file and store in into the file variable.
How can I do this without having to store it locally ?
Since File deals with reading from storage, it's really not applicable here. The read method is expecting you to hand it a location to read from, and you're passing in binary data.
If you have a situation where you need to interface with a library that expects an object that is streaming, you can wrap the string body in a StringIO object:
file = StringIO.new(img)
# you can now call file.read, file.seek, file.rewind, etc.
I'm having a stirng like below...
eJzdWFuTokgWfu9fUVHzaPRwURQ6LCeS+y1BEFR4Q0BAEBBQLr9+seyuqpnt3ujZ2Y3YWSMIk4+T55LnnI8kl7915+zpFlZ1UuQvz9iv6PNTmPtFkOTRy7Nt8Z/J599Wn5ZWXIUhuwn9axWuljCsay8Kn5Lg5XkNzPDyuQlylhwuO5Z5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k+JNByOrMxRfY0ImT8pxOi3Wk8ZPiFCKbc4q6fWQIMZI5fFEtOCS/eejNwhD1MqOwhRdNzvkxXx+2i3jH6sdeyAlMJpNFXmYZOvvJNmUP7Nimze57ber/H7Zpp1mg13/fpt+wv9nb5Wd3H8AnsnMjZYcDkG6G2zclo3kXS3J35tDnDeMIrLrJL5noV6G+zdTjbcMlBwBu8zjVzUEsK8OdDjZKKnwyBVIHZJvEYahzscz1LjlX1xAsrLmW3+bamT2K2/OEOPeIKEekNyAapSEA7qrCmdOu1PmZ07pYe/VP1zlzis19qDhzLWgCw4z5t91HmLZR6Px+x6DBZLBvulZuSk/FyJ1edPJicpGPk9MYK/62Y/DGnYt3Bf9KvnAEsZQE7u9Wy1GUAnJPTLyLQaZa27Lg2+7MbkHL0cjwox0GM2HTWNXWYk9fa90VA7m6naMmPwznzhMTfuRm1gPZbB/39vRKFiKlMNPFJAbUPiAbC8FCbq5Yxk7d5mVUcZiGQbaIDyAQ0U0eqfN1RhF4ufB5SwlGwWPGXfOGR/T1Ys2jR2GOm/GcgTaFY+RIbdSRETftJB9yW2jNfTFm270evVjMlOui/e4OA3n/xkLevrvev8heD2Fej4XuxwYfj4s+/QNKrAL+
I need to convert this string to an XML.
I'd tried to decompress the string by getting the byte array from the string using base64 encoding. But I failed to move on. I don't think I'm in the right path. I searched a lot for any libraries found for NSString decompression. But no luck.
The input string is valid one. I succeed with online string decompress to xml.
That is XML data that was compressed with zlib to the zlib format, and then Base64 encoded. You need to decode the Base64, then decompress with zlib. Then you get:
<?xml version="1.0" encoding="UTF-8"?>
<ThreeDSecure><Message id="PAReq-tdnD8zqWDC"><PARes id="lQCkUVS06gWpyMR8uKCL"><version>1.0.2</version><Merchant><acqBIN>494000</acqBIN><merID>123456789</merID></Merchant><Purchase><xid>fregBoJ/QFmCwyPNUO3/czQ4NTM=</xid><date>20170120 12:39:40</date><purchAmount>92400</purchAmount><currency>682</currency><exponent>2</exponent></Purchase><pan>0000000000002349</pan><TX><time>20170125 06:56:08</time><status>Y</status><cavv>MDAwMDAwMDAwMDAwMDAwMDAwMDA=</cavv><eci>05</eci><cavvAlgorithm>1</cavvAlgorithm></TX></PARes><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#"><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><Reference URI="#lQCkUVS06gWpyMR8uKCL"><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><DigestValue>hbDuU8EtfIpHUvG/Q/HLYpsRzRc=</DigestValue></Reference></SignedInfo><SignatureValue>FfWa1AIOdMNCJ0oinMXpL8o87oFSu661LERkaMqRWCDvno+GWbkbSe9Yrj35SszM
d6ykJF9VO/k83R9thBa6pdiQjBdGY1SzCg89QeZna5JciLdMoGcgZcwEK9mfhoke
uWrTiRVEJKjKKbhhzLmRsz0xD02655S/Lf8gMxNo5h0=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDmTCCAwKgAwIBAgIJAPF+fmqkPJDeMA0GCSqGSIb3DQEBBQUAMIGNMQswCQYDVQQGEwJGUjELMAkGA1UECBMCMDYxDTALBgNVBAcTBE5pY2UxEDAOBgNVBAoTB0FtYWRldXMxHDAaBgNVBAsTE2Rldi1yZG0tdGtlLWZyYS1wYXkxDTALBgNVBAMTBFBheTExIzAhBgkqhkiG9w0BCQEWFHBheWRlbGRlQGFtYWRldXMuY29tMB4XDTEwMDEyMTEyMDYzOVoXDTIwMDExOTEyMDYzOVowgY0xCzAJBgNVBAYTAkZSMQswCQYDVQQIEwIwNjENMAsGA1UEBxMETmljZTEQMA4GA1UEChMHQW1hZGV1czEcMBoGA1UECxMTZGV2LXJkbS10a2UtZnJhLXBheTENMAsGA1UEAxMEUGF5MjEjMCEGCSqGSIb3DQEJARYUcGF5ZGVsZGVAYW1hZGV1cy5jb20wgZ8wDQYJK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Y0AMIGJAoGBAOAc5lmtIlbbAIvQZytpCNaqTIZWRzyntCYGDLSnqlHcreOVlLfvSEibAAv6hkORzHprQZ3zU08KFi3AIxAJU82MeOEhJEyZ86LPMA7T6Nnv6NmDfHVm+5my/HJg8az/N9N/AMWroY6BZIxclYwZ1wucju6CjhRXeKY6NdtdQRhFAgMBAAGjgekwgeYwHQYDVR0OBBYEFNMizUvONpSpaL18WOoxJ7+qJf+jMIG2BgNVHSMEga4wgauAFNMizUvONpSpaL18WOoxJ7+qJf+joYGHpIGEMIGBMQswCQYDVQQGEwJGUjELMAkGA1UECBMCMDYxEDAOBgNVBAoTB0FtYWRldXMxHDAaBgNVBAsTE2Rldi1yZG0tdGtlLWZyYS1wYXkxEDAOBgNVBAMTB1BheVJvb3QxIzAhBgkqhkiG9w0BCQEWFHBheWRlbGRlQGFtYWRldXMuY29tggkA8X5+aqQ8kNwwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQC+DkhLNPHyBusOZHdJrvmgtnbzmxaHiF7UPDaAl4XhyU3u8oH9KC37+hA9Xd8tT/1eE6KTQWLVnpgrE1N1MDohbAdH0SngL6Pl952p7cFTKd6KTflEuntF/OP7PF0fG62Rh6CMU9218e/S9fCHSw+nznUGwRXokwgZufahHlKu7w==</X509Certificate></X509Data></KeyInfo></Signature></Message></ThreeDSecure>
I have a Blackberry app developed using PhoneGap. I am using suds client to call web service. There are some Portuguese character in the webservice XML. I am not able to parse to XMLDoc using the DOMParser.
I am using
xmlDoc = parser.parseFromString(_xml, "text/xml");
The encoding type is UTF-8. Without the Portuguese character, parsing is working perfectly.
"I am using is UTF-8 encoding type." - this can mean several things, so it is unclear what exactly you do in order to support UTF-8 end-to-end.
E.g. you should check:
your web service really sends data in UTF-8 (when it converts string chars into bytes to be sent into output stream it should use UTF-8)
the device code that reads data from web really uses UTF-8 to convert bytes to string _xml
P.S. I'm not familiar with phonegap API so this is just a general plan.