1 /*
2  * Copyright 1999-2006 University of Chicago
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  * 
8  * http://www.apache.org/licenses/LICENSE-2.0
9  * 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 /*
19  * This file is automatically generated by the Globus WSDLtoC converter
20  */
21
22 #include "xsd_QName.h"
23 #include "globus_soap_message.h"
24 #include "globus_xsd_type_info.h"
25 #include "wstop_ExtensibleDocumented.h"
26
27 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
28 xsd_QName wstop_ExtensibleDocumented_qname =
29 {
30     WSTOP_EXTENSIBLEDOCUMENTED_NS,
31     WSTOP_EXTENSIBLEDOCUMENTED_LOCAL
32 };
33 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
34
35 globus_result_t
36 wstop_ExtensibleDocumented_serialize_wrapper(
37     const xsd_QName *                   element_qname,
38     const void *                        instance,
39     globus_soap_message_handle_t        message_handle,
40     globus_xsd_element_options_t        options)
41 0 {
42 0     return wstop_ExtensibleDocumented_serialize(
43         element_qname,
44         (const wstop_ExtensibleDocumented *) instance,
45         message_handle, options);
46 }
47
48 globus_result_t
49 wstop_ExtensibleDocumented_deserialize_pointer_wrapper(
50     const xsd_QName *                   element_qname,
51     void **                             ip,
52     globus_soap_message_handle_t        message_handle,
53     globus_xsd_element_options_t        options)
54 0 {
55 0     return wstop_ExtensibleDocumented_deserialize_pointer(
56         element_qname,
57         (wstop_ExtensibleDocumented **) ip,
58         message_handle, options);
59 }
60
61 globus_result_t
62 wstop_ExtensibleDocumented_init_wrapper(void **object)
63 0 {
64 0     return wstop_ExtensibleDocumented_init(
65         (wstop_ExtensibleDocumented **) object);
66 }
67
68 void
69 wstop_ExtensibleDocumented_destroy_wrapper(
70     void *                          object)
71 0 {
72 0     wstop_ExtensibleDocumented_destroy(
73         (wstop_ExtensibleDocumented *) object);
74 }
75
76 globus_result_t
77 wstop_ExtensibleDocumented_copy_wrapper(
78     void **                         dest_obj,
79     const void *                    src_obj)
80 0 {
81 0     return wstop_ExtensibleDocumented_copy(
82         (wstop_ExtensibleDocumented **) dest_obj,
83         (wstop_ExtensibleDocumented *) src_obj);
84 }
85
86 globus_result_t
87 wstop_ExtensibleDocumented_init_contents_wrapper(void *object)
88 0 {
89 0     return wstop_ExtensibleDocumented_init_contents(
90         (wstop_ExtensibleDocumented *) object);
91 }
92
93 void
94 wstop_ExtensibleDocumented_destroy_contents_wrapper(
95     void *                          object)
96 0 {
97 0     wstop_ExtensibleDocumented_destroy_contents(
98         (wstop_ExtensibleDocumented *) object);
99 }
100
101 globus_result_t
102 wstop_ExtensibleDocumented_copy_contents_wrapper(
103     void *                          dest_obj,
104     const void *                    src_obj)
105 0 {
106 0     return wstop_ExtensibleDocumented_copy_contents(
107         (wstop_ExtensibleDocumented *) dest_obj,
108         (const wstop_ExtensibleDocumented *) src_obj);
109 }
110
111 globus_result_t
112 wstop_ExtensibleDocumented_serialize_contents_wrapper(
113     const xsd_QName *                   element_qname,
114     const void *                        instance,
115     globus_soap_message_handle_t        message_handle,
116     globus_xsd_element_options_t        options)
117 0 {
118 0     return wstop_ExtensibleDocumented_serialize_contents(
119         element_qname,
120         (wstop_ExtensibleDocumented *) instance,
121         message_handle, options);
122 }
123
124 globus_result_t
125 wstop_ExtensibleDocumented_deserialize_contents_wrapper(
126     const xsd_QName *                   element_qname,
127     void **                             instance,
128     globus_soap_message_handle_t        message_handle,
129     globus_xsd_element_options_t        options)
130 0 {
131 0     globus_result_t                     result;
132 0     GlobusFuncName(wstop_ExtensibleDocumented_deserialize_contents_wrapper);
133 0     GlobusSoapMessageDebugEnter();
134
135 0     if(!*instance)
136     {
137 0         result = wstop_ExtensibleDocumented_init(
138             (wstop_ExtensibleDocumented **)instance);
139 0         if(result != GLOBUS_SUCCESS)
140         {
141 0             goto error;
142         }
143     }
144
145 0     result = wstop_ExtensibleDocumented_deserialize_contents(
146         element_qname,
147         *(wstop_ExtensibleDocumented **)instance,
148         message_handle, options);
149 error:
150 0     GlobusSoapMessageDebugExit();
151 0     return result;
152 }
153
154 globus_result_t
155 wstop_ExtensibleDocumented_array_serialize_wrapper(
156     const xsd_QName *               element,
157     const void *                    instance,
158     globus_soap_message_handle_t    message,
159     globus_xsd_element_options_t    options)
160 0 {
161 0     return wstop_ExtensibleDocumented_array_serialize(
162         element,
163         (wstop_ExtensibleDocumented_array *) instance,
164         message, options);
165 }
166
167 globus_result_t
168 wstop_ExtensibleDocumented_array_deserialize_wrapper(
169     const xsd_QName *                   element_qname,
170     void **                             inst,
171     globus_soap_message_handle_t        message,
172     globus_xsd_element_options_t        options)
173 0 {
174 0     if(!*inst)
175     {
176 0         globus_result_t                 result;
177
178 0         result = wstop_ExtensibleDocumented_array_init(
179             (wstop_ExtensibleDocumented_array **)inst);
180 0         if(result != GLOBUS_SUCCESS)
181         {
182 0             return result;
183         }
184     }
185
186 0     return wstop_ExtensibleDocumented_array_deserialize(
187         element_qname,
188         *(wstop_ExtensibleDocumented_array **) inst,
189         message, options);
190 }
191
192 globus_result_t
193 wstop_ExtensibleDocumented_array_init_wrapper(
194     void **                             arr)
195 0 {
196 0     return wstop_ExtensibleDocumented_array_init(
197         (wstop_ExtensibleDocumented_array **) arr);
198 }
199
200 void
201 wstop_ExtensibleDocumented_array_destroy_wrapper(
202     void *                              arr)
203 0 {
204 0     wstop_ExtensibleDocumented_array_destroy(
205         (wstop_ExtensibleDocumented_array *) arr);
206 }
207
208 globus_result_t
209 wstop_ExtensibleDocumented_array_copy_wrapper(
210     void **                             dest_arr,
211     const void *                        src_arr)
212 0 {
213 0     return wstop_ExtensibleDocumented_array_copy(
214         (wstop_ExtensibleDocumented_array **) dest_arr,
215         (const wstop_ExtensibleDocumented_array *) src_arr);
216 }
217
218 globus_result_t
219 wstop_ExtensibleDocumented_array_init_contents_wrapper(
220     void *                              arr)
221 0 {
222 0     return wstop_ExtensibleDocumented_array_init_contents(
223         (wstop_ExtensibleDocumented_array *) arr);
224 }
225
226 void
227 wstop_ExtensibleDocumented_array_destroy_contents_wrapper(
228     void *                              arr)
229 0 {
230 0     wstop_ExtensibleDocumented_array_destroy_contents(
231         (wstop_ExtensibleDocumented_array *) arr);
232 }
233
234 globus_result_t
235 wstop_ExtensibleDocumented_array_copy_contents_wrapper(
236     void *                              dest_arr,
237     const void *                        src_arr)
238 0 {
239 0     return wstop_ExtensibleDocumented_array_copy_contents(
240         (wstop_ExtensibleDocumented_array *) dest_arr,
241         (const wstop_ExtensibleDocumented_array *) src_arr);
242 }
243
244 struct globus_xsd_type_info_s wstop_ExtensibleDocumented_contents_info =
245 {
246     &wstop_ExtensibleDocumented_qname,
247     wstop_ExtensibleDocumented_serialize_contents_wrapper,
248     wstop_ExtensibleDocumented_deserialize_contents_wrapper,
249     wstop_ExtensibleDocumented_init_wrapper,
250     wstop_ExtensibleDocumented_destroy_wrapper,
251     wstop_ExtensibleDocumented_copy_wrapper,
252     wstop_ExtensibleDocumented_init_contents_wrapper,
253     wstop_ExtensibleDocumented_destroy_contents_wrapper,
254     wstop_ExtensibleDocumented_copy_contents_wrapper,
255     sizeof(wstop_ExtensibleDocumented),
256     NULL,
257     NULL,
258     NULL
259 };
260
261 struct globus_xsd_type_info_s wstop_ExtensibleDocumented_array_info =
262 {
263     &wstop_ExtensibleDocumented_qname,
264     wstop_ExtensibleDocumented_array_serialize_wrapper,
265     wstop_ExtensibleDocumented_array_deserialize_wrapper,
266     wstop_ExtensibleDocumented_array_init_wrapper,
267     wstop_ExtensibleDocumented_array_destroy_wrapper,
268     wstop_ExtensibleDocumented_array_copy_wrapper,
269     wstop_ExtensibleDocumented_array_init_contents_wrapper,
270     wstop_ExtensibleDocumented_array_destroy_contents_wrapper,
271     wstop_ExtensibleDocumented_array_copy_contents_wrapper,
272     sizeof(wstop_ExtensibleDocumented),
273     wstop_ExtensibleDocumented_array_push_wrapper,
274     NULL,
275     NULL
276 };
277
278 struct globus_xsd_type_info_s wstop_ExtensibleDocumented_info =
279 {
280     &wstop_ExtensibleDocumented_qname,
281     wstop_ExtensibleDocumented_serialize_wrapper,
282     wstop_ExtensibleDocumented_deserialize_pointer_wrapper,
283     wstop_ExtensibleDocumented_init_wrapper,
284     wstop_ExtensibleDocumented_destroy_wrapper,
285     wstop_ExtensibleDocumented_copy_wrapper,
286     wstop_ExtensibleDocumented_init_contents_wrapper,
287     wstop_ExtensibleDocumented_destroy_contents_wrapper,
288     wstop_ExtensibleDocumented_copy_contents_wrapper,
289     sizeof(wstop_ExtensibleDocumented),
290     NULL,
291     &wstop_ExtensibleDocumented_contents_info,
292     &wstop_ExtensibleDocumented_array_info
293 };
294
295 globus_result_t
296 wstop_ExtensibleDocumented_init_contents(
297     wstop_ExtensibleDocumented * instance)
298 0 {
299 0     globus_result_t                     result = GLOBUS_SUCCESS;
300 0     GlobusFuncName(wstop_ExtensibleDocumented_init_contents);
301 0     GlobusSoapMessageDebugEnter();
302
303 0     memset(instance, 0, sizeof(wstop_ExtensibleDocumented));
304
305 0     GlobusSoapMessageDebugExit();
306 0     return result;
307 }
308
309 globus_result_t
310 wstop_ExtensibleDocumented_init(
311     wstop_ExtensibleDocumented ** object)
312 0 {
313 0     wstop_ExtensibleDocumented * instance;
314 0     globus_result_t                     result = GLOBUS_SUCCESS;
315 0     GlobusFuncName(wstop_ExtensibleDocumented_init);
316 0     GlobusSoapMessageDebugEnter();
317
318 0     instance = globus_malloc(sizeof(wstop_ExtensibleDocumented));
319 0     if(!instance)
320     {
321 0         result = GlobusSoapMessageErrorOutOfMemory;
322 0         goto exit;
323     }
324
325 0     memset(instance, 0, sizeof(wstop_ExtensibleDocumented));
326
327 0     *object = instance;
328
329  exit:
330 0     GlobusSoapMessageDebugExit();
331 0     return result;
332 }
333
334 void
335 wstop_ExtensibleDocumented_destroy(
336     wstop_ExtensibleDocumented * instance)
337 0 {
338 0     GlobusFuncName(wstop_ExtensibleDocumented_destroy);
339 0     GlobusSoapMessageDebugEnter();
340
341 0     if(!instance)
342     {
343 0         goto exit;
344     }
345
346 0     wstop_ExtensibleDocumented_destroy_contents(instance);
347 0     globus_free(instance);
348
349  exit:
350
351 0     GlobusSoapMessageDebugExit();
352 }
353
354
355 void
356 wstop_ExtensibleDocumented_destroy_contents(
357     wstop_ExtensibleDocumented * instance)
358 0 {
359 0     GlobusFuncName(wstop_ExtensibleDocumented_destroy_contents);
360 0     GlobusSoapMessageDebugEnter();
361
362 0     if(instance)
363     {
364
365
366 0     wstop_Documentation_destroy(instance->documentation);
367 0     instance->documentation = NULL;
368
369 0         xsd_anyAttributes_destroy(instance->anyAttributes);
370 0         instance->anyAttributes = NULL;
371
372     }
373
374 0     GlobusSoapMessageDebugExit();
375 }
376
377
378 globus_result_t
379 wstop_ExtensibleDocumented_copy(
380     wstop_ExtensibleDocumented ** dest_obj,
381     const wstop_ExtensibleDocumented * src_obj)
382 0 {
383 0     globus_result_t                     result = GLOBUS_SUCCESS;
384 0     wstop_ExtensibleDocumented * instance;
385 0     GlobusFuncName(wstop_ExtensibleDocumented_copy);
386
387 0     GlobusSoapMessageDebugEnter();
388
389 0     instance = calloc(1, sizeof(wstop_ExtensibleDocumented));
390 0     if (instance == NULL)
391     {
392 0         GlobusSoapMessageDebugExit();
393 0         return GlobusSoapMessageErrorOutOfMemory;
394     }
395
396 0     result = wstop_ExtensibleDocumented_copy_contents(instance, src_obj);
397 0     if(result != GLOBUS_SUCCESS)
398     {
399 0         globus_free(instance);
400 0         GlobusSoapMessageDebugExit();
401 0         return GlobusSoapMessageErrorOutOfMemory;
402     }
403
404 0     *dest_obj = instance;
405 0     GlobusSoapMessageDebugExit();
406 0     return result;
407 }
408
409 globus_result_t
410 wstop_ExtensibleDocumented_copy_contents(
411     wstop_ExtensibleDocumented * instance,
412     const wstop_ExtensibleDocumented * src_obj)
413 0 {
414 0     globus_result_t                     result = GLOBUS_SUCCESS;
415 0     GlobusFuncName(wstop_ExtensibleDocumented_copy_contents);
416
417 0     GlobusSoapMessageDebugEnter();
418
419 0     if(src_obj->anyAttributes)
420     {
421 0         result = xsd_anyAttributes_copy(&instance->anyAttributes, 
422                                         src_obj->anyAttributes);
423 0         if(result != GLOBUS_SUCCESS)
424         {
425 0             result = GlobusSoapMessageErrorCopyAnyAttrsFailed(
426                 result, NULL);
427 0             goto xsd_anyAttributes_after_destroy;
428         }
429     }
430     else
431     {
432 0         instance->anyAttributes = NULL;
433     }
434
435 0     if(src_obj->documentation)
436     {
437 0         result = wstop_Documentation_copy(
438             &instance->documentation,
439             src_obj->documentation);
440 0         if(result != GLOBUS_SUCCESS)
441         {
442 0             result = GlobusSoapMessageErrorCopyFailed(
443                 result, NULL, &wstop_Documentation_qname);
444 0             goto documentation_destroy_pointer;
445         }
446     }
447     else
448     {
449 0         instance->documentation = NULL;
450     }
451
452 0     goto exit;
453
454  fail_deserialize:
455
456  xsd_anyAttributes_destroy:
457 0         xsd_anyAttributes_destroy(instance->anyAttributes);
458 0         instance->anyAttributes = NULL;
459  xsd_anyAttributes_after_destroy:
460 0         wstop_Documentation_destroy(
461             instance->documentation);
462 0          instance->documentation = NULL;
463
464  documentation_destroy_pointer:
465
466
467  exit:
468
469 0     GlobusSoapMessageDebugExit();
470 0     return result;
471 }
472
473
474
475 globus_result_t
476 wstop_ExtensibleDocumented_serialize_contents(
477     const xsd_QName *                   element_qname, /* ignored */
478     const wstop_ExtensibleDocumented *              inst,
479     globus_soap_message_handle_t        message_handle,
480     globus_xsd_element_options_t        options)
481 0 {
482 0     globus_result_t                     result = GLOBUS_SUCCESS;
483 0     GlobusFuncName(wstop_ExtensibleDocumented_serialize_contents);
484 0     GlobusSoapMessageDebugEnter();
485
486 0     result = wstop_ExtensibleDocumented_serialize(
487         NULL,
488         inst,
489         message_handle,
490         options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
491 0     if(result != GLOBUS_SUCCESS)
492     {
493 0         result = GlobusSoapMessageErrorSerializeFailed(
494             result, NULL, element_qname);
495         goto exit;
496     }
497
498  exit:
499
500 0     GlobusSoapMessageDebugExit();
501 0     return result;
502 }
503
504
505
506 globus_result_t
507 wstop_ExtensibleDocumented_serialize(
508     const xsd_QName *                   element_qname,
509     const wstop_ExtensibleDocumented *              instance,
510     globus_soap_message_handle_t        message_handle,
511     globus_xsd_element_options_t        options)
512 0 {
513 0     globus_result_t                     result = GLOBUS_SUCCESS;
514 0     xsd_QName                           subelement;
515 0     globus_list_t *                     any_attr_keys = NULL;
516 0     globus_list_t *                     any_attr_keys_iterator = NULL;
517 0     xsd_QName *                         type_attr = NULL;
518
519 0     char *                              prefix = NULL;
520 0     int                                 prefix_created;
521 0     int                                 define_prefix = 0;
522 0     int                                 save_options = options;
523
524 0     GlobusFuncName(wstop_ExtensibleDocumented_serialize);
525 0     GlobusSoapMessageDebugEnter();
526
527
528 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
529     {
530         /* serialize wstop_ExtensibleDocumented element */
531 0 result = globus_soap_message_element_ns_set(
532             message_handle,
533             element_qname,
534             element_qname->Namespace,
535             &options);
536 0         if(result != GLOBUS_SUCCESS)
537         {
538 0             result = GlobusSoapMessageErrorSerializeFailed(
539                 result, NULL, element_qname);
540 0             goto exit;
541         }
542
543 0         if(((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
544    !globus_soap_message_serialize_is_c14n_subset(message_handle)))
545         {
546 0             result = globus_soap_message_attribute_ns_set(
547                 message_handle,
548                 element_qname,
549                 "http://www.w3.org/2001/XMLSchema-instance",
550                 &options);
551 0             if(result != GLOBUS_SUCCESS)
552             {
553 0                 result = GlobusSoapMessageErrorSerializeFailed(
554                     result, NULL, element_qname);
555 0                 goto exit;
556             }
557         }
558
559 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
560    !globus_soap_message_serialize_is_c14n_subset(message_handle))
561         {
562
563 0             result = globus_soap_message_attribute_ns_set(
564                 message_handle,
565                 element_qname,
566                 wstop_ExtensibleDocumented_qname.Namespace,
567                 &options);
568 0             if(result != GLOBUS_SUCCESS)
569             {
570 0                 result = GlobusSoapMessageErrorSerializeFailed(
571                     result, NULL, element_qname);
572 0                 goto exit;
573             }
574         }
575
576 0         result = xsd_anyAttributes_namespace_set(
577             message_handle, element_qname, instance->anyAttributes, &options);
578 0         if(result != GLOBUS_SUCCESS)
579         {
580 0             result = GlobusSoapMessageErrorSerializeAnyAttrsFailed(
581                 result, "Failed to set namespace");
582 0             goto exit;
583         }
584
585 0         result = globus_soap_message_serialize_element(
586             message_handle,
587             element_qname,
588             options,
589             &wstop_ExtensibleDocumented_qname);
590 0         if(result != GLOBUS_SUCCESS)
591         {
592 0             result = GlobusSoapMessageErrorSerializeFailed(
593                 result, NULL, element_qname);
594 0             goto exit;
595         }
596
597 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
598    !globus_soap_message_serialize_is_c14n_subset(message_handle))
599         {
600 0            xsd_QName_init(&type_attr);
601        
602 0            type_attr->local = globus_libc_strdup("type");
603 0            type_attr->Namespace = globus_libc_strdup(XSI_NS);
604         }
605
606
607         /* serialize namespaces */
608 0 result = globus_soap_message_element_ns_add(
609             message_handle,
610             element_qname,
611             element_qname->Namespace,
612             &options);
613 0         if(result != GLOBUS_SUCCESS)
614         {
615 0             result = GlobusSoapMessageErrorSerializeFailed(
616                 result, NULL, element_qname);
617 0             goto exit;
618         }
619
620 0         if(((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
621    !globus_soap_message_serialize_is_c14n_subset(message_handle)))
622         {
623 0             result = globus_soap_message_attribute_ns_add(
624                 message_handle,
625                 element_qname,
626                 "http://www.w3.org/2001/XMLSchema-instance",
627                 &options);
628 0             if(result != GLOBUS_SUCCESS)
629             {
630 0                 result = GlobusSoapMessageErrorSerializeFailed(
631                     result, NULL, element_qname);
632 0                 goto exit;
633             }
634         }
635 0         if ((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
636    !globus_soap_message_serialize_is_c14n_subset(message_handle))
637         {
638
639 0             result = globus_soap_message_attribute_ns_add(
640                 message_handle,
641                 element_qname,
642                 wstop_ExtensibleDocumented_qname.Namespace,
643                 &options);
644 0             if(result != GLOBUS_SUCCESS)
645             {
646 0                 result = GlobusSoapMessageErrorSerializeFailed(
647                     result, NULL, element_qname);
648 0                 goto exit;
649             }
650         }
651
652 0         result = xsd_anyAttributes_namespace_add(
653             message_handle, element_qname, instance->anyAttributes, &options);
654 0         if(result != GLOBUS_SUCCESS)
655         {
656 0             result = GlobusSoapMessageErrorSerializeAnyAttrsFailed(
657                 result, "Failed to add namespace");
658 0             goto exit;
659         }
660
661         /* serialize attributes */
662
663 0         if(instance->anyAttributes)
664         {
665 0             any_attr_keys = xsd_anyAttributes_lex_sort(
666                 instance->anyAttributes);
667 0             any_attr_keys_iterator = any_attr_keys;
668         }
669
670 0         if(any_attr_keys_iterator)
671         {
672 0             result = xsd_anyAttributes_serialize_lex_before(
673                 message_handle,
674                 &any_attr_keys_iterator,
675                 instance->anyAttributes,
676                 type_attr);
677 0             if(result != GLOBUS_SUCCESS)
678             {
679 0                 result = GlobusSoapMessageErrorSerializeFailed(result, 
680                                                                NULL, 
681                                                                element_qname);
682 0                 goto exit;
683             }
684         }
685
686 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
687    !globus_soap_message_serialize_is_c14n_subset(message_handle))
688         {
689 0             result = globus_soap_message_serialize_QName_attribute(
690                 message_handle,
691                 type_attr,
692                 &wstop_ExtensibleDocumented_qname);
693 0             if(result != GLOBUS_SUCCESS)
694             {
695 0                 result = GlobusSoapMessageErrorSerializeFailed(
696                     result, NULL, element_qname);
697 0                 goto exit;
698             }
699         }
700
701
702     }
703
704 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
705     {
706 0         result = globus_soap_message_serialize_element_begin_close(
707             message_handle, element_qname);
708 0         if(result != GLOBUS_SUCCESS)
709         {
710 0             result = GlobusSoapMessageErrorSerializeFailed(
711                 result, NULL, element_qname);
712 0             goto exit;
713         }
714     }
715 0     options &= ~GLOBUS_XSD_ELEMENT_CONTENTS_ONLY;
716
717
718     /* serialize contents of type */
719
720 0     subelement.local = "documentation";
721 0     subelement.Namespace = "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-Topics-1.2-draft-01.xsd";
722
723 0     if(instance->documentation)
724     {
725 0         result = wstop_Documentation_serialize(
726             &subelement,
727             instance->documentation,
728             message_handle,
729             options & (~GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS));
730 0         if(result != GLOBUS_SUCCESS)
731         {
732 0             result = GlobusSoapMessageErrorSerializeFailed(
733                 result, NULL, &wstop_Documentation_qname);
734 0             goto exit;
735         }
736     }
737
738 0     options = save_options;
739
740 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
741     {
742         /* add end element */
743 0         result = globus_soap_message_serialize_element_end(
744             message_handle,
745             element_qname,
746             options,
747             &wstop_ExtensibleDocumented_qname);
748 0         if(result != GLOBUS_SUCCESS)
749         {
750 0             result = GlobusSoapMessageErrorSerializeFailed(
751                 result, NULL, element_qname);
752 0             goto exit;
753         }
754
755 0         globus_soap_message_element_ns_remove(
756             message_handle,
757             element_qname->Namespace,
758             &options);
759
760     /* remove namespace/prefix mappings for these types */
761
762 0         if(((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
763    !globus_soap_message_serialize_is_c14n_subset(message_handle)))
764         {
765 0             globus_soap_message_attribute_ns_remove(
766                 message_handle,
767                 "http://www.w3.org/2001/XMLSchema-instance",
768                 &options);
769         }           
770 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
771    !globus_soap_message_serialize_is_c14n_subset(message_handle))
772         {
773 0             globus_soap_message_attribute_ns_remove(
774                 message_handle,
775                 wstop_ExtensibleDocumented_qname.Namespace,
776                 &options);
777         }           
778
779 0         result = xsd_anyAttributes_namespace_remove(
780             message_handle, instance->anyAttributes, &options);
781 0         if(result != GLOBUS_SUCCESS)
782         {
783 0             result = GlobusSoapMessageErrorSerializeAnyAttrsFailed(
784                 result, "Failed to remove namespace");
785             goto exit;
786         }
787
788     }
789
790  exit:
791 0     if (type_attr)
792     {
793 0         xsd_QName_destroy(type_attr);
794     }
795
796
797 0     if(any_attr_keys)
798     {
799 0         globus_list_free(any_attr_keys);
800     }
801
802 0     GlobusSoapMessageDebugExit();
803 0     return result;
804 }
805
806
807
808 globus_result_t
809 wstop_ExtensibleDocumented_deserialize_contents(
810     const xsd_QName *                   element_qname, /* ignored */
811     wstop_ExtensibleDocumented *                    inst,
812     globus_soap_message_handle_t        message_handle,
813     globus_xsd_element_options_t        options)
814 0 {
815 0     globus_result_t                     result = GLOBUS_SUCCESS;
816 0     GlobusFuncName(wstop_ExtensibleDocumented_deserialize_contents);
817 0     GlobusSoapMessageDebugEnter();
818
819 0     result = wstop_ExtensibleDocumented_deserialize(
820         NULL,
821         inst,
822         message_handle,
823         options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
824 0     if(result != GLOBUS_SUCCESS)
825     {
826 0         result = GlobusSoapMessageErrorDeserializeFailed(
827             result, element_qname);
828         goto exit;
829     }
830
831  exit:
832
833 0     GlobusSoapMessageDebugExit();
834 0     return result;
835 }
836
837
838
839 globus_result_t
840 wstop_ExtensibleDocumented_deserialize(
841     const xsd_QName *                   element_qname,
842     wstop_ExtensibleDocumented *                    instance,
843     globus_soap_message_handle_t        message_handle,
844     globus_xsd_element_options_t        options)
845 0 {
846 0     globus_result_t                     result = GLOBUS_SUCCESS;
847 0     xsd_QName                           subelement;
848 0     GlobusFuncName(wstop_ExtensibleDocumented_deserialize);
849 0     GlobusSoapMessageDebugEnter();
850
851
852 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
853     {
854 0         result = globus_soap_message_deserialize_element(
855             message_handle, element_qname);
856 0         if(result != GLOBUS_SUCCESS)
857         {
858 0             result = GlobusSoapMessageErrorDeserializeFailed(
859                 result, element_qname);
860 0             goto exit;
861         }
862
863 0         result = xsd_anyAttributes_init(&instance->anyAttributes);
864 0         if(result != GLOBUS_SUCCESS)
865         {
866 0             result = GlobusSoapMessageErrorDeserializeFailed(
867                 result, element_qname);
868 0             goto xsd_anyAttributes_after_destroy;
869         }
870
871 0         result = xsd_anyAttributes_deserialize(
872             message_handle,
873             instance->anyAttributes);
874 0         if(result != GLOBUS_SUCCESS)
875         {
876 0             result = GlobusSoapMessageErrorDeserializeFailed(
877                 result, element_qname);
878 0             goto xsd_anyAttributes_destroy;
879         }
880
881
882 0         result = globus_soap_message_deserialize_element_begin_close(
883             message_handle);
884 0         if(result != GLOBUS_SUCCESS)
885         {
886 0             result = GlobusSoapMessageErrorDeserializeFailed(
887                 result, element_qname);
888 0             goto fail_deserialize;
889         }
890     }
891
892 0     subelement.local = "documentation";
893 0     subelement.Namespace = "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-Topics-1.2-draft-01.xsd";
894
895 0     result = wstop_Documentation_deserialize_pointer(
896         &subelement,
897         &instance->documentation,
898         message_handle,
899         0);
900 0     if(result != GLOBUS_SUCCESS)
901     {
902 0         result = GlobusSoapMessageErrorDeserializeFailed(
903             result, 
904             (&subelement));
905 0         goto documentation_destroy_pointer;
906     }
907
908 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
909     {
910 0         result = globus_soap_message_deserialize_element_end(
911             message_handle,
912             element_qname);
913 0         if(result != GLOBUS_SUCCESS)
914         {
915 0             result = GlobusSoapMessageErrorDeserializeFailed(
916                 result, element_qname);
917             goto fail_deserialize;
918         }
919     }
920
921 0     goto exit;
922
923  fail_deserialize:
924
925  xsd_anyAttributes_destroy:
926 0         xsd_anyAttributes_destroy(instance->anyAttributes);
927 0         instance->anyAttributes = NULL;
928  xsd_anyAttributes_after_destroy:
929 0         wstop_Documentation_destroy(
930             instance->documentation);
931 0          instance->documentation = NULL;
932
933  documentation_destroy_pointer:
934
935
936  exit:
937
938 0     GlobusSoapMessageDebugExit();
939 0     return result;
940 }
941
942
943
944 globus_result_t
945 wstop_ExtensibleDocumented_deserialize_pointer(
946     const xsd_QName *                   element_qname,
947     wstop_ExtensibleDocumented **                   ip,
948     globus_soap_message_handle_t        message_handle,
949     globus_xsd_element_options_t        options)
950 0 {
951 0     wstop_ExtensibleDocumented * instance = NULL;
952 0     globus_result_t                     result = GLOBUS_SUCCESS;
953 0     xsd_QName                           subelement;
954 0     int                                 found_attrs = 0;
955 0     int                                 empty_element = 0;
956 0     GlobusFuncName(wstop_ExtensibleDocumented_deserialize_pointer);
957 0     GlobusSoapMessageDebugEnter();
958
959 0     *ip = NULL;
960
961 0     result = globus_soap_message_deserialize_element(
962         message_handle, element_qname);
963 0     if(result != GLOBUS_SUCCESS &&
964        (GlobusSoapMessageStatusElementNotFoundCheck(result) ||
965         GlobusSoapMessageStatusFailedElementCheck(result) ||
966         GlobusSoapMessageStatusFailedWithTextCheck(result)))
967     {
968 0         result = GLOBUS_SUCCESS;
969 0         goto exit;
970     }
971
972 0     if(result != GLOBUS_SUCCESS)
973     {
974 0         result = GlobusSoapMessageErrorDeserializeFailed(
975             result, element_qname);
976 0         goto exit;
977     }
978
979 0     if(globus_soap_message_deserialize_element_is_empty(
980            message_handle))
981     {
982 0         empty_element = 1;
983     }
984
985 0     result = wstop_ExtensibleDocumented_init(&instance);
986 0     if(result != GLOBUS_SUCCESS)
987     {
988 0         result = GlobusSoapMessageErrorDeserializeFailed(
989             result, element_qname);
990 0         goto exit;
991     }
992
993
994 0         result = xsd_anyAttributes_init(&instance->anyAttributes);
995 0         if(result != GLOBUS_SUCCESS)
996         {
997 0             result = GlobusSoapMessageErrorDeserializeFailed(
998                 result, element_qname);
999 0             goto xsd_anyAttributes_after_destroy;
1000         }
1001
1002 0         result = xsd_anyAttributes_deserialize(
1003             message_handle,
1004             instance->anyAttributes);
1005 0         if(result != GLOBUS_SUCCESS)
1006         {
1007 0             result = GlobusSoapMessageErrorDeserializeFailed(
1008                 result, element_qname);
1009 0             goto xsd_anyAttributes_destroy;
1010         }
1011
1012 0         if(instance->anyAttributes &&
1013            xsd_anyAttributes_size(instance->anyAttributes) > 0)
1014         {
1015 0             found_attrs++;
1016         }
1017
1018
1019 0     if(empty_element)
1020     {
1021 0         result = globus_soap_message_deserialize_element_end(
1022             message_handle,
1023             element_qname);
1024 0         if(result != GLOBUS_SUCCESS)
1025         {
1026 0             result = GlobusSoapMessageErrorDeserializeFailed(
1027                 result, element_qname);
1028 0             goto fail_deserialize;
1029         }
1030
1031 0         *ip = instance;
1032 0         goto exit;
1033     }
1034
1035 0     result = globus_soap_message_deserialize_element_begin_close(
1036         message_handle);
1037 0     if(result != GLOBUS_SUCCESS)
1038     {
1039 0         result = GlobusSoapMessageErrorDeserializeFailed(
1040             result, element_qname);
1041 0         goto exit;
1042     }
1043
1044 0     result = wstop_ExtensibleDocumented_deserialize(
1045             element_qname,
1046             instance,
1047             message_handle,
1048             options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
1049
1050 0     result = globus_soap_message_deserialize_element_end(
1051         message_handle,
1052         element_qname);
1053 0     if(result != GLOBUS_SUCCESS)
1054     {
1055 0         result = GlobusSoapMessageErrorDeserializeFailed(
1056             result, element_qname);
1057 0         goto fail_deserialize;
1058     }
1059
1060 0     *ip = instance;
1061
1062 0     goto exit;
1063
1064  fail_deserialize:
1065
1066  xsd_anyAttributes_destroy:
1067 0         xsd_anyAttributes_destroy(instance->anyAttributes);
1068 0         instance->anyAttributes = NULL;
1069  xsd_anyAttributes_after_destroy:
1070 0         wstop_Documentation_destroy(
1071             instance->documentation);
1072 0          instance->documentation = NULL;
1073
1074  documentation_destroy_pointer:
1075
1076  exit:
1077
1078 0     GlobusSoapMessageDebugExit();
1079 0     return result;
1080 }
1081
1082
1083 globus_result_t
1084 wstop_ExtensibleDocumented_array_init_contents(
1085     wstop_ExtensibleDocumented_array * array)
1086 0 {
1087 0     return globus_xsd_generic_array_init_contents(
1088         (globus_xsd_generic_array_t *) array,
1089         &wstop_ExtensibleDocumented_info);
1090 }
1091 /* wstop_ExtensibleDocumented_array_init_contents() */
1092
1093 globus_result_t
1094 wstop_ExtensibleDocumented_array_init(
1095     wstop_ExtensibleDocumented_array ** arr)
1096 0 {
1097 0     return globus_xsd_generic_array_init(
1098         (globus_xsd_generic_array_t **) arr,
1099         &wstop_ExtensibleDocumented_info);
1100 }
1101 /* wstop_ExtensibleDocumented_array_init() */
1102
1103 void
1104 wstop_ExtensibleDocumented_array_destroy_contents(
1105     wstop_ExtensibleDocumented_array * array)
1106 0 {
1107 0     globus_xsd_generic_array_destroy_contents(
1108         (globus_xsd_generic_array_t *) array);
1109 }
1110 /* wstop_ExtensibleDocumented_array_destroy_contents() */
1111
1112 void
1113 wstop_ExtensibleDocumented_array_destroy(
1114     wstop_ExtensibleDocumented_array * array)
1115 0 {
1116 0     globus_xsd_generic_array_destroy(
1117         (globus_xsd_generic_array_t *) array);
1118 }
1119 /* wstop_ExtensibleDocumented_array_destroy() */
1120
1121 globus_result_t
1122 wstop_ExtensibleDocumented_array_copy(
1123     wstop_ExtensibleDocumented_array ** dest_arr,
1124     const wstop_ExtensibleDocumented_array * src_arr)
1125 0 {
1126 0     return globus_xsd_generic_array_copy(
1127         (globus_xsd_generic_array_t **) dest_arr,
1128         (globus_xsd_generic_array_t *) src_arr);
1129 }
1130 /* wstop_ExtensibleDocumented_array_copy() */
1131
1132 globus_result_t
1133 wstop_ExtensibleDocumented_array_copy_contents(
1134     wstop_ExtensibleDocumented_array * dest_arr,
1135     const wstop_ExtensibleDocumented_array * src_arr)
1136 0 {
1137 0     return globus_xsd_generic_array_copy_contents(
1138         (globus_xsd_generic_array_t *) dest_arr,
1139         (globus_xsd_generic_array_t *) src_arr);
1140 }
1141 /* wstop_ExtensibleDocumented_array_copy_contents() */
1142
1143 wstop_ExtensibleDocumented *
1144 wstop_ExtensibleDocumented_array_push(
1145     wstop_ExtensibleDocumented_array * array)
1146 0 {
1147     /* Some contents initializers don't initialize subelments but to set their
1148      * values to be NULL
1149      */
1150 0     if (array->type_info == NULL)
1151     {
1152 0         array->type_info = &wstop_ExtensibleDocumented_info;
1153     }
1154
1155 0     return globus_xsd_generic_array_push(
1156         (globus_xsd_generic_array_t *) array);
1157 }
1158 /* wstop_ExtensibleDocumented_array_push() */
1159
1160 void *
1161 wstop_ExtensibleDocumented_array_push_wrapper(
1162     void * array)
1163 0 {
1164 0     return (void *) wstop_ExtensibleDocumented_array_push((wstop_ExtensibleDocumented_array *) array);
1165 }
1166
1167 globus_result_t
1168 wstop_ExtensibleDocumented_array_serialize(
1169     const xsd_QName *                   element_qname,
1170     const wstop_ExtensibleDocumented_array *        array,
1171     globus_soap_message_handle_t        message,
1172     globus_xsd_element_options_t        options)
1173 0 {
1174 0     return globus_xsd_generic_array_serialize(
1175         element_qname,
1176         (const globus_xsd_generic_array_t *) array,
1177         message,
1178         options);
1179 }
1180 /* wstop_ExtensibleDocumented_array_serialize() */
1181
1182 globus_result_t
1183 wstop_ExtensibleDocumented_array_deserialize(
1184     const xsd_QName *                   element_qname,
1185     wstop_ExtensibleDocumented_array * array,
1186     globus_soap_message_handle_t        message,
1187     globus_xsd_element_options_t        options)
1188 0 {
1189     /* Some initializers set the array's contents to NULL */
1190 0     if (array->type_info == NULL)
1191     {
1192 0         array->type_info = &wstop_ExtensibleDocumented_info;
1193     }
1194 0     return globus_xsd_generic_array_deserialize(
1195         element_qname,
1196         (globus_xsd_generic_array_t *) array,
1197         message,
1198         options);