axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "xzg" <...@eimagesoft.com>
Subject Re: failed in building element date
Date Fri, 07 May 2010 13:32:33 GMT
Thank you, Damitha. Your way is not consistant with the hours and minutes.
I have coped with it in this way (changes the format from axis2/java):

int year = 0, mon = 0, day = 0, hour = 0, min = 0;
float sec = 0;
text_value = axiom_element_get_text(current_element, env, current_node); // 2010-04-24+08:00
text_new = (char*)malloc(50);
sscanf(text_value, "%d-%d-%d+%d:%d", &year, &mon, &day, &hour, &min);
sprintf(text_new, "%d-%d-%dT%d:%d:%fZ", year, mon, day, hour, min, sec); // 2010-4-24T8:0:0.0000Z
element = (void*)axutil_date_time_create(env);
status = axutil_date_time_deserialize_date_time((axutil_date_time_t*)element, env, text_new);
free(text_new);

Thanks,
Zhigang

----- Original Message ----- 
From: "Damitha Kumarage" <damitha@wso2.com>
To: "Apache AXIS C User List" <c-user@axis.apache.org>
Sent: Friday, May 07, 2010 6:42 PM
Subject: Re: failed in building element date


> xzg wrote:
>> Hi all,
>> I have built an axis2 service in java and it provides a function of
>> getting a date, as wsdl segment:
>> <xs:element minOccurs="0" name="date" nillable="true" type="xs:date"/>
>> I can get the response with date, segment:
>> <date>2010-04-24+08:00</date>
>> But the c-stub "failed in building element date".
>> text_value = axiom_element_get_text(current_element, env,
>> current_node); // 2010-04-24+08:00
>> element = (void*)axutil_date_time_create(env);
>> status =
>> axutil_date_time_deserialize_date_time((axutil_date_time_t*)element,
>> env, text_value); // AXIS2_FAILURE
>> Isn't it a bug? How to deserialize this date time correctly?
> Following code gave me
> 
> axis2_char_t *date_str = "2010-04-24+08:00";
> printf("input:%s\n", date_str);
> axutil_date_time_t *date_time = axutil_date_time_create(env);
> /*status =
> axutil_date_time_deserialize_date_time_with_time_zone(date_time, env,
> date_str);*/
> status = axutil_date_time_deserialize_date(date_time, env, date_str);
> if(status == AXIS2_SUCCESS)
> {
> axis2_char_t *result = NULL;
> /*result =
> axutil_date_time_serialize_date_time_with_time_zone(date_time, env);*/
> result = axutil_date_time_serialize_date_time(date_time, env);
> printf("result:%s\n", result);
> }
> else
> {
> printf("failure\n");
> }
> return 0;
> 
> 
> the result
> input:2010-04-24+08:00
> result:2010-04-24T10:40:32.105Z
> 
> with Axis2/C 1.6.0
> 
> Thanks,
> Damitha
> 
>> Regards,
>> Zhigang
> 
> 
> -- 
> __________________________________________________________________
> 
> Damitha Kumarage
> Technical Lead; WSO2 Inc.
> "Oxygenating the Web Service Platform; " http://www.wso2.com/
> 
> blog: " http://damithakumarage.wordpress.com/
> __________________________________________________________________
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: c-user-help@axis.apache.org
>
Mime
View raw message