1 /*
2  * Portions of this file Copyright 1999-2005 University of Chicago
3  * Portions of this file Copyright 1999-2005 The University of Southern California.
4  *
5  * This file or a portion of this file is licensed under the
6  * terms of the Globus Toolkit Public License, found at
7  * http://www.globus.org/toolkit/download/license.html.
8  * If you redistribute this file, with or without
9  * modifications, you must include this notice in the file.
10  */
11
12
13 /*
14  * This file is automatically generated by the Globus WSDLtoC converter
15  */
16
17 #include "xsd_QName.h"
18 #include "globus_soap_message.h"
19 #include "globus_xsd_type_info.h"
20 #include "wsu_AttributedDateTime.h"
21
22 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
23 xsd_QName wsu_AttributedDateTime_qname =
24 {
25     WSU_ATTRIBUTEDDATETIME_NS,
26     WSU_ATTRIBUTEDDATETIME_LOCAL
27 };
28 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
29
30 globus_result_t
31 wsu_AttributedDateTime_serialize_wrapper(
32     xsd_QName *                         element_qname,
33     void *                              instance,
34     globus_soap_message_handle_t        message_handle,
35     globus_xsd_element_options_t        options)
36 0 {
37 0     return wsu_AttributedDateTime_serialize(
38         element_qname,
39         (wsu_AttributedDateTime *) instance,
40         message_handle, options);
41 }
42
43 globus_result_t
44 wsu_AttributedDateTime_deserialize_pointer_wrapper(
45     xsd_QName *                         element_qname,
46     void **                             ip,
47     globus_soap_message_handle_t        message_handle,
48     globus_xsd_element_options_t        options)
49 0 {
50 0     return wsu_AttributedDateTime_deserialize_pointer(
51         element_qname,
52         (wsu_AttributedDateTime **) ip,
53         message_handle, options);
54 }
55
56 globus_result_t
57 wsu_AttributedDateTime_init_wrapper(void **object)
58 0 {
59 0     return wsu_AttributedDateTime_init(
60         (wsu_AttributedDateTime **) object);
61 }
62
63 void
64 wsu_AttributedDateTime_destroy_wrapper(
65     void *                          object)
66 0 {
67 0     wsu_AttributedDateTime_destroy(
68         (wsu_AttributedDateTime *) object);
69 }
70
71 globus_result_t
72 wsu_AttributedDateTime_copy_wrapper(
73     void **                         dest_obj,
74     void *                          src_obj)
75 0 {
76 0     return wsu_AttributedDateTime_copy(
77         (wsu_AttributedDateTime **) dest_obj,
78         (wsu_AttributedDateTime *) src_obj);
79 }
80
81 globus_result_t
82 wsu_AttributedDateTime_init_contents_wrapper(void *object)
83 0 {
84 0     return wsu_AttributedDateTime_init_contents(
85         (wsu_AttributedDateTime *) object);
86 }
87
88 void
89 wsu_AttributedDateTime_destroy_contents_wrapper(
90     void *                          object)
91 0 {
92 0     wsu_AttributedDateTime_destroy_contents(
93         (wsu_AttributedDateTime *) object);
94 }
95
96 globus_result_t
97 wsu_AttributedDateTime_copy_contents_wrapper(
98     void *                          dest_obj,
99     void *                          src_obj)
100 0 {
101 0     return wsu_AttributedDateTime_copy_contents(
102         (wsu_AttributedDateTime *) dest_obj,
103         (wsu_AttributedDateTime *) src_obj);
104 }
105
106 globus_result_t
107 wsu_AttributedDateTime_serialize_contents_wrapper(
108     xsd_QName *                         element_qname,
109     void *                              instance,
110     globus_soap_message_handle_t        message_handle,
111     globus_xsd_element_options_t        options)
112 0 {
113 0     return wsu_AttributedDateTime_serialize_contents(
114         element_qname,
115         (wsu_AttributedDateTime *) instance,
116         message_handle, options);
117 }
118
119 globus_result_t
120 wsu_AttributedDateTime_deserialize_contents_wrapper(
121     xsd_QName *                         element_qname,
122     void **                             instance,
123     globus_soap_message_handle_t        message_handle,
124     globus_xsd_element_options_t        options)
125 0 {
126 0     globus_result_t                     result;
127 0     GlobusFuncName(wsu_AttributedDateTime_deserialize_contents_wrapper);
128 0     GlobusSoapMessageDebugEnter();
129
130 0     if(!*instance)
131     {
132 0         result = wsu_AttributedDateTime_init(
133             (wsu_AttributedDateTime **)instance);
134 0         if(result != GLOBUS_SUCCESS)
135         {
136 0             goto error;
137         }
138     }
139
140 0     result = wsu_AttributedDateTime_deserialize_contents(
141         element_qname,
142         *(wsu_AttributedDateTime **)instance,
143         message_handle, options);
144 error:
145 0     GlobusSoapMessageDebugExit();
146 0     return result;
147 }
148
149 globus_result_t
150 wsu_AttributedDateTime_array_serialize_wrapper(
151     xsd_QName *                     element,
152     void *                          instance,
153     globus_soap_message_handle_t    message,
154     globus_xsd_element_options_t    options)
155 0 {
156 0     return wsu_AttributedDateTime_array_serialize(
157         element,
158         (wsu_AttributedDateTime_array *) instance,
159         message, options);
160 }
161
162 globus_result_t
163 wsu_AttributedDateTime_array_deserialize_wrapper(
164     xsd_QName *                         element_qname,
165     void **                             inst,
166     globus_soap_message_handle_t        message,
167     globus_xsd_element_options_t        options)
168 0 {
169 0     if(!*inst)
170     {
171 0         globus_result_t                 result;
172
173 0         result = wsu_AttributedDateTime_array_init(
174             (wsu_AttributedDateTime_array **)inst);
175 0         if(result != GLOBUS_SUCCESS)
176         {
177 0             return result;
178         }
179     }
180
181 0     return wsu_AttributedDateTime_array_deserialize(
182         element_qname,
183         *(wsu_AttributedDateTime_array **) inst,
184         message, options);
185 }
186
187 globus_result_t
188 wsu_AttributedDateTime_array_init_wrapper(
189     void **                             arr)
190 0 {
191 0     return wsu_AttributedDateTime_array_init(
192         (wsu_AttributedDateTime_array **) arr);
193 }
194
195 void
196 wsu_AttributedDateTime_array_destroy_wrapper(
197     void *                              arr)
198 0 {
199 0     wsu_AttributedDateTime_array_destroy(
200         (wsu_AttributedDateTime_array *) arr);
201 }
202
203 globus_result_t
204 wsu_AttributedDateTime_array_copy_wrapper(
205     void **                             dest_arr,
206     void *                              src_arr)
207 0 {
208 0     return wsu_AttributedDateTime_array_copy(
209         (wsu_AttributedDateTime_array **) dest_arr,
210         (wsu_AttributedDateTime_array *) src_arr);
211 }
212
213 globus_result_t
214 wsu_AttributedDateTime_array_init_contents_wrapper(
215     void *                              arr)
216 0 {
217 0     return wsu_AttributedDateTime_array_init_contents(
218         (wsu_AttributedDateTime_array *) arr);
219 }
220
221 void
222 wsu_AttributedDateTime_array_destroy_contents_wrapper(
223     void *                              arr)
224 0 {
225 0     wsu_AttributedDateTime_array_destroy_contents(
226         (wsu_AttributedDateTime_array *) arr);
227 }
228
229 globus_result_t
230 wsu_AttributedDateTime_array_copy_contents_wrapper(
231     void *                              dest_arr,
232     void *                              src_arr)
233 0 {
234 0     return wsu_AttributedDateTime_array_copy_contents(
235         (wsu_AttributedDateTime_array *) dest_arr,
236         (wsu_AttributedDateTime_array *) src_arr);
237 }
238
239 struct globus_xsd_type_info_s wsu_AttributedDateTime_contents_info =
240 {
241     &wsu_AttributedDateTime_qname,
242     wsu_AttributedDateTime_serialize_contents_wrapper,
243     wsu_AttributedDateTime_deserialize_contents_wrapper,
244     wsu_AttributedDateTime_init_wrapper,
245     wsu_AttributedDateTime_destroy_wrapper,
246     wsu_AttributedDateTime_copy_wrapper,
247     wsu_AttributedDateTime_init_contents_wrapper,
248     wsu_AttributedDateTime_destroy_contents_wrapper,
249     wsu_AttributedDateTime_copy_contents_wrapper,
250     sizeof(wsu_AttributedDateTime),
251     NULL,
252     NULL,
253     NULL
254 };
255
256 struct globus_xsd_type_info_s wsu_AttributedDateTime_array_info =
257 {
258     &wsu_AttributedDateTime_qname,
259     wsu_AttributedDateTime_array_serialize_wrapper,
260     wsu_AttributedDateTime_array_deserialize_wrapper,
261     wsu_AttributedDateTime_array_init_wrapper,
262     wsu_AttributedDateTime_array_destroy_wrapper,
263     wsu_AttributedDateTime_array_copy_wrapper,
264     wsu_AttributedDateTime_array_init_contents_wrapper,
265     wsu_AttributedDateTime_array_destroy_contents_wrapper,
266     wsu_AttributedDateTime_array_copy_contents_wrapper,
267     sizeof(wsu_AttributedDateTime),
268     wsu_AttributedDateTime_array_push_wrapper,
269     NULL,
270     NULL
271 };
272
273 struct globus_xsd_type_info_s wsu_AttributedDateTime_info =
274 {
275     &wsu_AttributedDateTime_qname,
276     wsu_AttributedDateTime_serialize_wrapper,
277     wsu_AttributedDateTime_deserialize_pointer_wrapper,
278     wsu_AttributedDateTime_init_wrapper,
279     wsu_AttributedDateTime_destroy_wrapper,
280     wsu_AttributedDateTime_copy_wrapper,
281     wsu_AttributedDateTime_init_contents_wrapper,
282     wsu_AttributedDateTime_destroy_contents_wrapper,
283     wsu_AttributedDateTime_copy_contents_wrapper,
284     sizeof(wsu_AttributedDateTime),
285     NULL,
286     &wsu_AttributedDateTime_contents_info,
287     &wsu_AttributedDateTime_array_info
288 };
289
290 globus_result_t
291 wsu_AttributedDateTime_init_contents(
292     wsu_AttributedDateTime * instance)
293 0 {
294 0     globus_result_t                     result = GLOBUS_SUCCESS;
295 0     GlobusFuncName(wsu_AttributedDateTime_init_contents);
296 0     GlobusSoapMessageDebugEnter();
297
298 0     memset(instance, 0, sizeof(wsu_AttributedDateTime));
299
300 0     GlobusSoapMessageDebugExit();
301 0     return result;
302 }
303
304 globus_result_t
305 wsu_AttributedDateTime_init(
306     wsu_AttributedDateTime ** object)
307 0 {
308 0     wsu_AttributedDateTime * instance;
309 0     globus_result_t                     result = GLOBUS_SUCCESS;
310 0     GlobusFuncName(wsu_AttributedDateTime_init);
311 0     GlobusSoapMessageDebugEnter();
312
313 0     instance = globus_malloc(sizeof(wsu_AttributedDateTime));
314 0     if(!instance)
315     {
316 0         result = GlobusSoapMessageErrorOutOfMemory;
317 0         goto exit;
318     }
319
320 0     memset(instance, 0, sizeof(wsu_AttributedDateTime));
321
322 0     *object = instance;
323
324  exit:
325 0     GlobusSoapMessageDebugExit();
326 0     return result;
327 }
328
329 void
330 wsu_AttributedDateTime_destroy(
331     wsu_AttributedDateTime * instance)
332 0 {
333 0     GlobusFuncName(wsu_AttributedDateTime_destroy);
334 0     GlobusSoapMessageDebugEnter();
335
336 0     if(!instance)
337     {
338 0         goto exit;
339     }
340
341 0     wsu_AttributedDateTime_destroy_contents(instance);
342 0     globus_free(instance);
343
344  exit:
345
346 0     GlobusSoapMessageDebugExit();
347 }
348
349 void
350 wsu_AttributedDateTime_destroy_contents(
351     wsu_AttributedDateTime * instance)
352 0 {
353 0     GlobusFuncName(wsu_AttributedDateTime_destroy_contents);
354 0     GlobusSoapMessageDebugEnter();
355
356 0     if(instance)
357     {
358
359
360 0     xsd_string_destroy_contents(
361          &instance->base_value);
362
363 0     if(instance->_ValueType)
364     {
365 0         xsd_QName_destroy(
366             instance->_ValueType);
367 0         instance->_ValueType = NULL;
368     }
369
370 0     if(instance->_Id)
371     {
372 0         xsd_ID_destroy(
373             instance->_Id);
374 0         instance->_Id = NULL;
375     }
376
377 0         xsd_anyAttributes_destroy(instance->anyAttributes);
378 0         instance->anyAttributes = NULL;
379
380     }
381
382 0     GlobusSoapMessageDebugExit();
383 }
384
385 globus_result_t
386 wsu_AttributedDateTime_copy(
387     wsu_AttributedDateTime ** dest_obj,
388     const wsu_AttributedDateTime * src_obj)
389 0 {
390 0     globus_result_t                     result = GLOBUS_SUCCESS;
391 0     wsu_AttributedDateTime * instance;
392 0     GlobusFuncName(wsu_AttributedDateTime_copy);
393
394 0     GlobusSoapMessageDebugEnter();
395
396 0     instance = malloc(sizeof(wsu_AttributedDateTime));
397 0     if (instance == NULL)
398     {
399 0         GlobusSoapMessageDebugExit();
400 0         return GlobusSoapMessageErrorOutOfMemory;
401     }
402
403 0     result = wsu_AttributedDateTime_copy_contents(instance, src_obj);
404 0     if(result != GLOBUS_SUCCESS)
405     {
406 0         globus_free(instance);
407 0         GlobusSoapMessageDebugExit();
408 0         return GlobusSoapMessageErrorOutOfMemory;
409     }
410
411 0     *dest_obj = instance;
412 0     GlobusSoapMessageDebugExit();
413 0     return result;
414 }
415
416 globus_result_t
417 wsu_AttributedDateTime_copy_contents(
418     wsu_AttributedDateTime * instance,
419     const wsu_AttributedDateTime * src_obj)
420 0 {
421 0     globus_result_t                     result = GLOBUS_SUCCESS;
422 0     GlobusFuncName(wsu_AttributedDateTime_copy_contents);
423
424 0     GlobusSoapMessageDebugEnter();
425
426
427 0     if(src_obj->_ValueType)
428     {
429 0         result = xsd_QName_copy(
430             &instance->_ValueType,
431             src_obj->_ValueType);
432 0         if(result != GLOBUS_SUCCESS)
433         {
434 0             result = GlobusSoapMessageErrorCopyFailed(
435                 result, NULL, &xsd_QName_qname);
436 0             goto _ValueType_destroy;
437         }
438     }
439     else
440     {
441 0         instance->_ValueType = NULL;
442     }
443
444 0     if(src_obj->_Id)
445     {
446 0         result = xsd_ID_copy(
447             &instance->_Id,
448             src_obj->_Id);
449 0         if(result != GLOBUS_SUCCESS)
450         {
451 0             result = GlobusSoapMessageErrorCopyFailed(
452                 result, NULL, &xsd_ID_qname);
453 0             goto _Id_destroy;
454         }
455     }
456     else
457     {
458 0         instance->_Id = NULL;
459     }
460
461 0     if(src_obj->anyAttributes)
462     {
463 0         result = xsd_anyAttributes_copy(&instance->anyAttributes, 
464                                         src_obj->anyAttributes);
465 0         if(result != GLOBUS_SUCCESS)
466         {
467 0             result = GlobusSoapMessageErrorCopyAnyAttrsFailed(
468                 result, NULL);
469 0             goto xsd_anyAttributes_after_destroy;
470         }
471     }
472     else
473     {
474 0         instance->anyAttributes = NULL;
475     }
476
477 0     result = xsd_string_copy_contents(
478         &instance->base_value,
479         &src_obj->base_value);
480 0     if(result != GLOBUS_SUCCESS)
481     {
482 0         result = GlobusSoapMessageErrorCopyFailed(
483             result, NULL,  &xsd_string_qname);
484 0         goto base_value_destroy;
485     }
486
487 0     goto exit;
488
489  fail_deserialize:
490
491  xsd_anyAttributes_destroy:
492 0         xsd_anyAttributes_destroy(instance->anyAttributes);
493 0         instance->anyAttributes = NULL;
494  xsd_anyAttributes_after_destroy:
495 0         xsd_string_destroy_contents(
496             &instance->base_value);
497
498  base_value_destroy:
499
500  _ValueType_destroy:
501
502 0     if(instance->_ValueType)
503     {
504 0         xsd_QName_destroy(
505             instance->_ValueType);
506 0         instance->_ValueType = NULL;
507     }
508
509  _Id_destroy:
510
511 0     if(instance->_Id)
512     {
513 0         xsd_ID_destroy(
514             instance->_Id);
515 0         instance->_Id = NULL;
516     }
517
518
519  exit:
520
521 0     GlobusSoapMessageDebugExit();
522 0     return result;
523 }
524
525
526
527 globus_result_t
528 wsu_AttributedDateTime_serialize_contents(
529     xsd_QName *                         element_qname, /* ignored */
530     wsu_AttributedDateTime * inst,
531     globus_soap_message_handle_t        message_handle,
532     globus_xsd_element_options_t        options)
533 0 {
534 0     globus_result_t                     result = GLOBUS_SUCCESS;
535 0     GlobusFuncName(wsu_AttributedDateTime_serialize_contents);
536 0     GlobusSoapMessageDebugEnter();
537
538 0     result = wsu_AttributedDateTime_serialize(
539         NULL,
540         inst,
541         message_handle,
542         options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
543 0     if(result != GLOBUS_SUCCESS)
544     {
545 0         result = GlobusSoapMessageErrorSerializeFailed(
546             result, NULL, element_qname);
547         goto exit;
548     }
549
550  exit:
551
552 0     GlobusSoapMessageDebugExit();
553 0     return result;
554 }
555
556
557
558 globus_result_t
559 wsu_AttributedDateTime_serialize(
560     xsd_QName *                         element_qname,
561     wsu_AttributedDateTime * instance,
562     globus_soap_message_handle_t        message_handle,
563     globus_xsd_element_options_t        options)
564 0 {
565 0     globus_result_t                     result = GLOBUS_SUCCESS;
566 0     xsd_QName                           subelement;
567 0     globus_list_t *                     any_attr_keys = NULL;
568 0     globus_list_t *                     any_attr_keys_iterator = NULL;
569 0     xsd_QName *                         type_attr = NULL;
570 0     char *                              prefix = NULL;
571 0     int                                 prefix_created;
572 0     int                                 define_prefix = 0;
573 0     int                                 save_options = options;
574
575 0     GlobusFuncName(wsu_AttributedDateTime_serialize);
576 0     GlobusSoapMessageDebugEnter();
577
578
579 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
580     {
581         /* serialize wsu_AttributedDateTime element */
582
583 0         result = globus_soap_message_invoke_ns_callouts(
584             message_handle,
585             element_qname,
586             GLOBUS_SOAP_MESSAGE_CALLOUT_NS_SET,
587             &options);
588 0         if(result != GLOBUS_SUCCESS)
589         {
590 0             result = GlobusSoapMessageErrorSerializeFailed(
591                 result, NULL, element_qname);
592 0             goto exit;
593         }
594
595 0 result = globus_soap_message_element_ns_set(
596             message_handle,
597             element_qname->Namespace,
598             &options);
599 0         if(result != GLOBUS_SUCCESS)
600         {
601 0             result = GlobusSoapMessageErrorSerializeFailed(
602                 result, NULL, element_qname);
603 0             goto exit;
604         }
605
606 0         if(instance->_ValueType)
607         {
608
609 0         result = globus_soap_message_attribute_ns_set(
610             message_handle,
611             NULL,
612              &options);
613
614 0         if(result != GLOBUS_SUCCESS)
615         {
616 0             xsd_QName               error_qname;
617 0             error_qname.local = prefix;
618 0             error_qname.Namespace = "";
619 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
620                                                            NULL, 
621                                                            &error_qname);
622 0             goto exit;
623         }
624
625
626 0         result = globus_soap_message_attribute_ns_set(
627             message_handle,
628             instance->_ValueType->Namespace,
629             &options);
630 0         if(result != GLOBUS_SUCCESS)
631         {
632 0             xsd_QName               error_qname;
633 0             error_qname.local = prefix;
634 0             error_qname.Namespace = "";
635 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
636                                                            NULL, 
637                                                            &error_qname);
638 0             goto exit;
639         }
640
641         }
642
643 0         if(instance->_Id)
644         {
645
646 0         result = globus_soap_message_attribute_ns_set(
647             message_handle,
648             "http://schemas.xmlsoap.org/ws/2002/07/utility",
649              &options);
650
651 0         if(result != GLOBUS_SUCCESS)
652         {
653 0             xsd_QName               error_qname;
654 0             error_qname.local = prefix;
655 0             error_qname.Namespace = "http://schemas.xmlsoap.org/ws/2002/07/utility";
656 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
657                                                            NULL, 
658                                                            &error_qname);
659 0             goto exit;
660         }
661
662
663         }
664
665 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
666    !globus_soap_message_serialize_is_c14n_subset(message_handle))
667         {
668 0             result = globus_soap_message_attribute_ns_set(
669                 message_handle,
670                 "http://www.w3.org/2001/XMLSchema-instance",
671                 &options);
672 0             if(result != GLOBUS_SUCCESS)
673             {
674 0                 result = GlobusSoapMessageErrorSerializeFailed(
675                     result, NULL, element_qname);
676 0                 goto exit;
677             }
678
679 0             result = globus_soap_message_attribute_ns_set(
680                 message_handle,
681                 wsu_AttributedDateTime_qname.Namespace,
682                 &options);
683 0             if(result != GLOBUS_SUCCESS)
684             {
685 0                 result = GlobusSoapMessageErrorSerializeFailed(
686                     result, NULL, element_qname);
687 0                 goto exit;
688             }
689         }
690
691 0         result = xsd_anyAttributes_namespace_set(
692             message_handle, instance->anyAttributes, &options);
693 0         if(result != GLOBUS_SUCCESS)
694         {
695 0             result = GlobusSoapMessageErrorSerializeAnyAttrsFailed(
696                 result, "Failed to set namespace");
697 0             goto exit;
698         }
699
700 0         result = globus_soap_message_invoke_callouts(
701             message_handle,
702             element_qname,
703             GLOBUS_SOAP_MESSAGE_CALLOUT_BEGIN);
704 0         if(result != GLOBUS_SUCCESS)
705         {
706 0             result = GlobusSoapMessageErrorSerializeFailed(
707                 result, NULL, element_qname);
708 0             goto exit;
709         }
710
711 0         result = globus_soap_message_serialize_element(
712             message_handle,
713             element_qname,
714             options,
715             &wsu_AttributedDateTime_qname);
716 0         if(result != GLOBUS_SUCCESS)
717         {
718 0             result = GlobusSoapMessageErrorSerializeFailed(
719                 result, NULL, element_qname);
720 0             goto exit;
721         }
722
723 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
724    !globus_soap_message_serialize_is_c14n_subset(message_handle))
725         {
726 0            xsd_QName_init(&type_attr);
727        
728 0            type_attr->local = globus_libc_strdup("type");
729 0            type_attr->Namespace = globus_libc_strdup(XSI_NS);
730         }
731
732         /* serialize namespaces */
733         
734 0 result = globus_soap_message_invoke_ns_callouts(
735             message_handle,
736             element_qname,
737             GLOBUS_SOAP_MESSAGE_CALLOUT_NS_ADD,
738             &options);
739 0         if(result != GLOBUS_SUCCESS)
740         {
741 0             result = GlobusSoapMessageErrorSerializeFailed(
742                 result, NULL, element_qname);
743 0             goto exit;
744         }
745
746 0 result = globus_soap_message_element_ns_add(
747             message_handle,
748             element_qname->Namespace,
749             &options);
750 0         if(result != GLOBUS_SUCCESS)
751         {
752 0             result = GlobusSoapMessageErrorSerializeFailed(
753                 result, NULL, element_qname);
754 0             goto exit;
755         }
756
757 0         if(instance->_ValueType)
758         {
759
760 0         result = globus_soap_message_attribute_ns_add(
761             message_handle,
762             NULL,
763              &options);
764
765 0         if(result != GLOBUS_SUCCESS)
766         {
767 0             xsd_QName               error_qname;
768 0             error_qname.local = prefix;
769 0             error_qname.Namespace = "";
770 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
771                                                            NULL, 
772                                                            &error_qname);
773 0             goto exit;
774         }
775
776
777 0         result = globus_soap_message_attribute_ns_add(
778             message_handle,
779             instance->_ValueType->Namespace,
780             &options);
781 0         if(result != GLOBUS_SUCCESS)
782         {
783 0             xsd_QName               error_qname;
784 0             error_qname.local = prefix;
785 0             error_qname.Namespace = "";
786 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
787                                                            NULL, 
788                                                            &error_qname);
789 0             goto exit;
790         }
791
792         }
793
794 0         if(instance->_Id)
795         {
796
797 0         result = globus_soap_message_attribute_ns_add(
798             message_handle,
799             "http://schemas.xmlsoap.org/ws/2002/07/utility",
800              &options);
801
802 0         if(result != GLOBUS_SUCCESS)
803         {
804 0             xsd_QName               error_qname;
805 0             error_qname.local = prefix;
806 0             error_qname.Namespace = "http://schemas.xmlsoap.org/ws/2002/07/utility";
807 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
808                                                            NULL, 
809                                                            &error_qname);
810 0             goto exit;
811         }
812
813
814         }
815
816 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
817    !globus_soap_message_serialize_is_c14n_subset(message_handle))
818         {
819 0             result = globus_soap_message_attribute_ns_add(
820                 message_handle,
821                 "http://www.w3.org/2001/XMLSchema-instance",
822                 &options);
823 0             if(result != GLOBUS_SUCCESS)
824             {
825 0                 result = GlobusSoapMessageErrorSerializeFailed(
826                     result, NULL, element_qname);
827 0                 goto exit;
828             }
829
830 0             result = globus_soap_message_attribute_ns_add(
831                 message_handle,
832                 wsu_AttributedDateTime_qname.Namespace,
833                 &options);
834 0             if(result != GLOBUS_SUCCESS)
835             {
836 0                 result = GlobusSoapMessageErrorSerializeFailed(
837                     result, NULL, element_qname);
838 0                 goto exit;
839             }
840         }
841
842 0         result = xsd_anyAttributes_namespace_add(
843             message_handle, instance->anyAttributes, &options);
844 0         if(result != GLOBUS_SUCCESS)
845         {
846 0             result = GlobusSoapMessageErrorSerializeAnyAttrsFailed(
847                 result, "Failed to add namespace");
848 0             goto exit;
849         }
850
851         /* serialize attributes */
852
853 0         subelement.Namespace = "";
854 0         subelement.local = "ValueType";
855
856 0         if(instance->_ValueType)
857         {
858
859 0         result = xsd_QName_serialize_attribute(
860             &subelement,
861             instance->_ValueType,
862             message_handle,
863             options & (~GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS));
864 0         if(result != GLOBUS_SUCCESS)
865         {
866 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
867                                                            NULL, 
868                                                            element_qname);
869 0             goto exit;
870         }
871
872         }
873
874 0         subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/07/utility";
875 0         subelement.local = "Id";
876
877 0         if(instance->_Id)
878         {
879
880 0         result = xsd_ID_serialize_attribute(
881             &subelement,
882             instance->_Id,
883             message_handle,
884             options & (~GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS));
885 0         if(result != GLOBUS_SUCCESS)
886         {
887 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
888                                                            NULL, 
889                                                            element_qname);
890 0             goto exit;
891         }
892
893         }
894
895 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
896    !globus_soap_message_serialize_is_c14n_subset(message_handle))
897         {
898 0             result = globus_soap_message_serialize_QName_attribute(
899                 message_handle,
900                 type_attr,
901                 &wsu_AttributedDateTime_qname);
902 0             if(result != GLOBUS_SUCCESS)
903             {
904 0                 result = GlobusSoapMessageErrorSerializeFailed(
905                     result, NULL, element_qname);
906 0                 goto exit;
907             }
908         }
909
910 0         if(instance->anyAttributes)
911         {
912 0             any_attr_keys = xsd_anyAttributes_lex_sort(
913                 instance->anyAttributes);
914 0             any_attr_keys_iterator = any_attr_keys;
915         }
916
917
918 0         result = globus_soap_message_invoke_callouts(
919             message_handle,
920             element_qname,
921             GLOBUS_SOAP_MESSAGE_CALLOUT_ATTR);
922 0         if(result != GLOBUS_SUCCESS)
923         {
924 0             result = GlobusSoapMessageErrorSerializeFailed(
925                 result, NULL, element_qname);
926 0             goto exit;
927         }
928     }
929
930 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
931     {
932 0         result = globus_soap_message_serialize_element_begin_close(
933             message_handle);
934 0         if(result != GLOBUS_SUCCESS)
935         {
936 0             result = GlobusSoapMessageErrorSerializeFailed(
937                 result, NULL, element_qname);
938 0             goto exit;
939         }
940     }
941 0     options &= ~GLOBUS_XSD_ELEMENT_CONTENTS_ONLY;
942
943     /* serialize contents of type */
944
945 0     subelement.local = "base_value";
946 0     subelement.Namespace = NULL;
947
948 0     result = xsd_string_serialize(
949         &subelement,
950         &instance->base_value,
951         message_handle,
952         GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
953 0     if(result != GLOBUS_SUCCESS)
954     {
955 0         result = GlobusSoapMessageErrorSerializeFailed(
956             result, NULL,  &xsd_string_qname);
957 0         goto exit;
958     }
959
960 0     options = save_options;
961
962 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
963     {
964         /* add end element */
965 0         result = globus_soap_message_serialize_element_end(
966             message_handle,
967             element_qname,
968             options,
969             &wsu_AttributedDateTime_qname);
970 0         if(result != GLOBUS_SUCCESS)
971         {
972 0             result = GlobusSoapMessageErrorSerializeFailed(
973                 result, NULL, element_qname);
974 0             goto exit;
975         }
976
977 0         globus_soap_message_element_ns_remove(
978             message_handle,
979             element_qname->Namespace,
980             &options);
981
982     /* remove namespace/prefix mappings for these types */
983
984 0         if(instance->_ValueType)
985         {
986
987 0         globus_soap_message_attribute_ns_remove(
988             message_handle,
989             NULL,
990              &options);
991
992 0         globus_soap_message_attribute_ns_remove(
993             message_handle,
994             instance->_ValueType->Namespace,
995             &options);
996
997         }
998
999 0         if(instance->_Id)
1000         {
1001
1002 0         globus_soap_message_attribute_ns_remove(
1003             message_handle,
1004             "http://schemas.xmlsoap.org/ws/2002/07/utility",
1005              &options);
1006
1007         }
1008
1009 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
1010    !globus_soap_message_serialize_is_c14n_subset(message_handle))
1011         {
1012 0             globus_soap_message_attribute_ns_remove(
1013                 message_handle,
1014                 "http://www.w3.org/2001/XMLSchema-instance",
1015                 &options);
1016            
1017 0             globus_soap_message_attribute_ns_remove(
1018                 message_handle,
1019                 wsu_AttributedDateTime_qname.Namespace,
1020                 &options);
1021         }           
1022
1023 0         result = xsd_anyAttributes_namespace_remove(
1024             message_handle, instance->anyAttributes, &options);
1025 0         if(result != GLOBUS_SUCCESS)
1026         {
1027 0             result = GlobusSoapMessageErrorSerializeAnyAttrsFailed(
1028                 result, "Failed to remove namespace");
1029 0             goto exit;
1030         }
1031
1032 0         result = globus_soap_message_invoke_ns_callouts(
1033             message_handle,
1034             element_qname,
1035             GLOBUS_SOAP_MESSAGE_CALLOUT_NS_REMOVE,
1036             &options);
1037 0         if(result != GLOBUS_SUCCESS)
1038         {
1039 0             result  = GlobusSoapMessageErrorSerializeFailed(
1040                 result, NULL, element_qname);
1041 0             goto exit;
1042         }
1043
1044 0         result = globus_soap_message_invoke_callouts(
1045             message_handle,
1046             element_qname,
1047             GLOBUS_SOAP_MESSAGE_CALLOUT_END);
1048 0         if(result != GLOBUS_SUCCESS)
1049         {
1050 0             result = GlobusSoapMessageErrorSerializeFailed(
1051                 result, NULL, element_qname);
1052             goto exit;
1053         }
1054     }
1055
1056  exit:
1057 0     if (type_attr)
1058     {
1059 0         xsd_QName_destroy(type_attr);
1060     }
1061
1062 0     if(any_attr_keys)
1063     {
1064 0         globus_list_free(any_attr_keys);
1065     }
1066
1067 0     GlobusSoapMessageDebugExit();
1068 0     return result;
1069 }
1070
1071
1072
1073 globus_result_t
1074 wsu_AttributedDateTime_deserialize_contents(
1075     xsd_QName *                         element_qname, /* ignored */
1076     wsu_AttributedDateTime * inst,
1077     globus_soap_message_handle_t        message_handle,
1078     globus_xsd_element_options_t        options)
1079 0 {
1080 0     globus_result_t                     result = GLOBUS_SUCCESS;
1081 0     GlobusFuncName(wsu_AttributedDateTime_deserialize_contents);
1082 0     GlobusSoapMessageDebugEnter();
1083
1084 0     result = wsu_AttributedDateTime_deserialize(
1085         NULL,
1086         inst,
1087         message_handle,
1088         options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
1089 0     if(result != GLOBUS_SUCCESS)
1090     {
1091 0         result = GlobusSoapMessageErrorDeserializeFailed(
1092             result, element_qname);
1093         goto exit;
1094     }
1095
1096  exit:
1097
1098 0     GlobusSoapMessageDebugExit();
1099 0     return result;
1100 }
1101
1102
1103
1104 globus_result_t
1105 wsu_AttributedDateTime_deserialize(
1106     xsd_QName *                         element_qname,
1107     wsu_AttributedDateTime * instance,
1108     globus_soap_message_handle_t        message_handle,
1109     globus_xsd_element_options_t        options)
1110 0 {
1111 0     globus_result_t                     result = GLOBUS_SUCCESS;
1112 0     xsd_QName                           subelement;
1113 0     GlobusFuncName(wsu_AttributedDateTime_deserialize);
1114 0     GlobusSoapMessageDebugEnter();
1115
1116
1117 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
1118     {
1119 0         result = globus_soap_message_deserialize_element(
1120             message_handle, element_qname);
1121 0         if(result != GLOBUS_SUCCESS)
1122         {
1123 0             result = GlobusSoapMessageErrorDeserializeFailed(
1124                 result, element_qname);
1125 0             goto exit;
1126         }
1127
1128 0     subelement.Namespace = "";
1129 0     subelement.local = "ValueType";
1130
1131 0     result = xsd_QName_deserialize_attribute_pointer(
1132         &subelement,
1133         &instance->_ValueType,
1134         message_handle,
1135         0);
1136 0     if(result != GLOBUS_SUCCESS)
1137     {
1138 0         result = GlobusSoapMessageErrorDeserializeFailed(result, &subelement);
1139 0         goto _ValueType_destroy;
1140     }
1141
1142
1143 0     subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/07/utility";
1144 0     subelement.local = "Id";
1145
1146 0     result = xsd_ID_deserialize_attribute_pointer(
1147         &subelement,
1148         &instance->_Id,
1149         message_handle,
1150         0);
1151 0     if(result != GLOBUS_SUCCESS)
1152     {
1153 0         result = GlobusSoapMessageErrorDeserializeFailed(result, &subelement);
1154 0         goto _Id_destroy;
1155     }
1156
1157
1158 0         result = xsd_anyAttributes_init(&instance->anyAttributes);
1159 0         if(result != GLOBUS_SUCCESS)
1160         {
1161 0             result = GlobusSoapMessageErrorDeserializeFailed(
1162                 result, element_qname);
1163 0             goto xsd_anyAttributes_after_destroy;
1164         }
1165
1166 0         result = xsd_anyAttributes_deserialize(
1167             message_handle,
1168             instance->anyAttributes);
1169 0         if(result != GLOBUS_SUCCESS)
1170         {
1171 0             result = GlobusSoapMessageErrorDeserializeFailed(
1172                 result, element_qname);
1173 0             goto xsd_anyAttributes_destroy;
1174         }
1175
1176
1177 0         result = globus_soap_message_deserialize_element_begin_close(
1178             message_handle);
1179 0         if(result != GLOBUS_SUCCESS)
1180         {
1181 0             result = GlobusSoapMessageErrorDeserializeFailed(
1182                 result, element_qname);
1183 0             goto fail_deserialize;
1184         }
1185     }
1186
1187 0     subelement.local = "base_value";
1188 0     subelement.Namespace = NULL;
1189
1190 0     result = xsd_string_deserialize(
1191         &subelement,
1192         &instance->base_value,
1193         message_handle,
1194         GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
1195 0     if(result != GLOBUS_SUCCESS)
1196     {
1197 0         result = GlobusSoapMessageErrorDeserializeFailed(
1198             result,
1199             &xsd_string_qname);
1200 0         goto base_value_destroy;
1201     }
1202
1203 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
1204     {
1205 0         result = globus_soap_message_deserialize_element_end(
1206             message_handle,
1207             element_qname);
1208 0         if(result != GLOBUS_SUCCESS)
1209         {
1210 0             result = GlobusSoapMessageErrorDeserializeFailed(
1211                 result, element_qname);
1212             goto fail_deserialize;
1213         }
1214     }
1215
1216 0     goto exit;
1217
1218  fail_deserialize:
1219
1220  xsd_anyAttributes_destroy:
1221 0         xsd_anyAttributes_destroy(instance->anyAttributes);
1222 0         instance->anyAttributes = NULL;
1223  xsd_anyAttributes_after_destroy:
1224 0         xsd_string_destroy_contents(
1225             &instance->base_value);
1226
1227  base_value_destroy:
1228
1229  _ValueType_destroy:
1230
1231 0     if(instance->_ValueType)
1232     {
1233 0         xsd_QName_destroy(
1234             instance->_ValueType);
1235 0         instance->_ValueType = NULL;
1236     }
1237
1238  _Id_destroy:
1239
1240 0     if(instance->_Id)
1241     {
1242 0         xsd_ID_destroy(
1243             instance->_Id);
1244 0         instance->_Id = NULL;
1245     }
1246
1247
1248  exit:
1249
1250 0     GlobusSoapMessageDebugExit();
1251 0     return result;
1252 }
1253
1254
1255
1256 globus_result_t
1257 wsu_AttributedDateTime_deserialize_pointer(
1258     xsd_QName *                         element_qname,
1259     wsu_AttributedDateTime ** ip,
1260     globus_soap_message_handle_t        message_handle,
1261     globus_xsd_element_options_t        options)
1262 0 {
1263 0     wsu_AttributedDateTime * instance = NULL;
1264 0     globus_result_t                     result = GLOBUS_SUCCESS;
1265 0     xsd_QName                           subelement;
1266 0     int                                 found_attrs = 0;
1267 0     int                                 empty_element = 0;
1268 0     GlobusFuncName(wsu_AttributedDateTime_deserialize_pointer);
1269 0     GlobusSoapMessageDebugEnter();
1270
1271 0     *ip = NULL;
1272
1273 0     result = globus_soap_message_deserialize_element(
1274         message_handle, element_qname);
1275 0     if(result != GLOBUS_SUCCESS &&
1276        (GlobusSoapMessageStatusElementNotFoundCheck(result) ||
1277         GlobusSoapMessageStatusFailedElementCheck(result) ||
1278         GlobusSoapMessageStatusFailedWithTextCheck(result)))
1279     {
1280 0         *ip = NULL;
1281 0         result = GLOBUS_SUCCESS;
1282 0         goto exit;
1283     }
1284
1285 0     if(result != GLOBUS_SUCCESS)
1286     {
1287 0         result = GlobusSoapMessageErrorDeserializeFailed(
1288             result, element_qname);
1289 0         goto exit;
1290     }
1291
1292 0     if(globus_soap_message_deserialize_element_is_empty(
1293            message_handle))
1294     {
1295 0         empty_element = 1;
1296     }
1297
1298
1299
1300 0     result = wsu_AttributedDateTime_init(&instance);
1301 0     if(result != GLOBUS_SUCCESS)
1302     {
1303 0         result = GlobusSoapMessageErrorDeserializeFailed(
1304             result, element_qname);
1305 0         goto exit;
1306     }
1307
1308
1309 0     subelement.Namespace = "";
1310 0     subelement.local = "ValueType";
1311
1312 0     result = xsd_QName_deserialize_attribute_pointer(
1313         &subelement,
1314         &instance->_ValueType,
1315         message_handle,
1316         0);
1317 0     if(result != GLOBUS_SUCCESS)
1318     {
1319 0         result = GlobusSoapMessageErrorDeserializeFailed(result, &subelement);
1320 0         goto _ValueType_destroy;
1321     }
1322
1323
1324 0     if(instance->_ValueType)
1325     {
1326 0         found_attrs++;
1327     }
1328
1329 0     subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/07/utility";
1330 0     subelement.local = "Id";
1331
1332 0     result = xsd_ID_deserialize_attribute_pointer(
1333         &subelement,
1334         &instance->_Id,
1335         message_handle,
1336         0);
1337 0     if(result != GLOBUS_SUCCESS)
1338     {
1339 0         result = GlobusSoapMessageErrorDeserializeFailed(result, &subelement);
1340 0         goto _Id_destroy;
1341     }
1342
1343
1344 0     if(instance->_Id)
1345     {
1346 0         found_attrs++;
1347     }
1348
1349 0         result = xsd_anyAttributes_init(&instance->anyAttributes);
1350 0         if(result != GLOBUS_SUCCESS)
1351         {
1352 0             result = GlobusSoapMessageErrorDeserializeFailed(
1353                 result, element_qname);
1354 0             goto xsd_anyAttributes_after_destroy;
1355         }
1356
1357 0         result = xsd_anyAttributes_deserialize(
1358             message_handle,
1359             instance->anyAttributes);
1360 0         if(result != GLOBUS_SUCCESS)
1361         {
1362 0             result = GlobusSoapMessageErrorDeserializeFailed(
1363                 result, element_qname);
1364 0             goto xsd_anyAttributes_destroy;
1365         }
1366
1367 0         if(instance->anyAttributes &&
1368            xsd_anyAttributes_size(instance->anyAttributes) > 0)
1369         {
1370 0             found_attrs++;
1371         }
1372
1373
1374 0     if(empty_element)
1375     {
1376 0         result = globus_soap_message_deserialize_element_end(
1377             message_handle,
1378             element_qname);
1379 0         if(result != GLOBUS_SUCCESS)
1380         {
1381 0             result = GlobusSoapMessageErrorDeserializeFailed(
1382                 result, element_qname);
1383 0             goto fail_deserialize;
1384         }
1385
1386 0         *ip = instance;
1387 0         goto exit;
1388     }
1389
1390 0     result = globus_soap_message_deserialize_element_begin_close(
1391         message_handle);
1392 0     if(result != GLOBUS_SUCCESS)
1393     {
1394 0         result = GlobusSoapMessageErrorDeserializeFailed(
1395             result, element_qname);
1396 0         goto exit;
1397     }
1398
1399
1400 0     subelement.local = "base_value";
1401 0     subelement.Namespace = NULL;
1402
1403 0     result = xsd_string_deserialize(
1404         &subelement,
1405         &instance->base_value,
1406         message_handle,
1407         GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
1408 0     if(result != GLOBUS_SUCCESS)
1409     {
1410 0         result = GlobusSoapMessageErrorDeserializeFailed(
1411             result,
1412             &xsd_string_qname);
1413 0         goto base_value_destroy;
1414     }
1415
1416
1417 0     result = globus_soap_message_deserialize_element_end(
1418         message_handle,
1419         element_qname);
1420 0     if(result != GLOBUS_SUCCESS)
1421     {
1422 0         result = GlobusSoapMessageErrorDeserializeFailed(
1423             result, element_qname);
1424 0         goto fail_deserialize;
1425     }
1426
1427 0     *ip = instance;
1428
1429 0     goto exit;
1430
1431  fail_deserialize:
1432
1433  xsd_anyAttributes_destroy:
1434 0         xsd_anyAttributes_destroy(instance->anyAttributes);
1435 0         instance->anyAttributes = NULL;
1436  xsd_anyAttributes_after_destroy:
1437 0         xsd_string_destroy_contents(
1438             &instance->base_value);
1439
1440  base_value_destroy:
1441
1442  _ValueType_destroy:
1443
1444 0     if(instance->_ValueType)
1445     {
1446 0         xsd_QName_destroy(
1447             instance->_ValueType);
1448 0         instance->_ValueType = NULL;
1449     }
1450
1451  _Id_destroy:
1452
1453 0     if(instance->_Id)
1454     {
1455 0         xsd_ID_destroy(
1456             instance->_Id);
1457 0         instance->_Id = NULL;
1458     }
1459
1460  exit:
1461
1462 0     GlobusSoapMessageDebugExit();
1463 0     return result;
1464 }
1465
1466
1467 globus_result_t
1468 wsu_AttributedDateTime_array_init_contents(
1469     wsu_AttributedDateTime_array * array)
1470 0 {
1471 0     GlobusFuncName(wsu_AttributedDateTime_array_init_contents);
1472 0     GlobusSoapMessageDebugEnter();
1473
1474 0     memset(array, 0, sizeof(wsu_AttributedDateTime_array));
1475
1476 0     GlobusSoapMessageDebugExit();
1477 0     return GLOBUS_SUCCESS;
1478 }
1479
1480 globus_result_t
1481 wsu_AttributedDateTime_array_init(
1482     wsu_AttributedDateTime_array ** arr)
1483 0 {
1484 0     wsu_AttributedDateTime_array * array;
1485 0     globus_result_t                     result;
1486 0     GlobusFuncName(wsu_AttributedDateTime_array_init);
1487 0     GlobusSoapMessageDebugEnter();
1488
1489 0     array = (wsu_AttributedDateTime_array *)
1490         globus_malloc(sizeof(wsu_AttributedDateTime_array));
1491 0     if(!array)
1492     {
1493 0         result = GlobusSoapMessageErrorOutOfMemory;
1494 0         goto exit;
1495     }
1496
1497 0     result = wsu_AttributedDateTime_array_init_contents(array);
1498 0     if(result != GLOBUS_SUCCESS)
1499     {
1500 0         globus_free(array);
1501 0         array = NULL;
1502
1503     }
1504
1505 0     *arr = array;
1506
1507  exit:
1508 0     GlobusSoapMessageDebugExit();
1509 0     return result;
1510 }
1511
1512 void
1513 wsu_AttributedDateTime_array_destroy_contents(
1514     wsu_AttributedDateTime_array * array)
1515 0 {
1516 0     int                                 i = 0;
1517 0     GlobusFuncName(wsu_AttributedDateTime_array_destroy_contents);
1518 0     GlobusSoapMessageDebugEnter();
1519
1520 0     for(; i < array->length; ++i)
1521     {
1522 0         wsu_AttributedDateTime_destroy_contents(&array->elements[i]);
1523     }
1524
1525 0     if(array->elements)
1526     {
1527 0         globus_free(array->elements);
1528 0         array->elements = NULL;
1529     }
1530 0     array->length = 0;
1531
1532 0     GlobusSoapMessageDebugExit();
1533 }
1534
1535 void
1536 wsu_AttributedDateTime_array_destroy(
1537     wsu_AttributedDateTime_array * array)
1538 0 {
1539 0     GlobusFuncName(wsu_AttributedDateTime_array_destroy);
1540 0     GlobusSoapMessageDebugEnter();
1541
1542 0     wsu_AttributedDateTime_array_destroy_contents(array);
1543 0     globus_free(array);
1544
1545 0     GlobusSoapMessageDebugExit();
1546 }
1547
1548 globus_result_t
1549 wsu_AttributedDateTime_array_copy(
1550     wsu_AttributedDateTime_array ** dest_arr,
1551     const wsu_AttributedDateTime_array * src_arr)
1552 0 {
1553 0     wsu_AttributedDateTime_array * array;
1554 0     globus_result_t                     result;
1555 0     GlobusFuncName(wsu_AttributedDateTime_array_copy);
1556 0     GlobusSoapMessageDebugEnter();
1557
1558 0     array = (wsu_AttributedDateTime_array *) globus_malloc(
1559         sizeof(wsu_AttributedDateTime_array));
1560 0     if(!array)
1561     {
1562 0         result = GlobusSoapMessageErrorOutOfMemory;
1563 0         GlobusSoapMessageDebugExit();
1564 0         return result;
1565     }
1566
1567 0     result = wsu_AttributedDateTime_array_copy_contents(array, src_arr);
1568 0     if(result != GLOBUS_SUCCESS)
1569     {
1570 0         globus_free(array);
1571 0         GlobusSoapMessageDebugExit();
1572 0         return result;
1573     }
1574
1575 0     *dest_arr = array;
1576
1577 0     GlobusSoapMessageDebugExit();
1578 0     return GLOBUS_SUCCESS;
1579 }
1580
1581 globus_result_t
1582 wsu_AttributedDateTime_array_copy_contents(
1583     wsu_AttributedDateTime_array * dest_arr,
1584     const wsu_AttributedDateTime_array * src_arr)
1585 0 {
1586 0     int                                 i;
1587 0     globus_result_t                     result = GLOBUS_SUCCESS;
1588 0     GlobusFuncName(wsu_AttributedDateTime_array_copy_contents);
1589 0     GlobusSoapMessageDebugEnter();
1590
1591 0     dest_arr->length = src_arr->length;
1592 0     if(dest_arr->length > 0)
1593     {
1594 0         dest_arr->elements = (wsu_AttributedDateTime *) malloc(
1595             sizeof(wsu_AttributedDateTime) * dest_arr->length);
1596 0         if(!dest_arr->elements)
1597         {
1598 0             result = GlobusSoapMessageErrorOutOfMemory;
1599 0             GlobusSoapMessageDebugExit();
1600 0             return result;
1601         }
1602     }
1603     else
1604     {
1605 0         dest_arr->elements = NULL;
1606     }
1607     
1608 0     for(i = 0; i < dest_arr->length; i++)
1609     {
1610 0         result = wsu_AttributedDateTime_copy_contents(
1611             &dest_arr->elements[i], &src_arr->elements[i]);
1612 0         if(result != GLOBUS_SUCCESS)
1613         {
1614 0             while(i--)
1615             {
1616 0                 wsu_AttributedDateTime_destroy_contents(&dest_arr->elements[i]);
1617             }
1618
1619 0             globus_free(dest_arr->elements);
1620 0             dest_arr->elements = NULL;
1621 0             dest_arr->length = 0;
1622 0             break;
1623         }
1624     }
1625
1626 0     GlobusSoapMessageDebugExit();
1627 0     return result;
1628 }
1629
1630 wsu_AttributedDateTime *
1631 wsu_AttributedDateTime_array_push(
1632     wsu_AttributedDateTime_array * array)
1633 0 {
1634 0     GlobusFuncName(wsu_AttributedDateTime_array_push);
1635 0     GlobusSoapMessageDebugEnter();
1636
1637 0     array->elements = realloc(array->elements,
1638                               sizeof(wsu_AttributedDateTime) *
1639                               (array->length + 1));
1640 0     memset(&array->elements[array->length], 0, sizeof(wsu_AttributedDateTime));
1641 0     array->length++;
1642
1643 0     GlobusSoapMessageDebugExit();
1644 0     return (&array->elements[array->length - 1]);
1645 }
1646
1647 void *
1648 wsu_AttributedDateTime_array_push_wrapper(
1649     void * array)
1650 0 {
1651 0     return (void *) wsu_AttributedDateTime_array_push((wsu_AttributedDateTime_array *) array);
1652 }
1653
1654 globus_result_t
1655 wsu_AttributedDateTime_array_serialize(
1656     xsd_QName *                         element_qname,
1657     wsu_AttributedDateTime_array * array,
1658     globus_soap_message_handle_t        message,
1659     globus_xsd_element_options_t        options)
1660 0 {
1661 0     globus_result_t                     result = GLOBUS_SUCCESS;
1662 0     int                                 i = 0;
1663 0     GlobusFuncName(wsu_AttributedDateTime_array_serialize);
1664 0     GlobusSoapMessageDebugEnter();
1665
1666 0     for(; i < array->length; ++i)
1667     {
1668 0         result = wsu_AttributedDateTime_serialize(
1669             element_qname,
1670             &array->elements[i],
1671             message,
1672             options);
1673 0         if(result != GLOBUS_SUCCESS)
1674         {
1675 0             goto exit;
1676         }
1677     }
1678
1679 exit:
1680
1681 0     GlobusSoapMessageDebugExit();
1682 0     return result;
1683 }
1684
1685 globus_result_t
1686 wsu_AttributedDateTime_array_deserialize(
1687     xsd_QName *                         element_qname,
1688     wsu_AttributedDateTime_array * array,
1689     globus_soap_message_handle_t        message,
1690     globus_xsd_element_options_t        options)
1691 0 {
1692 0     globus_result_t                     result = GLOBUS_SUCCESS;
1693 0     int                                 i = 0;
1694 0     int                                 pre_length;
1695 0     GlobusFuncName(wsu_AttributedDateTime_array_deserialize);
1696 0     GlobusSoapMessageDebugEnter();
1697
1698 0     pre_length = array->length;
1699
1700 0     for(i = 0; i < pre_length; ++i)
1701     {
1702 0         result = wsu_AttributedDateTime_deserialize(
1703             element_qname,
1704             &array->elements[i],
1705             message,
1706             options);
1707 0         if(result != GLOBUS_SUCCESS)
1708         {
1709 0             if(GlobusSoapMessageStatusFailedElementCheck(result) ||
1710                GlobusSoapMessageStatusElementNotFoundCheck(result) ||
1711                GlobusSoapMessageStatusFailedWithTextCheck(result))
1712             {
1713 0                 result = GLOBUS_SUCCESS;
1714 0                 break;
1715             }
1716
1717 0             result = GlobusSoapMessageErrorDeserializeFailed(
1718                 result, element_qname);
1719 0             goto exit;
1720         }
1721     }
1722
1723 0     while(result == GLOBUS_SUCCESS)
1724     {
1725 0         wsu_AttributedDateTime                  next;
1726 0         memset(&next, 0, sizeof(wsu_AttributedDateTime));
1727
1728 0         result = wsu_AttributedDateTime_deserialize(
1729             element_qname,
1730             &next,
1731             message,
1732             options);
1733 0         if(result != GLOBUS_SUCCESS)
1734         {
1735 0             if(GlobusSoapMessageStatusFailedElementCheck(result) ||
1736                GlobusSoapMessageStatusElementNotFoundCheck(result) ||
1737                GlobusSoapMessageStatusFailedWithTextCheck(result))
1738             {
1739 0                 result = GLOBUS_SUCCESS;
1740 0                 break;
1741             }
1742
1743 0             result = GlobusSoapMessageErrorDeserializeFailed(
1744                 result, element_qname);
1745 0             goto exit;
1746         }
1747
1748 0         array->elements = realloc(
1749             array->elements,
1750             (array->length + 1) * sizeof(wsu_AttributedDateTime));
1751 0         if(!array->elements)
1752         {
1753 0             result = GlobusSoapMessageErrorOutOfMemory;
1754 0             goto exit;
1755         }
1756 0         array->elements[array->length] = next;
1757 0         array->length++;
1758 0         ++i;
1759     }
1760
1761   exit:
1762
1763 0     if(result != GLOBUS_SUCCESS)
1764     {
1765 0         int                             di = 0;
1766 0         for(; di < i; ++di)
1767         {
1768 0             wsu_AttributedDateTime_destroy_contents(
1769                 &array->elements[di]);
1770 0             memset(&array->elements[di], 0, sizeof(wsu_AttributedDateTime));
1771         }
1772     }
1773
1774 0     GlobusSoapMessageDebugExit();
1775 0     return result;