Hi,
How should I pass a DateTime variable through SOAP?
I have a solution to call SOAP WebServices (it took long time to find how to manage it), but until now, I was only required to pass string variables. Now, I'm trying to connect to a WebService that requires the date as DateTime, not as string.
This is an extract:
The last two vars are passing "2017-03-22 00:00:00" and "2017-04-20 23:59:59", but when the WebService is called, I get this error:
I used the same WebService in C# and passing the same data as DateTime instead string works fine.
Any ideas?
Thanks!
How should I pass a DateTime variable through SOAP?
I have a solution to call SOAP WebServices (it took long time to find how to manage it), but until now, I was only required to pass string variables. Now, I'm trying to connect to a WebService that requires the date as DateTime, not as string.
This is an extract:
B4X:
XML = XML & "<key>" & Main.wsKey & "</key>"
XML = XML & "<user>" & Main.wsUser & "</user>"
XML = XML & "<Password>" & Main.wsPW & "</Password>"
XML = XML & "<licence>" & Main.wsLicRep & "</licence>"
XML = XML & "<dateINI>" & txtDateIni.Text & " 00:00:00" & "</dateINI>"
XML = XML & "<dateFIN>" & txtDateFin.Text & " 23:59:59" & "</dateFIN>"
The last two vars are passing "2017-03-22 00:00:00" and "2017-04-20 23:59:59", but when the WebService is called, I get this error:
B4X:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Sender</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">Server was unable to read request. ---> There is an error in XML document (1, 378). ---> The string '2017-03-22 00:00:00' is not a valid AllXsd value.</soap:Text></soap:Reason><soap:Detail /></soap:Fault></soap:Body></soap:Envelope>
I used the same WebService in C# and passing the same data as DateTime instead string works fine.
Any ideas?
Thanks!