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 "wsrl_TerminationNotificationType.h"
21
22 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
23 xsd_QName wsrl_TerminationNotificationType_qname =
24 {
25     WSRL_TERMINATIONNOTIFICATIONTYPE_NS,
26     WSRL_TERMINATIONNOTIFICATIONTYPE_LOCAL
27 };
28 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
29
30 globus_result_t
31 wsrl_TerminationNotificationType_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 wsrl_TerminationNotificationType_serialize(
38         element_qname,
39         (wsrl_TerminationNotificationType *) instance,
40         message_handle, options);
41 }
42
43 globus_result_t
44 wsrl_TerminationNotificationType_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 wsrl_TerminationNotificationType_deserialize_pointer(
51         element_qname,
52         (wsrl_TerminationNotificationType **) ip,
53         message_handle, options);
54 }
55
56 globus_result_t
57 wsrl_TerminationNotificationType_init_wrapper(void **object)
58 0 {
59 0     return wsrl_TerminationNotificationType_init(
60         (wsrl_TerminationNotificationType **) object);
61 }
62
63 void
64 wsrl_TerminationNotificationType_destroy_wrapper(
65     void *                          object)
66 0 {
67 0     wsrl_TerminationNotificationType_destroy(
68         (wsrl_TerminationNotificationType *) object);
69 }
70
71 globus_result_t
72 wsrl_TerminationNotificationType_copy_wrapper(
73     void **                         dest_obj,
74     void *                          src_obj)
75 0 {
76 0     return wsrl_TerminationNotificationType_copy(
77         (wsrl_TerminationNotificationType **) dest_obj,
78         (wsrl_TerminationNotificationType *) src_obj);
79 }
80
81 globus_result_t
82 wsrl_TerminationNotificationType_init_contents_wrapper(void *object)
83 0 {
84 0     return wsrl_TerminationNotificationType_init_contents(
85         (wsrl_TerminationNotificationType *) object);
86 }
87
88 void
89 wsrl_TerminationNotificationType_destroy_contents_wrapper(
90     void *                          object)
91 0 {
92 0     wsrl_TerminationNotificationType_destroy_contents(
93         (wsrl_TerminationNotificationType *) object);
94 }
95
96 globus_result_t
97 wsrl_TerminationNotificationType_copy_contents_wrapper(
98     void *                          dest_obj,
99     void *                          src_obj)
100 0 {
101 0     return wsrl_TerminationNotificationType_copy_contents(
102         (wsrl_TerminationNotificationType *) dest_obj,
103         (wsrl_TerminationNotificationType *) src_obj);
104 }
105
106 globus_result_t
107 wsrl_TerminationNotificationType_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 wsrl_TerminationNotificationType_serialize_contents(
114         element_qname,
115         (wsrl_TerminationNotificationType *) instance,
116         message_handle, options);
117 }
118
119 globus_result_t
120 wsrl_TerminationNotificationType_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(wsrl_TerminationNotificationType_deserialize_contents_wrapper);
128 0     GlobusSoapMessageDebugEnter();
129
130 0     if(!*instance)
131     {
132 0         result = wsrl_TerminationNotificationType_init(
133             (wsrl_TerminationNotificationType **)instance);
134 0         if(result != GLOBUS_SUCCESS)
135         {
136 0             goto error;
137         }
138     }
139
140 0     result = wsrl_TerminationNotificationType_deserialize_contents(
141         element_qname,
142         *(wsrl_TerminationNotificationType **)instance,
143         message_handle, options);
144 error:
145 0     GlobusSoapMessageDebugExit();
146 0     return result;
147 }
148
149 globus_result_t
150 wsrl_TerminationNotificationType_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 wsrl_TerminationNotificationType_array_serialize(
157         element,
158         (wsrl_TerminationNotificationType_array *) instance,
159         message, options);
160 }
161
162 globus_result_t
163 wsrl_TerminationNotificationType_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 = wsrl_TerminationNotificationType_array_init(
174             (wsrl_TerminationNotificationType_array **)inst);
175 0         if(result != GLOBUS_SUCCESS)
176         {
177 0             return result;
178         }
179     }
180
181 0     return wsrl_TerminationNotificationType_array_deserialize(
182         element_qname,
183         *(wsrl_TerminationNotificationType_array **) inst,
184         message, options);
185 }
186
187 globus_result_t
188 wsrl_TerminationNotificationType_array_init_wrapper(
189     void **                             arr)
190 0 {
191 0     return wsrl_TerminationNotificationType_array_init(
192         (wsrl_TerminationNotificationType_array **) arr);
193 }
194
195 void
196 wsrl_TerminationNotificationType_array_destroy_wrapper(
197     void *                              arr)
198 0 {
199 0     wsrl_TerminationNotificationType_array_destroy(
200         (wsrl_TerminationNotificationType_array *) arr);
201 }
202
203 globus_result_t
204 wsrl_TerminationNotificationType_array_copy_wrapper(
205     void **                             dest_arr,
206     void *                              src_arr)
207 0 {
208 0     return wsrl_TerminationNotificationType_array_copy(
209         (wsrl_TerminationNotificationType_array **) dest_arr,
210         (wsrl_TerminationNotificationType_array *) src_arr);
211 }
212
213 globus_result_t
214 wsrl_TerminationNotificationType_array_init_contents_wrapper(
215     void *                              arr)
216 0 {
217 0     return wsrl_TerminationNotificationType_array_init_contents(
218         (wsrl_TerminationNotificationType_array *) arr);
219 }
220
221 void
222 wsrl_TerminationNotificationType_array_destroy_contents_wrapper(
223     void *                              arr)
224 0 {
225 0     wsrl_TerminationNotificationType_array_destroy_contents(
226         (wsrl_TerminationNotificationType_array *) arr);
227 }
228
229 globus_result_t
230 wsrl_TerminationNotificationType_array_copy_contents_wrapper(
231     void *                              dest_arr,
232     void *                              src_arr)
233 0 {
234 0     return wsrl_TerminationNotificationType_array_copy_contents(
235         (wsrl_TerminationNotificationType_array *) dest_arr,
236         (wsrl_TerminationNotificationType_array *) src_arr);
237 }
238
239 struct globus_xsd_type_info_s wsrl_TerminationNotificationType_contents_info =
240 {
241     &wsrl_TerminationNotificationType_qname,
242     wsrl_TerminationNotificationType_serialize_contents_wrapper,
243     wsrl_TerminationNotificationType_deserialize_contents_wrapper,
244     wsrl_TerminationNotificationType_init_wrapper,
245     wsrl_TerminationNotificationType_destroy_wrapper,
246     wsrl_TerminationNotificationType_copy_wrapper,
247     wsrl_TerminationNotificationType_init_contents_wrapper,
248     wsrl_TerminationNotificationType_destroy_contents_wrapper,
249     wsrl_TerminationNotificationType_copy_contents_wrapper,
250     sizeof(wsrl_TerminationNotificationType),
251     NULL,
252     NULL,
253     NULL
254 };
255
256 struct globus_xsd_type_info_s wsrl_TerminationNotificationType_array_info =
257 {
258     &wsrl_TerminationNotificationType_qname,
259     wsrl_TerminationNotificationType_array_serialize_wrapper,
260     wsrl_TerminationNotificationType_array_deserialize_wrapper,
261     wsrl_TerminationNotificationType_array_init_wrapper,
262     wsrl_TerminationNotificationType_array_destroy_wrapper,
263     wsrl_TerminationNotificationType_array_copy_wrapper,
264     wsrl_TerminationNotificationType_array_init_contents_wrapper,
265     wsrl_TerminationNotificationType_array_destroy_contents_wrapper,
266     wsrl_TerminationNotificationType_array_copy_contents_wrapper,
267     sizeof(wsrl_TerminationNotificationType),
268     wsrl_TerminationNotificationType_array_push_wrapper,
269     NULL,
270     NULL
271 };
272
273 struct globus_xsd_type_info_s wsrl_TerminationNotificationType_info =
274 {
275     &wsrl_TerminationNotificationType_qname,
276     wsrl_TerminationNotificationType_serialize_wrapper,
277     wsrl_TerminationNotificationType_deserialize_pointer_wrapper,
278     wsrl_TerminationNotificationType_init_wrapper,
279     wsrl_TerminationNotificationType_destroy_wrapper,
280     wsrl_TerminationNotificationType_copy_wrapper,
281     wsrl_TerminationNotificationType_init_contents_wrapper,
282     wsrl_TerminationNotificationType_destroy_contents_wrapper,
283     wsrl_TerminationNotificationType_copy_contents_wrapper,
284     sizeof(wsrl_TerminationNotificationType),
285     NULL,
286     &wsrl_TerminationNotificationType_contents_info,
287     &wsrl_TerminationNotificationType_array_info
288 };
289
290 globus_result_t
291 wsrl_TerminationNotificationType_init_contents(
292     wsrl_TerminationNotificationType * instance)
293 0 {
294 0     globus_result_t                     result = GLOBUS_SUCCESS;
295 0     GlobusFuncName(wsrl_TerminationNotificationType_init_contents);
296 0     GlobusSoapMessageDebugEnter();
297
298 0     memset(instance, 0, sizeof(wsrl_TerminationNotificationType));
299
300 0     GlobusSoapMessageDebugExit();
301 0     return result;
302 }
303
304 globus_result_t
305 wsrl_TerminationNotificationType_init(
306     wsrl_TerminationNotificationType ** object)
307 0 {
308 0     wsrl_TerminationNotificationType * instance;
309 0     globus_result_t                     result = GLOBUS_SUCCESS;
310 0     GlobusFuncName(wsrl_TerminationNotificationType_init);
311 0     GlobusSoapMessageDebugEnter();
312
313 0     instance = globus_malloc(sizeof(wsrl_TerminationNotificationType));
314 0     if(!instance)
315     {
316 0         result = GlobusSoapMessageErrorOutOfMemory;
317 0         goto exit;
318     }
319
320 0     memset(instance, 0, sizeof(wsrl_TerminationNotificationType));
321
322 0     *object = instance;
323
324  exit:
325 0     GlobusSoapMessageDebugExit();
326 0     return result;
327 }
328
329 void
330 wsrl_TerminationNotificationType_destroy(
331     wsrl_TerminationNotificationType * instance)
332 0 {
333 0     GlobusFuncName(wsrl_TerminationNotificationType_destroy);
334 0     GlobusSoapMessageDebugEnter();
335
336 0     if(!instance)
337     {
338 0         goto exit;
339     }
340
341 0     wsrl_TerminationNotificationType_destroy_contents(instance);
342 0     globus_free(instance);
343
344  exit:
345
346 0     GlobusSoapMessageDebugExit();
347 }
348
349 void
350 wsrl_TerminationNotificationType_destroy_contents(
351     wsrl_TerminationNotificationType * instance)
352 0 {
353 0     GlobusFuncName(wsrl_TerminationNotificationType_destroy_contents);
354 0     GlobusSoapMessageDebugEnter();
355
356 0     if(instance)
357     {
358
359
360 0     xsd_dateTime_destroy_contents(
361          &instance->TerminationTime);
362
363 0     xsd_anyType_destroy(instance->TerminationReason);
364 0     instance->TerminationReason = NULL;
365
366     }
367
368 0     GlobusSoapMessageDebugExit();
369 }
370
371 globus_result_t
372 wsrl_TerminationNotificationType_copy(
373     wsrl_TerminationNotificationType ** dest_obj,
374     const wsrl_TerminationNotificationType * src_obj)
375 0 {
376 0     globus_result_t                     result = GLOBUS_SUCCESS;
377 0     wsrl_TerminationNotificationType * instance;
378 0     GlobusFuncName(wsrl_TerminationNotificationType_copy);
379
380 0     GlobusSoapMessageDebugEnter();
381
382 0     instance = malloc(sizeof(wsrl_TerminationNotificationType));
383 0     if (instance == NULL)
384     {
385 0         GlobusSoapMessageDebugExit();
386 0         return GlobusSoapMessageErrorOutOfMemory;
387     }
388
389 0     result = wsrl_TerminationNotificationType_copy_contents(instance, src_obj);
390 0     if(result != GLOBUS_SUCCESS)
391     {
392 0         globus_free(instance);
393 0         GlobusSoapMessageDebugExit();
394 0         return GlobusSoapMessageErrorOutOfMemory;
395     }
396
397 0     *dest_obj = instance;
398 0     GlobusSoapMessageDebugExit();
399 0     return result;
400 }
401
402 globus_result_t
403 wsrl_TerminationNotificationType_copy_contents(
404     wsrl_TerminationNotificationType * instance,
405     const wsrl_TerminationNotificationType * src_obj)
406 0 {
407 0     globus_result_t                     result = GLOBUS_SUCCESS;
408 0     GlobusFuncName(wsrl_TerminationNotificationType_copy_contents);
409
410 0     GlobusSoapMessageDebugEnter();
411
412
413 0     result = xsd_dateTime_copy_contents(
414         &instance->TerminationTime,
415         &src_obj->TerminationTime);
416 0     if(result != GLOBUS_SUCCESS)
417     {
418 0         result = GlobusSoapMessageErrorCopyFailed(
419                 result, NULL, &xsd_dateTime_qname);
420 0         goto TerminationTime_destroy;
421     }
422
423 0     if(src_obj->TerminationReason)
424     {
425 0         result = xsd_anyType_copy(
426             &instance->TerminationReason,
427             src_obj->TerminationReason);
428 0         if(result != GLOBUS_SUCCESS)
429         {
430 0             result = GlobusSoapMessageErrorCopyFailed(
431                 result, NULL, &xsd_anyType_qname);
432 0             goto TerminationReason_destroy_pointer;
433         }
434     }
435     else
436     {
437 0         instance->TerminationReason = NULL;
438     }
439
440 0     goto exit;
441
442  fail_deserialize:
443 0         xsd_anyType_destroy(
444             instance->TerminationReason);
445 0          instance->TerminationReason = NULL;
446
447  TerminationReason_destroy_pointer:
448 0         xsd_dateTime_destroy_contents(
449              &instance->TerminationTime);
450
451  TerminationTime_destroy:
452
453
454  exit:
455
456 0     GlobusSoapMessageDebugExit();
457 0     return result;
458 }
459
460
461
462 globus_result_t
463 wsrl_TerminationNotificationType_serialize_contents(
464     xsd_QName *                         element_qname, /* ignored */
465     wsrl_TerminationNotificationType * inst,
466     globus_soap_message_handle_t        message_handle,
467     globus_xsd_element_options_t        options)
468 0 {
469 0     globus_result_t                     result = GLOBUS_SUCCESS;
470 0     GlobusFuncName(wsrl_TerminationNotificationType_serialize_contents);
471 0     GlobusSoapMessageDebugEnter();
472
473 0     result = wsrl_TerminationNotificationType_serialize(
474         NULL,
475         inst,
476         message_handle,
477         options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
478 0     if(result != GLOBUS_SUCCESS)
479     {
480 0         result = GlobusSoapMessageErrorSerializeFailed(
481             result, NULL, element_qname);
482         goto exit;
483     }
484
485  exit:
486
487 0     GlobusSoapMessageDebugExit();
488 0     return result;
489 }
490
491
492
493 globus_result_t
494 wsrl_TerminationNotificationType_serialize(
495     xsd_QName *                         element_qname,
496     wsrl_TerminationNotificationType * instance,
497     globus_soap_message_handle_t        message_handle,
498     globus_xsd_element_options_t        options)
499 0 {
500 0     globus_result_t                     result = GLOBUS_SUCCESS;
501 0     xsd_QName                           subelement;
502 0     globus_list_t *                     any_attr_keys = NULL;
503 0     globus_list_t *                     any_attr_keys_iterator = NULL;
504 0     xsd_QName *                         type_attr = NULL;
505 0     char *                              prefix = NULL;
506 0     int                                 prefix_created;
507 0     int                                 define_prefix = 0;
508 0     int                                 save_options = options;
509
510 0     GlobusFuncName(wsrl_TerminationNotificationType_serialize);
511 0     GlobusSoapMessageDebugEnter();
512
513
514 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
515     {
516         /* serialize wsrl_TerminationNotificationType element */
517
518 0         result = globus_soap_message_invoke_ns_callouts(
519             message_handle,
520             element_qname,
521             GLOBUS_SOAP_MESSAGE_CALLOUT_NS_SET,
522             &options);
523 0         if(result != GLOBUS_SUCCESS)
524         {
525 0             result = GlobusSoapMessageErrorSerializeFailed(
526                 result, NULL, element_qname);
527 0             goto exit;
528         }
529
530 0 result = globus_soap_message_element_ns_set(
531             message_handle,
532             element_qname->Namespace,
533             &options);
534 0         if(result != GLOBUS_SUCCESS)
535         {
536 0             result = GlobusSoapMessageErrorSerializeFailed(
537                 result, NULL, element_qname);
538 0             goto exit;
539         }
540
541 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
542    !globus_soap_message_serialize_is_c14n_subset(message_handle))
543         {
544 0             result = globus_soap_message_attribute_ns_set(
545                 message_handle,
546                 "http://www.w3.org/2001/XMLSchema-instance",
547                 &options);
548 0             if(result != GLOBUS_SUCCESS)
549             {
550 0                 result = GlobusSoapMessageErrorSerializeFailed(
551                     result, NULL, element_qname);
552 0                 goto exit;
553             }
554
555 0             result = globus_soap_message_attribute_ns_set(
556                 message_handle,
557                 wsrl_TerminationNotificationType_qname.Namespace,
558                 &options);
559 0             if(result != GLOBUS_SUCCESS)
560             {
561 0                 result = GlobusSoapMessageErrorSerializeFailed(
562                     result, NULL, element_qname);
563 0                 goto exit;
564             }
565         }
566
567 0         result = globus_soap_message_invoke_callouts(
568             message_handle,
569             element_qname,
570             GLOBUS_SOAP_MESSAGE_CALLOUT_BEGIN);
571 0         if(result != GLOBUS_SUCCESS)
572         {
573 0             result = GlobusSoapMessageErrorSerializeFailed(
574                 result, NULL, element_qname);
575 0             goto exit;
576         }
577
578 0         result = globus_soap_message_serialize_element(
579             message_handle,
580             element_qname,
581             options,
582             &wsrl_TerminationNotificationType_qname);
583 0         if(result != GLOBUS_SUCCESS)
584         {
585 0             result = GlobusSoapMessageErrorSerializeFailed(
586                 result, NULL, element_qname);
587 0             goto exit;
588         }
589
590 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
591    !globus_soap_message_serialize_is_c14n_subset(message_handle))
592         {
593 0            xsd_QName_init(&type_attr);
594        
595 0            type_attr->local = globus_libc_strdup("type");
596 0            type_attr->Namespace = globus_libc_strdup(XSI_NS);
597         }
598
599         /* serialize namespaces */
600         
601 0 result = globus_soap_message_invoke_ns_callouts(
602             message_handle,
603             element_qname,
604             GLOBUS_SOAP_MESSAGE_CALLOUT_NS_ADD,
605             &options);
606 0         if(result != GLOBUS_SUCCESS)
607         {
608 0             result = GlobusSoapMessageErrorSerializeFailed(
609                 result, NULL, element_qname);
610 0             goto exit;
611         }
612
613 0 result = globus_soap_message_element_ns_add(
614             message_handle,
615             element_qname->Namespace,
616             &options);
617 0         if(result != GLOBUS_SUCCESS)
618         {
619 0             result = GlobusSoapMessageErrorSerializeFailed(
620                 result, NULL, element_qname);
621 0             goto exit;
622         }
623
624 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
625    !globus_soap_message_serialize_is_c14n_subset(message_handle))
626         {
627 0             result = globus_soap_message_attribute_ns_add(
628                 message_handle,
629                 "http://www.w3.org/2001/XMLSchema-instance",
630                 &options);
631 0             if(result != GLOBUS_SUCCESS)
632             {
633 0                 result = GlobusSoapMessageErrorSerializeFailed(
634                     result, NULL, element_qname);
635 0                 goto exit;
636             }
637
638 0             result = globus_soap_message_attribute_ns_add(
639                 message_handle,
640                 wsrl_TerminationNotificationType_qname.Namespace,
641                 &options);
642 0             if(result != GLOBUS_SUCCESS)
643             {
644 0                 result = GlobusSoapMessageErrorSerializeFailed(
645                     result, NULL, element_qname);
646 0                 goto exit;
647             }
648         }
649
650         /* serialize attributes */
651
652 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
653    !globus_soap_message_serialize_is_c14n_subset(message_handle))
654         {
655 0             result = globus_soap_message_serialize_QName_attribute(
656                 message_handle,
657                 type_attr,
658                 &wsrl_TerminationNotificationType_qname);
659 0             if(result != GLOBUS_SUCCESS)
660             {
661 0                 result = GlobusSoapMessageErrorSerializeFailed(
662                     result, NULL, element_qname);
663 0                 goto exit;
664             }
665         }
666
667
668 0         result = globus_soap_message_invoke_callouts(
669             message_handle,
670             element_qname,
671             GLOBUS_SOAP_MESSAGE_CALLOUT_ATTR);
672 0         if(result != GLOBUS_SUCCESS)
673         {
674 0             result = GlobusSoapMessageErrorSerializeFailed(
675                 result, NULL, element_qname);
676 0             goto exit;
677         }
678     }
679
680 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
681     {
682 0         result = globus_soap_message_serialize_element_begin_close(
683             message_handle);
684 0         if(result != GLOBUS_SUCCESS)
685         {
686 0             result = GlobusSoapMessageErrorSerializeFailed(
687                 result, NULL, element_qname);
688 0             goto exit;
689         }
690     }
691 0     options &= ~GLOBUS_XSD_ELEMENT_CONTENTS_ONLY;
692
693     /* serialize contents of type */
694
695 0     subelement.local = "TerminationTime";
696 0     subelement.Namespace = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd";
697
698 0     result = xsd_dateTime_serialize(
699          &subelement,
700          &instance->TerminationTime,
701          message_handle,
702          options & (~GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS));
703 0     if(result != GLOBUS_SUCCESS)
704     {
705 0         result = GlobusSoapMessageErrorSerializeFailed(
706                 result, NULL, &xsd_dateTime_qname);
707 0         goto exit;
708     }
709
710 0     subelement.local = "TerminationReason";
711 0     subelement.Namespace = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd";
712
713 0     if(instance->TerminationReason)
714     {
715 0         result = xsd_anyType_serialize(
716             &subelement,
717             instance->TerminationReason,
718             message_handle,
719             options & (~GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS));
720 0         if(result != GLOBUS_SUCCESS)
721         {
722 0             result = GlobusSoapMessageErrorSerializeFailed(
723                 result, NULL, &xsd_anyType_qname);
724 0             goto exit;
725         }
726     }
727
728 0     options = save_options;
729
730 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
731     {
732         /* add end element */
733 0         result = globus_soap_message_serialize_element_end(
734             message_handle,
735             element_qname,
736             options,
737             &wsrl_TerminationNotificationType_qname);
738 0         if(result != GLOBUS_SUCCESS)
739         {
740 0             result = GlobusSoapMessageErrorSerializeFailed(
741                 result, NULL, element_qname);
742 0             goto exit;
743         }
744
745 0         globus_soap_message_element_ns_remove(
746             message_handle,
747             element_qname->Namespace,
748             &options);
749
750     /* remove namespace/prefix mappings for these types */
751
752 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
753    !globus_soap_message_serialize_is_c14n_subset(message_handle))
754         {
755 0             globus_soap_message_attribute_ns_remove(
756                 message_handle,
757                 "http://www.w3.org/2001/XMLSchema-instance",
758                 &options);
759            
760 0             globus_soap_message_attribute_ns_remove(
761                 message_handle,
762                 wsrl_TerminationNotificationType_qname.Namespace,
763                 &options);
764         }           
765
766 0         result = globus_soap_message_invoke_ns_callouts(
767             message_handle,
768             element_qname,
769             GLOBUS_SOAP_MESSAGE_CALLOUT_NS_REMOVE,
770             &options);
771 0         if(result != GLOBUS_SUCCESS)
772         {
773 0             result  = GlobusSoapMessageErrorSerializeFailed(
774                 result, NULL, element_qname);
775 0             goto exit;
776         }
777
778 0         result = globus_soap_message_invoke_callouts(
779             message_handle,
780             element_qname,
781             GLOBUS_SOAP_MESSAGE_CALLOUT_END);
782 0         if(result != GLOBUS_SUCCESS)
783         {
784 0             result = GlobusSoapMessageErrorSerializeFailed(
785                 result, NULL, element_qname);
786             goto exit;
787         }
788     }
789
790  exit:
791 0     if (type_attr)
792     {
793 0         xsd_QName_destroy(type_attr);
794     }
795
796 0     if(any_attr_keys)
797     {
798 0         globus_list_free(any_attr_keys);
799     }
800
801 0     GlobusSoapMessageDebugExit();
802 0     return result;
803 }
804
805
806
807 globus_result_t
808 wsrl_TerminationNotificationType_deserialize_contents(
809     xsd_QName *                         element_qname, /* ignored */
810     wsrl_TerminationNotificationType * inst,
811     globus_soap_message_handle_t        message_handle,
812     globus_xsd_element_options_t        options)
813 0 {
814 0     globus_result_t                     result = GLOBUS_SUCCESS;
815 0     GlobusFuncName(wsrl_TerminationNotificationType_deserialize_contents);
816 0     GlobusSoapMessageDebugEnter();
817
818 0     result = wsrl_TerminationNotificationType_deserialize(
819         NULL,
820         inst,
821         message_handle,
822         options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
823 0     if(result != GLOBUS_SUCCESS)
824     {
825 0         result = GlobusSoapMessageErrorDeserializeFailed(
826             result, element_qname);
827         goto exit;
828     }
829
830  exit:
831
832 0     GlobusSoapMessageDebugExit();
833 0     return result;
834 }
835
836
837
838 globus_result_t
839 wsrl_TerminationNotificationType_deserialize(
840     xsd_QName *                         element_qname,
841     wsrl_TerminationNotificationType * instance,
842     globus_soap_message_handle_t        message_handle,
843     globus_xsd_element_options_t        options)
844 0 {
845 0     globus_result_t                     result = GLOBUS_SUCCESS;
846 0     xsd_QName                           subelement;
847 0     GlobusFuncName(wsrl_TerminationNotificationType_deserialize);
848 0     GlobusSoapMessageDebugEnter();
849
850
851 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
852     {
853 0         result = globus_soap_message_deserialize_element(
854             message_handle, element_qname);
855 0         if(result != GLOBUS_SUCCESS)
856         {
857 0             result = GlobusSoapMessageErrorDeserializeFailed(
858                 result, element_qname);
859 0             goto exit;
860         }
861
862
863 0         result = globus_soap_message_deserialize_element_begin_close(
864             message_handle);
865 0         if(result != GLOBUS_SUCCESS)
866         {
867 0             result = GlobusSoapMessageErrorDeserializeFailed(
868                 result, element_qname);
869 0             goto fail_deserialize;
870         }
871     }
872
873 0     subelement.local = "TerminationTime";
874 0     subelement.Namespace = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd";
875
876 0     result = xsd_dateTime_deserialize(
877          &subelement,
878          &instance->TerminationTime,
879          message_handle,
880          0);
881 0     if(result != GLOBUS_SUCCESS)
882     {
883 0         result = GlobusSoapMessageErrorDeserializeFailed(
884             result, 
885             &xsd_dateTime_qname);
886 0         goto TerminationTime_destroy;
887     }
888
889 0     subelement.local = "TerminationReason";
890 0     subelement.Namespace = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd";
891
892 0     result = xsd_anyType_deserialize_pointer(
893         &subelement,
894         &instance->TerminationReason,
895         message_handle,
896         0);
897 0     if(result != GLOBUS_SUCCESS)
898     {
899 0         result = GlobusSoapMessageErrorDeserializeFailed(
900             result, 
901             (&subelement));
902 0         goto TerminationReason_destroy_pointer;
903     }
904
905 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
906     {
907 0         result = globus_soap_message_deserialize_element_end(
908             message_handle,
909             element_qname);
910 0         if(result != GLOBUS_SUCCESS)
911         {
912 0             result = GlobusSoapMessageErrorDeserializeFailed(
913                 result, element_qname);
914             goto fail_deserialize;
915         }
916     }
917
918 0     goto exit;
919
920  fail_deserialize:
921 0         xsd_anyType_destroy(
922             instance->TerminationReason);
923 0          instance->TerminationReason = NULL;
924
925  TerminationReason_destroy_pointer:
926 0         xsd_dateTime_destroy_contents(
927              &instance->TerminationTime);
928
929  TerminationTime_destroy:
930
931
932  exit:
933
934 0     GlobusSoapMessageDebugExit();
935 0     return result;
936 }
937
938
939
940 globus_result_t
941 wsrl_TerminationNotificationType_deserialize_pointer(
942     xsd_QName *                         element_qname,
943     wsrl_TerminationNotificationType ** ip,
944     globus_soap_message_handle_t        message_handle,
945     globus_xsd_element_options_t        options)
946 0 {
947 0     wsrl_TerminationNotificationType * instance = NULL;
948 0     globus_result_t                     result = GLOBUS_SUCCESS;
949 0     xsd_QName                           subelement;
950 0     int                                 found_attrs = 0;
951 0     int                                 empty_element = 0;
952 0     GlobusFuncName(wsrl_TerminationNotificationType_deserialize_pointer);
953 0     GlobusSoapMessageDebugEnter();
954
955 0     *ip = NULL;
956
957 0     result = globus_soap_message_deserialize_element(
958         message_handle, element_qname);
959 0     if(result != GLOBUS_SUCCESS &&
960        (GlobusSoapMessageStatusElementNotFoundCheck(result) ||
961         GlobusSoapMessageStatusFailedElementCheck(result) ||
962         GlobusSoapMessageStatusFailedWithTextCheck(result)))
963     {
964 0         *ip = NULL;
965 0         result = GLOBUS_SUCCESS;
966 0         goto exit;
967     }
968
969 0     if(result != GLOBUS_SUCCESS)
970     {
971 0         result = GlobusSoapMessageErrorDeserializeFailed(
972             result, element_qname);
973 0         goto exit;
974     }
975
976 0     if(globus_soap_message_deserialize_element_is_empty(
977            message_handle))
978     {
979 0         empty_element = 1;
980     }
981
982
983
984 0     result = wsrl_TerminationNotificationType_init(&instance);
985 0     if(result != GLOBUS_SUCCESS)
986     {
987 0         result = GlobusSoapMessageErrorDeserializeFailed(
988             result, element_qname);
989 0         goto exit;
990     }
991
992
993 0     if(found_attrs == 0 && 
994        globus_soap_message_deserialize_element_is_nil(message_handle))
995     {
996 0         wsrl_TerminationNotificationType_destroy(instance);
997         
998 0         result = globus_soap_message_deserialize_element_end(
999                 message_handle,
1000                 element_qname);
1001 0         if(result != GLOBUS_SUCCESS)
1002         {
1003 0             result = GlobusSoapMessageErrorDeserializeFailed(
1004                 result, element_qname);
1005 0             goto exit;
1006         }
1007
1008 0         *ip = NULL;
1009 0         globus_object_free(globus_error_get(result));
1010 0         result = GLOBUS_SUCCESS;
1011 0         goto exit;
1012     }
1013
1014
1015 0     if(empty_element)
1016     {
1017 0         result = globus_soap_message_deserialize_element_end(
1018             message_handle,
1019             element_qname);
1020 0         if(result != GLOBUS_SUCCESS)
1021         {
1022 0             result = GlobusSoapMessageErrorDeserializeFailed(
1023                 result, element_qname);
1024 0             goto fail_deserialize;
1025         }
1026
1027 0         *ip = instance;
1028 0         goto exit;
1029     }
1030
1031 0     result = globus_soap_message_deserialize_element_begin_close(
1032         message_handle);
1033 0     if(result != GLOBUS_SUCCESS)
1034     {
1035 0         result = GlobusSoapMessageErrorDeserializeFailed(
1036             result, element_qname);
1037 0         goto exit;
1038     }
1039
1040
1041 0     subelement.local = "TerminationTime";
1042 0     subelement.Namespace = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd";
1043
1044 0     result = xsd_dateTime_deserialize(
1045          &subelement,
1046          &instance->TerminationTime,
1047          message_handle,
1048          0);
1049 0     if(result != GLOBUS_SUCCESS)
1050     {
1051 0         result = GlobusSoapMessageErrorDeserializeFailed(
1052             result, 
1053             &xsd_dateTime_qname);
1054 0         goto TerminationTime_destroy;
1055     }
1056
1057 0     subelement.local = "TerminationReason";
1058 0     subelement.Namespace = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd";
1059
1060 0     result = xsd_anyType_deserialize_pointer(
1061         &subelement,
1062         &instance->TerminationReason,
1063         message_handle,
1064         0);
1065 0     if(result != GLOBUS_SUCCESS)
1066     {
1067 0         result = GlobusSoapMessageErrorDeserializeFailed(
1068             result, 
1069             (&subelement));
1070 0         goto TerminationReason_destroy_pointer;
1071     }
1072
1073
1074 0     result = globus_soap_message_deserialize_element_end(
1075         message_handle,
1076         element_qname);
1077 0     if(result != GLOBUS_SUCCESS)
1078     {
1079 0         result = GlobusSoapMessageErrorDeserializeFailed(
1080             result, element_qname);
1081 0         goto fail_deserialize;
1082     }
1083
1084 0     *ip = instance;
1085
1086 0     goto exit;
1087
1088  fail_deserialize:
1089 0         xsd_anyType_destroy(
1090             instance->TerminationReason);
1091 0          instance->TerminationReason = NULL;
1092
1093  TerminationReason_destroy_pointer:
1094 0         xsd_dateTime_destroy_contents(
1095              &instance->TerminationTime);
1096
1097  TerminationTime_destroy:
1098
1099  exit:
1100
1101 0     GlobusSoapMessageDebugExit();
1102 0     return result;
1103 }
1104
1105
1106 globus_result_t
1107 wsrl_TerminationNotificationType_array_init_contents(
1108     wsrl_TerminationNotificationType_array * array)
1109 0 {
1110 0     GlobusFuncName(wsrl_TerminationNotificationType_array_init_contents);
1111 0     GlobusSoapMessageDebugEnter();
1112
1113 0     memset(array, 0, sizeof(wsrl_TerminationNotificationType_array));
1114
1115 0     GlobusSoapMessageDebugExit();
1116 0     return GLOBUS_SUCCESS;
1117 }
1118
1119 globus_result_t
1120 wsrl_TerminationNotificationType_array_init(
1121     wsrl_TerminationNotificationType_array ** arr)
1122 0 {
1123 0     wsrl_TerminationNotificationType_array * array;
1124 0     globus_result_t                     result;
1125 0     GlobusFuncName(wsrl_TerminationNotificationType_array_init);
1126 0     GlobusSoapMessageDebugEnter();
1127
1128 0     array = (wsrl_TerminationNotificationType_array *)
1129         globus_malloc(sizeof(wsrl_TerminationNotificationType_array));
1130 0     if(!array)
1131     {
1132 0         result = GlobusSoapMessageErrorOutOfMemory;
1133 0         goto exit;
1134     }
1135
1136 0     result = wsrl_TerminationNotificationType_array_init_contents(array);
1137 0     if(result != GLOBUS_SUCCESS)
1138     {
1139 0         globus_free(array);
1140 0         array = NULL;
1141
1142     }
1143
1144 0     *arr = array;
1145
1146  exit:
1147 0     GlobusSoapMessageDebugExit();
1148 0     return result;
1149 }
1150
1151 void
1152 wsrl_TerminationNotificationType_array_destroy_contents(
1153     wsrl_TerminationNotificationType_array * array)
1154 0 {
1155 0     int                                 i = 0;
1156 0     GlobusFuncName(wsrl_TerminationNotificationType_array_destroy_contents);
1157 0     GlobusSoapMessageDebugEnter();
1158
1159 0     for(; i < array->length; ++i)
1160     {
1161 0         wsrl_TerminationNotificationType_destroy_contents(&array->elements[i]);
1162     }
1163
1164 0     if(array->elements)
1165     {
1166 0         globus_free(array->elements);
1167 0         array->elements = NULL;
1168     }
1169 0     array->length = 0;
1170
1171 0     GlobusSoapMessageDebugExit();
1172 }
1173
1174 void
1175 wsrl_TerminationNotificationType_array_destroy(
1176     wsrl_TerminationNotificationType_array * array)
1177 0 {
1178 0     GlobusFuncName(wsrl_TerminationNotificationType_array_destroy);
1179 0     GlobusSoapMessageDebugEnter();
1180
1181 0     wsrl_TerminationNotificationType_array_destroy_contents(array);
1182 0     globus_free(array);
1183
1184 0     GlobusSoapMessageDebugExit();
1185 }
1186
1187 globus_result_t
1188 wsrl_TerminationNotificationType_array_copy(
1189     wsrl_TerminationNotificationType_array ** dest_arr,
1190     const wsrl_TerminationNotificationType_array * src_arr)
1191 0 {
1192 0     wsrl_TerminationNotificationType_array * array;
1193 0     globus_result_t                     result;
1194 0     GlobusFuncName(wsrl_TerminationNotificationType_array_copy);
1195 0     GlobusSoapMessageDebugEnter();
1196
1197 0     array = (wsrl_TerminationNotificationType_array *) globus_malloc(
1198         sizeof(wsrl_TerminationNotificationType_array));
1199 0     if(!array)
1200     {
1201 0         result = GlobusSoapMessageErrorOutOfMemory;
1202 0         GlobusSoapMessageDebugExit();
1203 0         return result;
1204     }
1205
1206 0     result = wsrl_TerminationNotificationType_array_copy_contents(array, src_arr);
1207 0     if(result != GLOBUS_SUCCESS)
1208     {
1209 0         globus_free(array);
1210 0         GlobusSoapMessageDebugExit();
1211 0         return result;
1212     }
1213
1214 0     *dest_arr = array;
1215
1216 0     GlobusSoapMessageDebugExit();
1217 0     return GLOBUS_SUCCESS;
1218 }
1219
1220 globus_result_t
1221 wsrl_TerminationNotificationType_array_copy_contents(
1222     wsrl_TerminationNotificationType_array * dest_arr,
1223     const wsrl_TerminationNotificationType_array * src_arr)
1224 0 {
1225 0     int                                 i;
1226 0     globus_result_t                     result = GLOBUS_SUCCESS;
1227 0     GlobusFuncName(wsrl_TerminationNotificationType_array_copy_contents);
1228 0     GlobusSoapMessageDebugEnter();
1229
1230 0     dest_arr->length = src_arr->length;
1231 0     if(dest_arr->length > 0)
1232     {
1233 0         dest_arr->elements = (wsrl_TerminationNotificationType *) malloc(
1234             sizeof(wsrl_TerminationNotificationType) * dest_arr->length);
1235 0         if(!dest_arr->elements)
1236         {
1237 0             result = GlobusSoapMessageErrorOutOfMemory;
1238 0             GlobusSoapMessageDebugExit();
1239 0             return result;
1240         }
1241     }
1242     else
1243     {
1244 0         dest_arr->elements = NULL;
1245     }
1246     
1247 0     for(i = 0; i < dest_arr->length; i++)
1248     {
1249 0         result = wsrl_TerminationNotificationType_copy_contents(
1250             &dest_arr->elements[i], &src_arr->elements[i]);
1251 0         if(result != GLOBUS_SUCCESS)
1252         {
1253 0             while(i--)
1254             {
1255 0                 wsrl_TerminationNotificationType_destroy_contents(&dest_arr->elements[i]);
1256             }
1257
1258 0             globus_free(dest_arr->elements);
1259 0             dest_arr->elements = NULL;
1260 0             dest_arr->length = 0;
1261 0             break;
1262         }
1263     }
1264
1265 0     GlobusSoapMessageDebugExit();
1266 0     return result;
1267 }
1268
1269 wsrl_TerminationNotificationType *
1270 wsrl_TerminationNotificationType_array_push(
1271     wsrl_TerminationNotificationType_array * array)
1272 0 {
1273 0     GlobusFuncName(wsrl_TerminationNotificationType_array_push);
1274 0     GlobusSoapMessageDebugEnter();
1275
1276 0     array->elements = realloc(array->elements,
1277                               sizeof(wsrl_TerminationNotificationType) *
1278                               (array->length + 1));
1279 0     memset(&array->elements[array->length], 0, sizeof(wsrl_TerminationNotificationType));
1280 0     array->length++;
1281
1282 0     GlobusSoapMessageDebugExit();
1283 0     return (&array->elements[array->length - 1]);
1284 }
1285
1286 void *
1287 wsrl_TerminationNotificationType_array_push_wrapper(
1288     void * array)
1289 0 {
1290 0     return (void *) wsrl_TerminationNotificationType_array_push((wsrl_TerminationNotificationType_array *) array);
1291 }
1292
1293 globus_result_t
1294 wsrl_TerminationNotificationType_array_serialize(
1295     xsd_QName *                         element_qname,
1296     wsrl_TerminationNotificationType_array * array,
1297     globus_soap_message_handle_t        message,
1298     globus_xsd_element_options_t        options)
1299 0 {
1300 0     globus_result_t                     result = GLOBUS_SUCCESS;
1301 0     int                                 i = 0;
1302 0     GlobusFuncName(wsrl_TerminationNotificationType_array_serialize);
1303 0     GlobusSoapMessageDebugEnter();
1304
1305 0     for(; i < array->length; ++i)
1306     {
1307 0         result = wsrl_TerminationNotificationType_serialize(
1308             element_qname,
1309             &array->elements[i],
1310             message,
1311             options);
1312 0         if(result != GLOBUS_SUCCESS)
1313         {
1314 0             goto exit;
1315         }
1316     }
1317
1318 exit:
1319
1320 0     GlobusSoapMessageDebugExit();
1321 0     return result;
1322 }
1323
1324 globus_result_t
1325 wsrl_TerminationNotificationType_array_deserialize(
1326     xsd_QName *                         element_qname,
1327     wsrl_TerminationNotificationType_array * array,
1328     globus_soap_message_handle_t        message,
1329     globus_xsd_element_options_t        options)
1330 0 {
1331 0     globus_result_t                     result = GLOBUS_SUCCESS;
1332 0     int                                 i = 0;
1333 0     int                                 pre_length;
1334 0     GlobusFuncName(wsrl_TerminationNotificationType_array_deserialize);
1335 0     GlobusSoapMessageDebugEnter();
1336
1337 0     pre_length = array->length;
1338
1339 0     for(i = 0; i < pre_length; ++i)
1340     {
1341 0         result = wsrl_TerminationNotificationType_deserialize(
1342             element_qname,
1343             &array->elements[i],
1344             message,
1345             options);
1346 0         if(result != GLOBUS_SUCCESS)
1347         {
1348 0             if(GlobusSoapMessageStatusFailedElementCheck(result) ||
1349                GlobusSoapMessageStatusElementNotFoundCheck(result) ||
1350                GlobusSoapMessageStatusFailedWithTextCheck(result))
1351             {
1352 0                 result = GLOBUS_SUCCESS;
1353 0                 break;
1354             }
1355
1356 0             result = GlobusSoapMessageErrorDeserializeFailed(
1357                 result, element_qname);
1358 0             goto exit;
1359         }
1360     }
1361
1362 0     while(result == GLOBUS_SUCCESS)
1363     {
1364 0         wsrl_TerminationNotificationType                  next;
1365 0         memset(&next, 0, sizeof(wsrl_TerminationNotificationType));
1366
1367 0         result = wsrl_TerminationNotificationType_deserialize(
1368             element_qname,
1369             &next,
1370             message,
1371             options);
1372 0         if(result != GLOBUS_SUCCESS)
1373         {
1374 0             if(GlobusSoapMessageStatusFailedElementCheck(result) ||
1375                GlobusSoapMessageStatusElementNotFoundCheck(result) ||
1376                GlobusSoapMessageStatusFailedWithTextCheck(result))
1377             {
1378 0                 result = GLOBUS_SUCCESS;
1379 0                 break;
1380             }
1381
1382 0             result = GlobusSoapMessageErrorDeserializeFailed(
1383                 result, element_qname);
1384 0             goto exit;
1385         }
1386
1387 0         array->elements = realloc(
1388             array->elements,
1389             (array->length + 1) * sizeof(wsrl_TerminationNotificationType));
1390 0         if(!array->elements)
1391         {
1392 0             result = GlobusSoapMessageErrorOutOfMemory;
1393 0             goto exit;
1394         }
1395 0         array->elements[array->length] = next;
1396 0         array->length++;
1397 0         ++i;
1398     }
1399
1400   exit:
1401
1402 0     if(result != GLOBUS_SUCCESS)
1403     {
1404 0         int                             di = 0;
1405 0         for(; di < i; ++di)
1406         {
1407 0             wsrl_TerminationNotificationType_destroy_contents(
1408                 &array->elements[di]);
1409 0             memset(&array->elements[di], 0, sizeof(wsrl_TerminationNotificationType));
1410         }
1411     }
1412
1413 0     GlobusSoapMessageDebugExit();
1414 0     return result;