Zeev Goldstein Well-Known Member Licensed User Longtime User Feb 14, 2022 #1 hello i'm consuming a web service using SOAP i do it using xml it works like charm but now i need to use a bytesarray as a parameter since the entire XML is string there is no way i can add the bytesarray element as it cannot be added to string the following is a sample code illustrating the problem Prm1,prm2,prm3 are strings PrmX is the bytesarray can anyone assist on this? or offer an alternate direction? Thanks XML = _ "<?xml version='1.0' encoding='utf-8'?>" & _ "<soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'>" & _ "<soap12:Body>" & _ "<FuncName xmlns='https://Webservice.com/'>" & _ "<prm1>" & String1 & "</prm1>" & _ "<prm2>" & String2 & "</prm2>" & _ "<prm3>" & String3 & "</prm3>" & _ "<PrmX>" & BytesArray & "</PrmX>" & _ "</FuncName>" & _ "</soap12:Body>" & _ "</soap12:Envelope>"
hello i'm consuming a web service using SOAP i do it using xml it works like charm but now i need to use a bytesarray as a parameter since the entire XML is string there is no way i can add the bytesarray element as it cannot be added to string the following is a sample code illustrating the problem Prm1,prm2,prm3 are strings PrmX is the bytesarray can anyone assist on this? or offer an alternate direction? Thanks XML = _ "<?xml version='1.0' encoding='utf-8'?>" & _ "<soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'>" & _ "<soap12:Body>" & _ "<FuncName xmlns='https://Webservice.com/'>" & _ "<prm1>" & String1 & "</prm1>" & _ "<prm2>" & String2 & "</prm2>" & _ "<prm3>" & String3 & "</prm3>" & _ "<PrmX>" & BytesArray & "</PrmX>" & _ "</FuncName>" & _ "</soap12:Body>" & _ "</soap12:Envelope>"
Jmu5667 Well-Known Member Licensed User Longtime User Feb 14, 2022 #2 You could maybe convert your byte array to a hex encoded string for PrmX ? Code: Copy Dim bc As ByteConverter Dim ecbHex As String = bc.HexFromBytes(BytesArray ) Upvote 0
You could maybe convert your byte array to a hex encoded string for PrmX ? Code: Copy Dim bc As ByteConverter Dim ecbHex As String = bc.HexFromBytes(BytesArray )
Zeev Goldstein Well-Known Member Licensed User Longtime User Feb 14, 2022 #3 Jmu5667 said: You could maybe convert your byte array to a hex encoded string for PrmX? Code: Copy Dim ecbHex As String = bc.HexFromBytes(BytesArray ) Click to expand... thanks for your quick reply i will try and revert Upvote 0
Jmu5667 said: You could maybe convert your byte array to a hex encoded string for PrmX? Code: Copy Dim ecbHex As String = bc.HexFromBytes(BytesArray ) Click to expand... thanks for your quick reply i will try and revert
Zeev Goldstein Well-Known Member Licensed User Longtime User Feb 14, 2022 #4 Jmu5667 said: You could maybe convert your byte array to a hex encoded string for PrmX ? Code: Copy Dim bc As ByteConverter Dim ecbHex As String = bc.HexFromBytes(BytesArray ) Click to expand... sorry, not working as the webservice expects bytes array not string i don't get error but the parameter does not construct binary element so when the ws gets it it becomes "garbage" i can't modify the ws as it is a live one and in use when others are sending bytesarray from pc apps now i wanted to use it from b4a Upvote 0
Jmu5667 said: You could maybe convert your byte array to a hex encoded string for PrmX ? Code: Copy Dim bc As ByteConverter Dim ecbHex As String = bc.HexFromBytes(BytesArray ) Click to expand... sorry, not working as the webservice expects bytes array not string i don't get error but the parameter does not construct binary element so when the ws gets it it becomes "garbage" i can't modify the ws as it is a live one and in use when others are sending bytesarray from pc apps now i wanted to use it from b4a
Erel B4X founder Staff member Licensed User Longtime User Feb 14, 2022 #5 SOAP is based on XML and there is no such thing as adding raw bytes inside the XML string. Maybe you need to use base64 encoding. Upvote 0
SOAP is based on XML and there is no such thing as adding raw bytes inside the XML string. Maybe you need to use base64 encoding.
Zeev Goldstein Well-Known Member Licensed User Longtime User Feb 14, 2022 #6 Problem solved. Thank you all of yow who invested time here Upvote 0