Consultor Eletrônico



Kbase P184297: Error 10914 when calling OpenEdge Web Service from javascript passing date input parameter
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   18/03/2011
Status: Unverified

SYMPTOM(s):

Error 10914 when calling OpenEdge Web Service from javascript passing date input parameter

Javascript consuming OpenEdge Web Services that receives DATE input parameter

Invalid date value sent to this serializer (10914)


Error in SOAP parameter: (10914)

FACT(s) (Environment):

All Supported Operating Systems
OpenEdge 10.x

CAUSE:

Javascript passing native date object casted as string to a web service

FIX:

Javascript date object is producing different notation than the required xml iso8601 format.
Depending on the Internet Browser being used , it is required to do the following :

Mozilla Firefox:
function fnISO() {
// Only works in Firefox using ECMAScript 5
var now = new Date().toISOString();
alert(now);
}
or in other browsers like Internet Explorer :
function fnUTC2Date() {
var now = new Date();
var d = Date.UTC(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds(), now.getMilliseconds());
// obtain local UTC offset and convert to msec
localOffset = now.getTimezoneOffset() * 60000;
var c = new Date(d + localOffset);
alert(c.toLocaleString());
}

Such formatted string can be passed to the web service.