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 "wsp_LanguageAssertion.h"
21
22 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
23 xsd_QName wsp_LanguageAssertion_qname =
24 {
25     WSP_LANGUAGEASSERTION_NS,
26     WSP_LANGUAGEASSERTION_LOCAL
27 };
28 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
29
30 globus_result_t
31 wsp_LanguageAssertion_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 wsp_LanguageAssertion_serialize(
38         element_qname,
39         (wsp_LanguageAssertion *) instance,
40         message_handle, options);
41 }
42
43 globus_result_t
44 wsp_LanguageAssertion_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 wsp_LanguageAssertion_deserialize_pointer(
51         element_qname,
52         (wsp_LanguageAssertion **) ip,
53         message_handle, options);
54 }
55
56 globus_result_t
57 wsp_LanguageAssertion_init_wrapper(void **object)
58 0 {
59 0     return wsp_LanguageAssertion_init(
60         (wsp_LanguageAssertion **) object);
61 }
62
63 void
64 wsp_LanguageAssertion_destroy_wrapper(
65     void *                          object)
66 0 {
67 0     wsp_LanguageAssertion_destroy(
68         (wsp_LanguageAssertion *) object);
69 }
70
71 globus_result_t
72 wsp_LanguageAssertion_copy_wrapper(
73     void **                         dest_obj,
74     void *                          src_obj)
75 0 {
76 0     return wsp_LanguageAssertion_copy(
77         (wsp_LanguageAssertion **) dest_obj,
78         (wsp_LanguageAssertion *) src_obj);
79 }
80
81 globus_result_t
82 wsp_LanguageAssertion_init_contents_wrapper(void *object)
83 0 {
84 0     return wsp_LanguageAssertion_init_contents(
85         (wsp_LanguageAssertion *) object);
86 }
87
88 void
89 wsp_LanguageAssertion_destroy_contents_wrapper(
90     void *                          object)
91 0 {
92 0     wsp_LanguageAssertion_destroy_contents(
93         (wsp_LanguageAssertion *) object);
94 }
95
96 globus_result_t
97 wsp_LanguageAssertion_copy_contents_wrapper(
98     void *                          dest_obj,
99     void *                          src_obj)
100 0 {
101 0     return wsp_LanguageAssertion_copy_contents(
102         (wsp_LanguageAssertion *) dest_obj,
103         (wsp_LanguageAssertion *) src_obj);
104 }
105
106 globus_result_t
107 wsp_LanguageAssertion_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 wsp_LanguageAssertion_serialize_contents(
114         element_qname,
115         (wsp_LanguageAssertion *) instance,
116         message_handle, options);
117 }
118
119 globus_result_t
120 wsp_LanguageAssertion_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(wsp_LanguageAssertion_deserialize_contents_wrapper);
128 0     GlobusSoapMessageDebugEnter();
129
130 0     if(!*instance)
131     {
132 0         result = wsp_LanguageAssertion_init(
133             (wsp_LanguageAssertion **)instance);
134 0         if(result != GLOBUS_SUCCESS)
135         {
136 0             goto error;
137         }
138     }
139
140 0     result = wsp_LanguageAssertion_deserialize_contents(
141         element_qname,
142         *(wsp_LanguageAssertion **)instance,
143         message_handle, options);
144 error:
145 0     GlobusSoapMessageDebugExit();
146 0     return result;
147 }
148
149 globus_result_t
150 wsp_LanguageAssertion_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 wsp_LanguageAssertion_array_serialize(
157         element,
158         (wsp_LanguageAssertion_array *) instance,
159         message, options);
160 }
161
162 globus_result_t
163 wsp_LanguageAssertion_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 = wsp_LanguageAssertion_array_init(
174             (wsp_LanguageAssertion_array **)inst);
175 0         if(result != GLOBUS_SUCCESS)
176         {
177 0             return result;
178         }
179     }
180
181 0     return wsp_LanguageAssertion_array_deserialize(
182         element_qname,
183         *(wsp_LanguageAssertion_array **) inst,
184         message, options);
185 }
186
187 globus_result_t
188 wsp_LanguageAssertion_array_init_wrapper(
189     void **                             arr)
190 0 {
191 0     return wsp_LanguageAssertion_array_init(
192         (wsp_LanguageAssertion_array **) arr);
193 }
194
195 void
196 wsp_LanguageAssertion_array_destroy_wrapper(
197     void *                              arr)
198 0 {
199 0     wsp_LanguageAssertion_array_destroy(
200         (wsp_LanguageAssertion_array *) arr);
201 }
202
203 globus_result_t
204 wsp_LanguageAssertion_array_copy_wrapper(
205     void **                             dest_arr,
206     void *                              src_arr)
207 0 {
208 0     return wsp_LanguageAssertion_array_copy(
209         (wsp_LanguageAssertion_array **) dest_arr,
210         (wsp_LanguageAssertion_array *) src_arr);
211 }
212
213 globus_result_t
214 wsp_LanguageAssertion_array_init_contents_wrapper(
215     void *                              arr)
216 0 {
217 0     return wsp_LanguageAssertion_array_init_contents(
218         (wsp_LanguageAssertion_array *) arr);
219 }
220
221 void
222 wsp_LanguageAssertion_array_destroy_contents_wrapper(
223     void *                              arr)
224 0 {
225 0     wsp_LanguageAssertion_array_destroy_contents(
226         (wsp_LanguageAssertion_array *) arr);
227 }
228
229 globus_result_t
230 wsp_LanguageAssertion_array_copy_contents_wrapper(
231     void *                              dest_arr,
232     void *                              src_arr)
233 0 {
234 0     return wsp_LanguageAssertion_array_copy_contents(
235         (wsp_LanguageAssertion_array *) dest_arr,
236         (wsp_LanguageAssertion_array *) src_arr);
237 }
238
239 struct globus_xsd_type_info_s wsp_LanguageAssertion_contents_info =
240 {
241     &wsp_LanguageAssertion_qname,
242     wsp_LanguageAssertion_serialize_contents_wrapper,
243     wsp_LanguageAssertion_deserialize_contents_wrapper,
244     wsp_LanguageAssertion_init_wrapper,
245     wsp_LanguageAssertion_destroy_wrapper,
246     wsp_LanguageAssertion_copy_wrapper,
247     wsp_LanguageAssertion_init_contents_wrapper,
248     wsp_LanguageAssertion_destroy_contents_wrapper,
249     wsp_LanguageAssertion_copy_contents_wrapper,
250     sizeof(wsp_LanguageAssertion),
251     NULL,
252     NULL,
253     NULL
254 };
255
256 struct globus_xsd_type_info_s wsp_LanguageAssertion_array_info =
257 {
258     &wsp_LanguageAssertion_qname,
259     wsp_LanguageAssertion_array_serialize_wrapper,
260     wsp_LanguageAssertion_array_deserialize_wrapper,
261     wsp_LanguageAssertion_array_init_wrapper,
262     wsp_LanguageAssertion_array_destroy_wrapper,
263     wsp_LanguageAssertion_array_copy_wrapper,
264     wsp_LanguageAssertion_array_init_contents_wrapper,
265     wsp_LanguageAssertion_array_destroy_contents_wrapper,
266     wsp_LanguageAssertion_array_copy_contents_wrapper,
267     sizeof(wsp_LanguageAssertion),
268     wsp_LanguageAssertion_array_push_wrapper,
269     NULL,
270     NULL
271 };
272
273 struct globus_xsd_type_info_s wsp_LanguageAssertion_info =
274 {
275     &wsp_LanguageAssertion_qname,
276     wsp_LanguageAssertion_serialize_wrapper,
277     wsp_LanguageAssertion_deserialize_pointer_wrapper,
278     wsp_LanguageAssertion_init_wrapper,
279     wsp_LanguageAssertion_destroy_wrapper,
280     wsp_LanguageAssertion_copy_wrapper,
281     wsp_LanguageAssertion_init_contents_wrapper,
282     wsp_LanguageAssertion_destroy_contents_wrapper,
283     wsp_LanguageAssertion_copy_contents_wrapper,
284     sizeof(wsp_LanguageAssertion),
285     NULL,
286     &wsp_LanguageAssertion_contents_info,
287     &wsp_LanguageAssertion_array_info
288 };
289
290 globus_result_t
291 wsp_LanguageAssertion_init_contents(
292     wsp_LanguageAssertion * instance)
293 0 {
294 0     globus_result_t                     result = GLOBUS_SUCCESS;
295 0     GlobusFuncName(wsp_LanguageAssertion_init_contents);
296 0     GlobusSoapMessageDebugEnter();
297
298 0     memset(instance, 0, sizeof(wsp_LanguageAssertion));
299
300 0     GlobusSoapMessageDebugExit();
301 0     return result;
302 }
303
304 globus_result_t
305 wsp_LanguageAssertion_init(
306     wsp_LanguageAssertion ** object)
307 0 {
308 0     wsp_LanguageAssertion * instance;
309 0     globus_result_t                     result = GLOBUS_SUCCESS;
310 0     GlobusFuncName(wsp_LanguageAssertion_init);
311 0     GlobusSoapMessageDebugEnter();
312
313 0     instance = globus_malloc(sizeof(wsp_LanguageAssertion));
314 0     if(!instance)
315     {
316 0         result = GlobusSoapMessageErrorOutOfMemory;
317 0         goto exit;
318     }
319
320 0     memset(instance, 0, sizeof(wsp_LanguageAssertion));
321
322 0     *object = instance;
323
324  exit:
325 0     GlobusSoapMessageDebugExit();
326 0     return result;
327 }
328
329 void
330 wsp_LanguageAssertion_destroy(
331     wsp_LanguageAssertion * instance)
332 0 {
333 0     GlobusFuncName(wsp_LanguageAssertion_destroy);
334 0     GlobusSoapMessageDebugEnter();
335
336 0     if(!instance)
337     {
338 0         goto exit;
339     }
340
341 0     wsp_LanguageAssertion_destroy_contents(instance);
342 0     globus_free(instance);
343
344  exit:
345
346 0     GlobusSoapMessageDebugExit();
347 }
348
349 void
350 wsp_LanguageAssertion_destroy_contents(
351     wsp_LanguageAssertion * instance)
352 0 {
353 0     GlobusFuncName(wsp_LanguageAssertion_destroy_contents);
354 0     GlobusSoapMessageDebugEnter();
355
356 0     if(instance)
357     {
358
359
360 0     xsd_any_array_destroy_contents(&instance->any);
361
362 0         xsd_anyAttributes_destroy(instance->anyAttributes);
363 0         instance->anyAttributes = NULL;
364
365 0     xsd_language_destroy_contents(
366         &instance->_Language);
367
368 0     if(instance->_Id)
369     {
370 0         xsd_ID_destroy(
371             instance->_Id);
372 0         instance->_Id = NULL;
373     }
374
375 0     if(instance->_Preference)
376     {
377 0         xsd_int_destroy(
378             instance->_Preference);
379 0         instance->_Preference = NULL;
380     }
381
382 0     if(instance->_Usage)
383     {
384 0         wsp_OpenUsageType_destroy(
385             instance->_Usage);
386 0         instance->_Usage = NULL;
387     }
388
389     }
390
391 0     GlobusSoapMessageDebugExit();
392 }
393
394 globus_result_t
395 wsp_LanguageAssertion_copy(
396     wsp_LanguageAssertion ** dest_obj,
397     const wsp_LanguageAssertion * src_obj)
398 0 {
399 0     globus_result_t                     result = GLOBUS_SUCCESS;
400 0     wsp_LanguageAssertion * instance;
401 0     GlobusFuncName(wsp_LanguageAssertion_copy);
402
403 0     GlobusSoapMessageDebugEnter();
404
405 0     instance = malloc(sizeof(wsp_LanguageAssertion));
406 0     if (instance == NULL)
407     {
408 0         GlobusSoapMessageDebugExit();
409 0         return GlobusSoapMessageErrorOutOfMemory;
410     }
411
412 0     result = wsp_LanguageAssertion_copy_contents(instance, src_obj);
413 0     if(result != GLOBUS_SUCCESS)
414     {
415 0         globus_free(instance);
416 0         GlobusSoapMessageDebugExit();
417 0         return GlobusSoapMessageErrorOutOfMemory;
418     }
419
420 0     *dest_obj = instance;
421 0     GlobusSoapMessageDebugExit();
422 0     return result;
423 }
424
425 globus_result_t
426 wsp_LanguageAssertion_copy_contents(
427     wsp_LanguageAssertion * instance,
428     const wsp_LanguageAssertion * src_obj)
429 0 {
430 0     globus_result_t                     result = GLOBUS_SUCCESS;
431 0     GlobusFuncName(wsp_LanguageAssertion_copy_contents);
432
433 0     GlobusSoapMessageDebugEnter();
434
435
436 0     if(src_obj->anyAttributes)
437     {
438 0         result = xsd_anyAttributes_copy(&instance->anyAttributes, 
439                                         src_obj->anyAttributes);
440 0         if(result != GLOBUS_SUCCESS)
441         {
442 0             result = GlobusSoapMessageErrorCopyAnyAttrsFailed(
443                 result, NULL);
444 0             goto xsd_anyAttributes_after_destroy;
445         }
446     }
447     else
448     {
449 0         instance->anyAttributes = NULL;
450     }
451
452 0     result = xsd_language_copy_contents(
453         &instance->_Language,
454         &src_obj->_Language);
455 0     if(result != GLOBUS_SUCCESS)
456     {
457 0         result = GlobusSoapMessageErrorCopyFailed(
458             result, NULL, &xsd_language_qname);
459 0         goto _Language_destroy;
460     }
461
462 0     if(src_obj->_Id)
463     {
464 0         result = xsd_ID_copy(
465             &instance->_Id,
466             src_obj->_Id);
467 0         if(result != GLOBUS_SUCCESS)
468         {
469 0             result = GlobusSoapMessageErrorCopyFailed(
470                 result, NULL, &xsd_ID_qname);
471 0             goto _Id_destroy;
472         }
473     }
474     else
475     {
476 0         instance->_Id = NULL;
477     }
478
479 0     if(src_obj->_Preference)
480     {
481 0         result = xsd_int_copy(
482             &instance->_Preference,
483             src_obj->_Preference);
484 0         if(result != GLOBUS_SUCCESS)
485         {
486 0             result = GlobusSoapMessageErrorCopyFailed(
487                 result, NULL, &xsd_int_qname);
488 0             goto _Preference_destroy;
489         }
490     }
491     else
492     {
493 0         instance->_Preference = NULL;
494     }
495
496 0     if(src_obj->_Usage)
497     {
498 0         result = wsp_OpenUsageType_copy(
499             &instance->_Usage,
500             src_obj->_Usage);
501 0         if(result != GLOBUS_SUCCESS)
502         {
503 0             result = GlobusSoapMessageErrorCopyFailed(
504                 result, NULL, &wsp_OpenUsageType_qname);
505 0             goto _Usage_destroy;
506         }
507     }
508     else
509     {
510 0         instance->_Usage = NULL;
511     }
512     
513 0      result = xsd_any_array_copy_contents(
514          &instance->any,
515          &src_obj->any);
516 0      if(result != GLOBUS_SUCCESS)
517      {
518 0          result = GlobusSoapMessageErrorCopyFailed(
519              result, NULL, &xsd_any_qname);
520 0          goto any_destroy_array;
521      }
522
523 0     goto exit;
524
525  fail_deserialize:
526
527  xsd_anyAttributes_destroy:
528 0         xsd_anyAttributes_destroy(instance->anyAttributes);
529 0         instance->anyAttributes = NULL;
530  xsd_anyAttributes_after_destroy:
531
532  _Language_destroy:
533
534 0     xsd_language_destroy_contents(
535         &instance->_Language);
536
537  _Usage_destroy:
538
539 0     if(instance->_Usage)
540     {
541 0         wsp_OpenUsageType_destroy(
542             instance->_Usage);
543 0         instance->_Usage = NULL;
544     }
545
546  _Preference_destroy:
547
548 0     if(instance->_Preference)
549     {
550 0         xsd_int_destroy(
551             instance->_Preference);
552 0         instance->_Preference = NULL;
553     }
554
555  _Id_destroy:
556
557 0     if(instance->_Id)
558     {
559 0         xsd_ID_destroy(
560             instance->_Id);
561 0         instance->_Id = NULL;
562     }
563 0         xsd_any_array_destroy_contents(
564             &instance->any);
565
566  any_destroy_array:
567
568
569  exit:
570
571 0     GlobusSoapMessageDebugExit();
572 0     return result;
573 }
574
575
576
577 globus_result_t
578 wsp_LanguageAssertion_serialize_contents(
579     xsd_QName *                         element_qname, /* ignored */
580     wsp_LanguageAssertion * inst,
581     globus_soap_message_handle_t        message_handle,
582     globus_xsd_element_options_t        options)
583 0 {
584 0     globus_result_t                     result = GLOBUS_SUCCESS;
585 0     GlobusFuncName(wsp_LanguageAssertion_serialize_contents);
586 0     GlobusSoapMessageDebugEnter();
587
588 0     result = wsp_LanguageAssertion_serialize(
589         NULL,
590         inst,
591         message_handle,
592         options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
593 0     if(result != GLOBUS_SUCCESS)
594     {
595 0         result = GlobusSoapMessageErrorSerializeFailed(
596             result, NULL, element_qname);
597         goto exit;
598     }
599
600  exit:
601
602 0     GlobusSoapMessageDebugExit();
603 0     return result;
604 }
605
606
607
608 globus_result_t
609 wsp_LanguageAssertion_serialize(
610     xsd_QName *                         element_qname,
611     wsp_LanguageAssertion * instance,
612     globus_soap_message_handle_t        message_handle,
613     globus_xsd_element_options_t        options)
614 0 {
615 0     globus_result_t                     result = GLOBUS_SUCCESS;
616 0     xsd_QName                           subelement;
617 0     globus_list_t *                     any_attr_keys = NULL;
618 0     globus_list_t *                     any_attr_keys_iterator = NULL;
619 0     xsd_QName *                         type_attr = NULL;
620 0     char *                              prefix = NULL;
621 0     int                                 prefix_created;
622 0     int                                 define_prefix = 0;
623 0     int                                 save_options = options;
624
625 0     GlobusFuncName(wsp_LanguageAssertion_serialize);
626 0     GlobusSoapMessageDebugEnter();
627
628
629 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
630     {
631         /* serialize wsp_LanguageAssertion element */
632
633 0         result = globus_soap_message_invoke_ns_callouts(
634             message_handle,
635             element_qname,
636             GLOBUS_SOAP_MESSAGE_CALLOUT_NS_SET,
637             &options);
638 0         if(result != GLOBUS_SUCCESS)
639         {
640 0             result = GlobusSoapMessageErrorSerializeFailed(
641                 result, NULL, element_qname);
642 0             goto exit;
643         }
644
645 0 result = globus_soap_message_element_ns_set(
646             message_handle,
647             element_qname->Namespace,
648             &options);
649 0         if(result != GLOBUS_SUCCESS)
650         {
651 0             result = GlobusSoapMessageErrorSerializeFailed(
652                 result, NULL, element_qname);
653 0             goto exit;
654         }
655
656 0         result = xsd_anyAttributes_namespace_set(
657             message_handle, instance->anyAttributes, &options);
658 0         if(result != GLOBUS_SUCCESS)
659         {
660 0             result = GlobusSoapMessageErrorSerializeAnyAttrsFailed(
661                 result, "Failed to set namespace");
662 0             goto exit;
663         }
664
665 0         result = globus_soap_message_attribute_ns_set(
666             message_handle,
667             NULL,
668              &options);
669
670 0         if(result != GLOBUS_SUCCESS)
671         {
672 0             xsd_QName               error_qname;
673 0             error_qname.local = prefix;
674 0             error_qname.Namespace = "";
675 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
676                                                            NULL, 
677                                                            &error_qname);
678 0             goto exit;
679         }
680
681
682 0         if(instance->_Id)
683         {
684
685 0         result = globus_soap_message_attribute_ns_set(
686             message_handle,
687             "http://schemas.xmlsoap.org/ws/2002/07/utility",
688              &options);
689
690 0         if(result != GLOBUS_SUCCESS)
691         {
692 0             xsd_QName               error_qname;
693 0             error_qname.local = prefix;
694 0             error_qname.Namespace = "http://schemas.xmlsoap.org/ws/2002/07/utility";
695 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
696                                                            NULL, 
697                                                            &error_qname);
698 0             goto exit;
699         }
700
701
702         }
703
704 0         if(instance->_Preference)
705         {
706
707 0         result = globus_soap_message_attribute_ns_set(
708             message_handle,
709             "http://schemas.xmlsoap.org/ws/2002/12/policy",
710              &options);
711
712 0         if(result != GLOBUS_SUCCESS)
713         {
714 0             xsd_QName               error_qname;
715 0             error_qname.local = prefix;
716 0             error_qname.Namespace = "http://schemas.xmlsoap.org/ws/2002/12/policy";
717 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
718                                                            NULL, 
719                                                            &error_qname);
720 0             goto exit;
721         }
722
723
724         }
725
726 0         if(instance->_Usage)
727         {
728
729 0         result = globus_soap_message_attribute_ns_set(
730             message_handle,
731             "http://schemas.xmlsoap.org/ws/2002/12/policy",
732              &options);
733
734 0         if(result != GLOBUS_SUCCESS)
735         {
736 0             xsd_QName               error_qname;
737 0             error_qname.local = prefix;
738 0             error_qname.Namespace = "http://schemas.xmlsoap.org/ws/2002/12/policy";
739 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
740                                                            NULL, 
741                                                            &error_qname);
742 0             goto exit;
743         }
744
745
746         }
747
748 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
749    !globus_soap_message_serialize_is_c14n_subset(message_handle))
750         {
751 0             result = globus_soap_message_attribute_ns_set(
752                 message_handle,
753                 "http://www.w3.org/2001/XMLSchema-instance",
754                 &options);
755 0             if(result != GLOBUS_SUCCESS)
756             {
757 0                 result = GlobusSoapMessageErrorSerializeFailed(
758                     result, NULL, element_qname);
759 0                 goto exit;
760             }
761
762 0             result = globus_soap_message_attribute_ns_set(
763                 message_handle,
764                 wsp_LanguageAssertion_qname.Namespace,
765                 &options);
766 0             if(result != GLOBUS_SUCCESS)
767             {
768 0                 result = GlobusSoapMessageErrorSerializeFailed(
769                     result, NULL, element_qname);
770 0                 goto exit;
771             }
772         }
773
774 0         result = globus_soap_message_invoke_callouts(
775             message_handle,
776             element_qname,
777             GLOBUS_SOAP_MESSAGE_CALLOUT_BEGIN);
778 0         if(result != GLOBUS_SUCCESS)
779         {
780 0             result = GlobusSoapMessageErrorSerializeFailed(
781                 result, NULL, element_qname);
782 0             goto exit;
783         }
784
785 0         result = globus_soap_message_serialize_element(
786             message_handle,
787             element_qname,
788             options,
789             &wsp_LanguageAssertion_qname);
790 0         if(result != GLOBUS_SUCCESS)
791         {
792 0             result = GlobusSoapMessageErrorSerializeFailed(
793                 result, NULL, element_qname);
794 0             goto exit;
795         }
796
797 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
798    !globus_soap_message_serialize_is_c14n_subset(message_handle))
799         {
800 0            xsd_QName_init(&type_attr);
801        
802 0            type_attr->local = globus_libc_strdup("type");
803 0            type_attr->Namespace = globus_libc_strdup(XSI_NS);
804         }
805
806         /* serialize namespaces */
807         
808 0 result = globus_soap_message_invoke_ns_callouts(
809             message_handle,
810             element_qname,
811             GLOBUS_SOAP_MESSAGE_CALLOUT_NS_ADD,
812             &options);
813 0         if(result != GLOBUS_SUCCESS)
814         {
815 0             result = GlobusSoapMessageErrorSerializeFailed(
816                 result, NULL, element_qname);
817 0             goto exit;
818         }
819
820 0 result = globus_soap_message_element_ns_add(
821             message_handle,
822             element_qname->Namespace,
823             &options);
824 0         if(result != GLOBUS_SUCCESS)
825         {
826 0             result = GlobusSoapMessageErrorSerializeFailed(
827                 result, NULL, element_qname);
828 0             goto exit;
829         }
830
831 0         result = xsd_anyAttributes_namespace_add(
832             message_handle, instance->anyAttributes, &options);
833 0         if(result != GLOBUS_SUCCESS)
834         {
835 0             result = GlobusSoapMessageErrorSerializeAnyAttrsFailed(
836                 result, "Failed to add namespace");
837 0             goto exit;
838         }
839
840 0         result = globus_soap_message_attribute_ns_add(
841             message_handle,
842             NULL,
843              &options);
844
845 0         if(result != GLOBUS_SUCCESS)
846         {
847 0             xsd_QName               error_qname;
848 0             error_qname.local = prefix;
849 0             error_qname.Namespace = "";
850 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
851                                                            NULL, 
852                                                            &error_qname);
853 0             goto exit;
854         }
855
856
857 0         if(instance->_Id)
858         {
859
860 0         result = globus_soap_message_attribute_ns_add(
861             message_handle,
862             "http://schemas.xmlsoap.org/ws/2002/07/utility",
863              &options);
864
865 0         if(result != GLOBUS_SUCCESS)
866         {
867 0             xsd_QName               error_qname;
868 0             error_qname.local = prefix;
869 0             error_qname.Namespace = "http://schemas.xmlsoap.org/ws/2002/07/utility";
870 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
871                                                            NULL, 
872                                                            &error_qname);
873 0             goto exit;
874         }
875
876
877         }
878
879 0         if(instance->_Preference)
880         {
881
882 0         result = globus_soap_message_attribute_ns_add(
883             message_handle,
884             "http://schemas.xmlsoap.org/ws/2002/12/policy",
885              &options);
886
887 0         if(result != GLOBUS_SUCCESS)
888         {
889 0             xsd_QName               error_qname;
890 0             error_qname.local = prefix;
891 0             error_qname.Namespace = "http://schemas.xmlsoap.org/ws/2002/12/policy";
892 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
893                                                            NULL, 
894                                                            &error_qname);
895 0             goto exit;
896         }
897
898
899         }
900
901 0         if(instance->_Usage)
902         {
903
904 0         result = globus_soap_message_attribute_ns_add(
905             message_handle,
906             "http://schemas.xmlsoap.org/ws/2002/12/policy",
907              &options);
908
909 0         if(result != GLOBUS_SUCCESS)
910         {
911 0             xsd_QName               error_qname;
912 0             error_qname.local = prefix;
913 0             error_qname.Namespace = "http://schemas.xmlsoap.org/ws/2002/12/policy";
914 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
915                                                            NULL, 
916                                                            &error_qname);
917 0             goto exit;
918         }
919
920
921         }
922
923 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
924    !globus_soap_message_serialize_is_c14n_subset(message_handle))
925         {
926 0             result = globus_soap_message_attribute_ns_add(
927                 message_handle,
928                 "http://www.w3.org/2001/XMLSchema-instance",
929                 &options);
930 0             if(result != GLOBUS_SUCCESS)
931             {
932 0                 result = GlobusSoapMessageErrorSerializeFailed(
933                     result, NULL, element_qname);
934 0                 goto exit;
935             }
936
937 0             result = globus_soap_message_attribute_ns_add(
938                 message_handle,
939                 wsp_LanguageAssertion_qname.Namespace,
940                 &options);
941 0             if(result != GLOBUS_SUCCESS)
942             {
943 0                 result = GlobusSoapMessageErrorSerializeFailed(
944                     result, NULL, element_qname);
945 0                 goto exit;
946             }
947         }
948
949         /* serialize attributes */
950
951 0         if(instance->anyAttributes)
952         {
953 0             any_attr_keys = xsd_anyAttributes_lex_sort(
954                 instance->anyAttributes);
955 0             any_attr_keys_iterator = any_attr_keys;
956         }
957
958 0         subelement.Namespace = "";
959 0         subelement.local = "Language";
960
961 0         if(any_attr_keys_iterator)
962         {
963 0             result = xsd_anyAttributes_serialize_lex_before(
964                 message_handle,
965                 &any_attr_keys_iterator,
966                 instance->anyAttributes,
967                 &subelement);
968 0             if(result != GLOBUS_SUCCESS)
969             {
970 0                 result = GlobusSoapMessageErrorSerializeFailed(result, 
971                                                                NULL, 
972                                                                element_qname);
973 0                 goto exit;
974             }
975         }
976
977 0         result = xsd_language_serialize_attribute(
978             &subelement,
979             &instance->_Language,
980             message_handle,
981             options & (~GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS));
982 0         if(result != GLOBUS_SUCCESS)
983         {
984 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
985                                                            NULL, 
986                                                            element_qname);
987 0             goto exit;
988         }
989
990 0         subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/07/utility";
991 0         subelement.local = "Id";
992
993 0         if(any_attr_keys_iterator)
994         {
995 0             result = xsd_anyAttributes_serialize_lex_before(
996                 message_handle,
997                 &any_attr_keys_iterator,
998                 instance->anyAttributes,
999                 &subelement);
1000 0             if(result != GLOBUS_SUCCESS)
1001             {
1002 0                 result = GlobusSoapMessageErrorSerializeFailed(result, 
1003                                                                NULL, 
1004                                                                element_qname);
1005 0                 goto exit;
1006             }
1007         }
1008
1009 0         if(instance->_Id)
1010         {
1011
1012 0         result = xsd_ID_serialize_attribute(
1013             &subelement,
1014             instance->_Id,
1015             message_handle,
1016             options & (~GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS));
1017 0         if(result != GLOBUS_SUCCESS)
1018         {
1019 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
1020                                                            NULL, 
1021                                                            element_qname);
1022 0             goto exit;
1023         }
1024
1025         }
1026
1027 0         subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/12/policy";
1028 0         subelement.local = "Preference";
1029
1030 0         if(any_attr_keys_iterator)
1031         {
1032 0             result = xsd_anyAttributes_serialize_lex_before(
1033                 message_handle,
1034                 &any_attr_keys_iterator,
1035                 instance->anyAttributes,
1036                 &subelement);
1037 0             if(result != GLOBUS_SUCCESS)
1038             {
1039 0                 result = GlobusSoapMessageErrorSerializeFailed(result, 
1040                                                                NULL, 
1041                                                                element_qname);
1042 0                 goto exit;
1043             }
1044         }
1045
1046 0         if(instance->_Preference)
1047         {
1048
1049 0         result = xsd_int_serialize_attribute(
1050             &subelement,
1051             instance->_Preference,
1052             message_handle,
1053             options & (~GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS));
1054 0         if(result != GLOBUS_SUCCESS)
1055         {
1056 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
1057                                                            NULL, 
1058                                                            element_qname);
1059 0             goto exit;
1060         }
1061
1062         }
1063
1064 0         subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/12/policy";
1065 0         subelement.local = "Usage";
1066
1067 0         if(any_attr_keys_iterator)
1068         {
1069 0             result = xsd_anyAttributes_serialize_lex_before(
1070                 message_handle,
1071                 &any_attr_keys_iterator,
1072                 instance->anyAttributes,
1073                 &subelement);
1074 0             if(result != GLOBUS_SUCCESS)
1075             {
1076 0                 result = GlobusSoapMessageErrorSerializeFailed(result, 
1077                                                                NULL, 
1078                                                                element_qname);
1079 0                 goto exit;
1080             }
1081         }
1082
1083 0         if(instance->_Usage)
1084         {
1085
1086 0         result = wsp_OpenUsageType_serialize_attribute(
1087             &subelement,
1088             instance->_Usage,
1089             message_handle,
1090             options & (~GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS));
1091 0         if(result != GLOBUS_SUCCESS)
1092         {
1093 0             result = GlobusSoapMessageErrorSerializeFailed(result, 
1094                                                            NULL, 
1095                                                            element_qname);
1096 0             goto exit;
1097         }
1098
1099         }
1100
1101 0         if(any_attr_keys_iterator)
1102         {
1103 0             result = xsd_anyAttributes_serialize_lex_before(
1104                 message_handle,
1105                 &any_attr_keys_iterator,
1106                 instance->anyAttributes,
1107                 &subelement);
1108 0             if(result != GLOBUS_SUCCESS)
1109             {
1110 0                 result = GlobusSoapMessageErrorSerializeFailed(result, 
1111                                                                NULL, 
1112                                                                element_qname);
1113 0                 goto exit;
1114             }
1115         }
1116
1117 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
1118    !globus_soap_message_serialize_is_c14n_subset(message_handle))
1119         {
1120 0             result = globus_soap_message_serialize_QName_attribute(
1121                 message_handle,
1122                 type_attr,
1123                 &wsp_LanguageAssertion_qname);
1124 0             if(result != GLOBUS_SUCCESS)
1125             {
1126 0                 result = GlobusSoapMessageErrorSerializeFailed(
1127                     result, NULL, element_qname);
1128 0                 goto exit;
1129             }
1130         }
1131
1132
1133 0         result = globus_soap_message_invoke_callouts(
1134             message_handle,
1135             element_qname,
1136             GLOBUS_SOAP_MESSAGE_CALLOUT_ATTR);
1137 0         if(result != GLOBUS_SUCCESS)
1138         {
1139 0             result = GlobusSoapMessageErrorSerializeFailed(
1140                 result, NULL, element_qname);
1141 0             goto exit;
1142         }
1143     }
1144
1145 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
1146     {
1147 0         result = globus_soap_message_serialize_element_begin_close(
1148             message_handle);
1149 0         if(result != GLOBUS_SUCCESS)
1150         {
1151 0             result = GlobusSoapMessageErrorSerializeFailed(
1152                 result, NULL, element_qname);
1153 0             goto exit;
1154         }
1155     }
1156 0     options &= ~GLOBUS_XSD_ELEMENT_CONTENTS_ONLY;
1157
1158     /* serialize contents of type */
1159
1160 0     subelement.local = "any";
1161 0     subelement.Namespace = "http://www.w3.org/2001/XMLSchema";
1162     
1163 0      result = xsd_any_array_serialize(
1164          &subelement,
1165          &instance->any,
1166          message_handle,
1167          options & (~GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS));
1168 0      if(result != GLOBUS_SUCCESS)
1169      {
1170 0          result = GlobusSoapMessageErrorSerializeFailed(
1171              result, NULL, &xsd_any_qname);
1172 0          goto exit;
1173      }
1174
1175 0     options = save_options;
1176
1177 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
1178     {
1179         /* add end element */
1180 0         result = globus_soap_message_serialize_element_end(
1181             message_handle,
1182             element_qname,
1183             options,
1184             &wsp_LanguageAssertion_qname);
1185 0         if(result != GLOBUS_SUCCESS)
1186         {
1187 0             result = GlobusSoapMessageErrorSerializeFailed(
1188                 result, NULL, element_qname);
1189 0             goto exit;
1190         }
1191
1192 0         globus_soap_message_element_ns_remove(
1193             message_handle,
1194             element_qname->Namespace,
1195             &options);
1196
1197     /* remove namespace/prefix mappings for these types */
1198
1199 0         result = xsd_anyAttributes_namespace_remove(
1200             message_handle, instance->anyAttributes, &options);
1201 0         if(result != GLOBUS_SUCCESS)
1202         {
1203 0             result = GlobusSoapMessageErrorSerializeAnyAttrsFailed(
1204                 result, "Failed to remove namespace");
1205 0             goto exit;
1206         }
1207
1208 0         globus_soap_message_attribute_ns_remove(
1209             message_handle,
1210             NULL,
1211              &options);
1212
1213 0         if(instance->_Id)
1214         {
1215
1216 0         globus_soap_message_attribute_ns_remove(
1217             message_handle,
1218             "http://schemas.xmlsoap.org/ws/2002/07/utility",
1219              &options);
1220
1221         }
1222
1223 0         if(instance->_Preference)
1224         {
1225
1226 0         globus_soap_message_attribute_ns_remove(
1227             message_handle,
1228             "http://schemas.xmlsoap.org/ws/2002/12/policy",
1229              &options);
1230
1231         }
1232
1233 0         if(instance->_Usage)
1234         {
1235
1236 0         globus_soap_message_attribute_ns_remove(
1237             message_handle,
1238             "http://schemas.xmlsoap.org/ws/2002/12/policy",
1239              &options);
1240
1241         }
1242
1243 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
1244    !globus_soap_message_serialize_is_c14n_subset(message_handle))
1245         {
1246 0             globus_soap_message_attribute_ns_remove(
1247                 message_handle,
1248                 "http://www.w3.org/2001/XMLSchema-instance",
1249                 &options);
1250            
1251 0             globus_soap_message_attribute_ns_remove(
1252                 message_handle,
1253                 wsp_LanguageAssertion_qname.Namespace,
1254                 &options);
1255         }           
1256
1257 0         result = globus_soap_message_invoke_ns_callouts(
1258             message_handle,
1259             element_qname,
1260             GLOBUS_SOAP_MESSAGE_CALLOUT_NS_REMOVE,
1261             &options);
1262 0         if(result != GLOBUS_SUCCESS)
1263         {
1264 0             result  = GlobusSoapMessageErrorSerializeFailed(
1265                 result, NULL, element_qname);
1266 0             goto exit;
1267         }
1268
1269 0         result = globus_soap_message_invoke_callouts(
1270             message_handle,
1271             element_qname,
1272             GLOBUS_SOAP_MESSAGE_CALLOUT_END);
1273 0         if(result != GLOBUS_SUCCESS)
1274         {
1275 0             result = GlobusSoapMessageErrorSerializeFailed(
1276                 result, NULL, element_qname);
1277             goto exit;
1278         }
1279     }
1280
1281  exit:
1282 0     if (type_attr)
1283     {
1284 0         xsd_QName_destroy(type_attr);
1285     }
1286
1287 0     if(any_attr_keys)
1288     {
1289 0         globus_list_free(any_attr_keys);
1290     }
1291
1292 0     GlobusSoapMessageDebugExit();
1293 0     return result;
1294 }
1295
1296
1297
1298 globus_result_t
1299 wsp_LanguageAssertion_deserialize_contents(
1300     xsd_QName *                         element_qname, /* ignored */
1301     wsp_LanguageAssertion * inst,
1302     globus_soap_message_handle_t        message_handle,
1303     globus_xsd_element_options_t        options)
1304 0 {
1305 0     globus_result_t                     result = GLOBUS_SUCCESS;
1306 0     GlobusFuncName(wsp_LanguageAssertion_deserialize_contents);
1307 0     GlobusSoapMessageDebugEnter();
1308
1309 0     result = wsp_LanguageAssertion_deserialize(
1310         NULL,
1311         inst,
1312         message_handle,
1313         options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
1314 0     if(result != GLOBUS_SUCCESS)
1315     {
1316 0         result = GlobusSoapMessageErrorDeserializeFailed(
1317             result, element_qname);
1318         goto exit;
1319     }
1320
1321  exit:
1322
1323 0     GlobusSoapMessageDebugExit();
1324 0     return result;
1325 }
1326
1327
1328
1329 globus_result_t
1330 wsp_LanguageAssertion_deserialize(
1331     xsd_QName *                         element_qname,
1332     wsp_LanguageAssertion * instance,
1333     globus_soap_message_handle_t        message_handle,
1334     globus_xsd_element_options_t        options)
1335 0 {
1336 0     globus_result_t                     result = GLOBUS_SUCCESS;
1337 0     xsd_QName                           subelement;
1338 0     GlobusFuncName(wsp_LanguageAssertion_deserialize);
1339 0     GlobusSoapMessageDebugEnter();
1340
1341
1342 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
1343     {
1344 0         result = globus_soap_message_deserialize_element(
1345             message_handle, element_qname);
1346 0         if(result != GLOBUS_SUCCESS)
1347         {
1348 0             result = GlobusSoapMessageErrorDeserializeFailed(
1349                 result, element_qname);
1350 0             goto exit;
1351         }
1352
1353 0         result = xsd_anyAttributes_init(&instance->anyAttributes);
1354 0         if(result != GLOBUS_SUCCESS)
1355         {
1356 0             result = GlobusSoapMessageErrorDeserializeFailed(
1357                 result, element_qname);
1358 0             goto xsd_anyAttributes_after_destroy;
1359         }
1360
1361 0         result = xsd_anyAttributes_deserialize(
1362             message_handle,
1363             instance->anyAttributes);
1364 0         if(result != GLOBUS_SUCCESS)
1365         {
1366 0             result = GlobusSoapMessageErrorDeserializeFailed(
1367                 result, element_qname);
1368 0             goto xsd_anyAttributes_destroy;
1369         }
1370
1371 0     subelement.Namespace = "";
1372 0     subelement.local = "Language";
1373
1374 0     result = xsd_language_deserialize_attribute(        
1375         &subelement,
1376         &instance->_Language,
1377         message_handle,
1378         0);
1379 0     if(result != GLOBUS_SUCCESS)
1380     {
1381 0         result = GlobusSoapMessageErrorDeserializeFailed(result, &subelement);
1382 0         goto _Language_destroy;
1383     }
1384
1385 0     subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/07/utility";
1386 0     subelement.local = "Id";
1387
1388 0     result = xsd_ID_deserialize_attribute_pointer(
1389         &subelement,
1390         &instance->_Id,
1391         message_handle,
1392         0);
1393 0     if(result != GLOBUS_SUCCESS)
1394     {
1395 0         result = GlobusSoapMessageErrorDeserializeFailed(result, &subelement);
1396 0         goto _Id_destroy;
1397     }
1398
1399
1400 0     subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/12/policy";
1401 0     subelement.local = "Preference";
1402
1403 0     result = xsd_int_deserialize_attribute_pointer(
1404         &subelement,
1405         &instance->_Preference,
1406         message_handle,
1407         0);
1408 0     if(result != GLOBUS_SUCCESS)
1409     {
1410 0         result = GlobusSoapMessageErrorDeserializeFailed(result, &subelement);
1411 0         goto _Preference_destroy;
1412     }
1413
1414
1415 0     subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/12/policy";
1416 0     subelement.local = "Usage";
1417
1418 0     result = wsp_OpenUsageType_deserialize_attribute_pointer(
1419         &subelement,
1420         &instance->_Usage,
1421         message_handle,
1422         0);
1423 0     if(result != GLOBUS_SUCCESS)
1424     {
1425 0         result = GlobusSoapMessageErrorDeserializeFailed(result, &subelement);
1426 0         goto _Usage_destroy;
1427     }
1428
1429
1430
1431 0         result = globus_soap_message_deserialize_element_begin_close(
1432             message_handle);
1433 0         if(result != GLOBUS_SUCCESS)
1434         {
1435 0             result = GlobusSoapMessageErrorDeserializeFailed(
1436                 result, element_qname);
1437 0             goto fail_deserialize;
1438         }
1439     }
1440
1441 0     subelement.local = "any";
1442 0     subelement.Namespace = "http://www.w3.org/2001/XMLSchema";
1443     
1444 0     result = xsd_any_array_deserialize(
1445         &subelement,
1446         &instance->any,
1447         message_handle,
1448         0);
1449 0     if(result != GLOBUS_SUCCESS)
1450     {
1451 0         result = GlobusSoapMessageErrorDeserializeFailed(
1452             result, 
1453             (&subelement));
1454 0         goto any_destroy_array;
1455     }
1456
1457 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
1458     {
1459 0         result = globus_soap_message_deserialize_element_end(
1460             message_handle,
1461             element_qname);
1462 0         if(result != GLOBUS_SUCCESS)
1463         {
1464 0             result = GlobusSoapMessageErrorDeserializeFailed(
1465                 result, element_qname);
1466             goto fail_deserialize;
1467         }
1468     }
1469
1470 0     goto exit;
1471
1472  fail_deserialize:
1473
1474  xsd_anyAttributes_destroy:
1475 0         xsd_anyAttributes_destroy(instance->anyAttributes);
1476 0         instance->anyAttributes = NULL;
1477  xsd_anyAttributes_after_destroy:
1478
1479  _Language_destroy:
1480
1481 0     xsd_language_destroy_contents(
1482         &instance->_Language);
1483
1484  _Usage_destroy:
1485
1486 0     if(instance->_Usage)
1487     {
1488 0         wsp_OpenUsageType_destroy(
1489             instance->_Usage);
1490 0         instance->_Usage = NULL;
1491     }
1492
1493  _Preference_destroy:
1494
1495 0     if(instance->_Preference)
1496     {
1497 0         xsd_int_destroy(
1498             instance->_Preference);
1499 0         instance->_Preference = NULL;
1500     }
1501
1502  _Id_destroy:
1503
1504 0     if(instance->_Id)
1505     {
1506 0         xsd_ID_destroy(
1507             instance->_Id);
1508 0         instance->_Id = NULL;
1509     }
1510 0         xsd_any_array_destroy_contents(
1511             &instance->any);
1512
1513  any_destroy_array:
1514
1515
1516  exit:
1517
1518 0     GlobusSoapMessageDebugExit();
1519 0     return result;
1520 }
1521
1522
1523
1524 globus_result_t
1525 wsp_LanguageAssertion_deserialize_pointer(
1526     xsd_QName *                         element_qname,
1527     wsp_LanguageAssertion ** ip,
1528     globus_soap_message_handle_t        message_handle,
1529     globus_xsd_element_options_t        options)
1530 0 {
1531 0     wsp_LanguageAssertion * instance = NULL;
1532 0     globus_result_t                     result = GLOBUS_SUCCESS;
1533 0     xsd_QName                           subelement;
1534 0     int                                 found_attrs = 0;
1535 0     int                                 empty_element = 0;
1536 0     GlobusFuncName(wsp_LanguageAssertion_deserialize_pointer);
1537 0     GlobusSoapMessageDebugEnter();
1538
1539 0     *ip = NULL;
1540
1541 0     result = globus_soap_message_deserialize_element(
1542         message_handle, element_qname);
1543 0     if(result != GLOBUS_SUCCESS &&
1544        (GlobusSoapMessageStatusElementNotFoundCheck(result) ||
1545         GlobusSoapMessageStatusFailedElementCheck(result) ||
1546         GlobusSoapMessageStatusFailedWithTextCheck(result)))
1547     {
1548 0         *ip = NULL;
1549 0         result = GLOBUS_SUCCESS;
1550 0         goto exit;
1551     }
1552
1553 0     if(result != GLOBUS_SUCCESS)
1554     {
1555 0         result = GlobusSoapMessageErrorDeserializeFailed(
1556             result, element_qname);
1557 0         goto exit;
1558     }
1559
1560 0     if(globus_soap_message_deserialize_element_is_empty(
1561            message_handle))
1562     {
1563 0         empty_element = 1;
1564     }
1565
1566
1567
1568 0     result = wsp_LanguageAssertion_init(&instance);
1569 0     if(result != GLOBUS_SUCCESS)
1570     {
1571 0         result = GlobusSoapMessageErrorDeserializeFailed(
1572             result, element_qname);
1573 0         goto exit;
1574     }
1575
1576
1577 0         result = xsd_anyAttributes_init(&instance->anyAttributes);
1578 0         if(result != GLOBUS_SUCCESS)
1579         {
1580 0             result = GlobusSoapMessageErrorDeserializeFailed(
1581                 result, element_qname);
1582 0             goto xsd_anyAttributes_after_destroy;
1583         }
1584
1585 0         result = xsd_anyAttributes_deserialize(
1586             message_handle,
1587             instance->anyAttributes);
1588 0         if(result != GLOBUS_SUCCESS)
1589         {
1590 0             result = GlobusSoapMessageErrorDeserializeFailed(
1591                 result, element_qname);
1592 0             goto xsd_anyAttributes_destroy;
1593         }
1594
1595 0         if(instance->anyAttributes &&
1596            xsd_anyAttributes_size(instance->anyAttributes) > 0)
1597         {
1598 0             found_attrs++;
1599         }
1600
1601 0     subelement.Namespace = "";
1602 0     subelement.local = "Language";
1603
1604 0     result = xsd_language_deserialize_attribute(        
1605         &subelement,
1606         &instance->_Language,
1607         message_handle,
1608         0);
1609 0     if(result != GLOBUS_SUCCESS)
1610     {
1611 0         result = GlobusSoapMessageErrorDeserializeFailed(result, &subelement);
1612 0         goto _Language_destroy;
1613     }
1614
1615 0     found_attrs++;
1616
1617 0     subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/07/utility";
1618 0     subelement.local = "Id";
1619
1620 0     result = xsd_ID_deserialize_attribute_pointer(
1621         &subelement,
1622         &instance->_Id,
1623         message_handle,
1624         0);
1625 0     if(result != GLOBUS_SUCCESS)
1626     {
1627 0         result = GlobusSoapMessageErrorDeserializeFailed(result, &subelement);
1628 0         goto _Id_destroy;
1629     }
1630
1631
1632 0     if(instance->_Id)
1633     {
1634 0         found_attrs++;
1635     }
1636
1637 0     subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/12/policy";
1638 0     subelement.local = "Preference";
1639
1640 0     result = xsd_int_deserialize_attribute_pointer(
1641         &subelement,
1642         &instance->_Preference,
1643         message_handle,
1644         0);
1645 0     if(result != GLOBUS_SUCCESS)
1646     {
1647 0         result = GlobusSoapMessageErrorDeserializeFailed(result, &subelement);
1648 0         goto _Preference_destroy;
1649     }
1650
1651
1652 0     if(instance->_Preference)
1653     {
1654 0         found_attrs++;
1655     }
1656
1657 0     subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/12/policy";
1658 0     subelement.local = "Usage";
1659
1660 0     result = wsp_OpenUsageType_deserialize_attribute_pointer(
1661         &subelement,
1662         &instance->_Usage,
1663         message_handle,
1664         0);
1665 0     if(result != GLOBUS_SUCCESS)
1666     {
1667 0         result = GlobusSoapMessageErrorDeserializeFailed(result, &subelement);
1668 0         goto _Usage_destroy;
1669     }
1670
1671
1672 0     if(instance->_Usage)
1673     {
1674 0         found_attrs++;
1675     }
1676
1677
1678 0     if(empty_element)
1679     {
1680 0         result = globus_soap_message_deserialize_element_end(
1681             message_handle,
1682             element_qname);
1683 0         if(result != GLOBUS_SUCCESS)
1684         {
1685 0             result = GlobusSoapMessageErrorDeserializeFailed(
1686                 result, element_qname);
1687 0             goto fail_deserialize;
1688         }
1689
1690 0         *ip = instance;
1691 0         goto exit;
1692     }
1693
1694 0     result = globus_soap_message_deserialize_element_begin_close(
1695         message_handle);
1696 0     if(result != GLOBUS_SUCCESS)
1697     {
1698 0         result = GlobusSoapMessageErrorDeserializeFailed(
1699             result, element_qname);
1700 0         goto exit;
1701     }
1702
1703
1704 0     subelement.local = "any";
1705 0     subelement.Namespace = "http://www.w3.org/2001/XMLSchema";
1706     
1707 0     result = xsd_any_array_deserialize(
1708         &subelement,
1709         &instance->any,
1710         message_handle,
1711         0);
1712 0     if(result != GLOBUS_SUCCESS)
1713     {
1714 0         result = GlobusSoapMessageErrorDeserializeFailed(
1715             result, 
1716             (&subelement));
1717 0         goto any_destroy_array;
1718     }
1719
1720
1721 0     result = globus_soap_message_deserialize_element_end(
1722         message_handle,
1723         element_qname);
1724 0     if(result != GLOBUS_SUCCESS)
1725     {
1726 0         result = GlobusSoapMessageErrorDeserializeFailed(
1727             result, element_qname);
1728 0         goto fail_deserialize;
1729     }
1730
1731 0     *ip = instance;
1732
1733 0     goto exit;
1734
1735  fail_deserialize:
1736
1737  xsd_anyAttributes_destroy:
1738 0         xsd_anyAttributes_destroy(instance->anyAttributes);
1739 0         instance->anyAttributes = NULL;
1740  xsd_anyAttributes_after_destroy:
1741
1742  _Language_destroy:
1743
1744 0     xsd_language_destroy_contents(
1745         &instance->_Language);
1746
1747  _Usage_destroy:
1748
1749 0     if(instance->_Usage)
1750     {
1751 0         wsp_OpenUsageType_destroy(
1752             instance->_Usage);
1753 0         instance->_Usage = NULL;
1754     }
1755
1756  _Preference_destroy:
1757
1758 0     if(instance->_Preference)
1759     {
1760 0         xsd_int_destroy(
1761             instance->_Preference);
1762 0         instance->_Preference = NULL;
1763     }
1764
1765  _Id_destroy:
1766
1767 0     if(instance->_Id)
1768     {
1769 0         xsd_ID_destroy(
1770             instance->_Id);
1771 0         instance->_Id = NULL;
1772     }
1773 0         xsd_any_array_destroy_contents(
1774             &instance->any);
1775
1776  any_destroy_array:
1777
1778  exit:
1779
1780 0     GlobusSoapMessageDebugExit();
1781 0     return result;
1782 }
1783
1784
1785 globus_result_t
1786 wsp_LanguageAssertion_array_init_contents(
1787     wsp_LanguageAssertion_array * array)
1788 0 {
1789 0     GlobusFuncName(wsp_LanguageAssertion_array_init_contents);
1790 0     GlobusSoapMessageDebugEnter();
1791
1792 0     memset(array, 0, sizeof(wsp_LanguageAssertion_array));
1793
1794 0     GlobusSoapMessageDebugExit();
1795 0     return GLOBUS_SUCCESS;
1796 }
1797
1798 globus_result_t
1799 wsp_LanguageAssertion_array_init(
1800     wsp_LanguageAssertion_array ** arr)
1801 0 {
1802 0     wsp_LanguageAssertion_array * array;
1803 0     globus_result_t                     result;
1804 0     GlobusFuncName(wsp_LanguageAssertion_array_init);
1805 0     GlobusSoapMessageDebugEnter();
1806
1807 0     array = (wsp_LanguageAssertion_array *)
1808         globus_malloc(sizeof(wsp_LanguageAssertion_array));
1809 0     if(!array)
1810     {
1811 0         result = GlobusSoapMessageErrorOutOfMemory;
1812 0         goto exit;
1813     }
1814
1815 0     result = wsp_LanguageAssertion_array_init_contents(array);
1816 0     if(result != GLOBUS_SUCCESS)
1817     {
1818 0         globus_free(array);
1819 0         array = NULL;
1820
1821     }
1822
1823 0     *arr = array;
1824
1825  exit:
1826 0     GlobusSoapMessageDebugExit();
1827 0     return result;
1828 }
1829
1830 void
1831 wsp_LanguageAssertion_array_destroy_contents(
1832     wsp_LanguageAssertion_array * array)
1833 0 {
1834 0     int                                 i = 0;
1835 0     GlobusFuncName(wsp_LanguageAssertion_array_destroy_contents);
1836 0     GlobusSoapMessageDebugEnter();
1837
1838 0     for(; i < array->length; ++i)
1839     {
1840 0         wsp_LanguageAssertion_destroy_contents(&array->elements[i]);
1841     }
1842
1843 0     if(array->elements)
1844     {
1845 0         globus_free(array->elements);
1846 0         array->elements = NULL;
1847     }
1848 0     array->length = 0;
1849
1850 0     GlobusSoapMessageDebugExit();
1851 }
1852
1853 void
1854 wsp_LanguageAssertion_array_destroy(
1855     wsp_LanguageAssertion_array * array)
1856 0 {
1857 0     GlobusFuncName(wsp_LanguageAssertion_array_destroy);
1858 0     GlobusSoapMessageDebugEnter();
1859
1860 0     wsp_LanguageAssertion_array_destroy_contents(array);
1861 0     globus_free(array);
1862
1863 0     GlobusSoapMessageDebugExit();
1864 }
1865
1866 globus_result_t
1867 wsp_LanguageAssertion_array_copy(
1868     wsp_LanguageAssertion_array ** dest_arr,
1869     const wsp_LanguageAssertion_array * src_arr)
1870 0 {
1871 0     wsp_LanguageAssertion_array * array;
1872 0     globus_result_t                     result;
1873 0     GlobusFuncName(wsp_LanguageAssertion_array_copy);
1874 0     GlobusSoapMessageDebugEnter();
1875
1876 0     array = (wsp_LanguageAssertion_array *) globus_malloc(
1877         sizeof(wsp_LanguageAssertion_array));
1878 0     if(!array)
1879     {
1880 0         result = GlobusSoapMessageErrorOutOfMemory;
1881 0         GlobusSoapMessageDebugExit();
1882 0         return result;
1883     }
1884
1885 0     result = wsp_LanguageAssertion_array_copy_contents(array, src_arr);
1886 0     if(result != GLOBUS_SUCCESS)
1887     {
1888 0         globus_free(array);
1889 0         GlobusSoapMessageDebugExit();
1890 0         return result;
1891     }
1892
1893 0     *dest_arr = array;
1894
1895 0     GlobusSoapMessageDebugExit();
1896 0     return GLOBUS_SUCCESS;
1897 }
1898
1899 globus_result_t
1900 wsp_LanguageAssertion_array_copy_contents(
1901     wsp_LanguageAssertion_array * dest_arr,
1902     const wsp_LanguageAssertion_array * src_arr)
1903 0 {
1904 0     int                                 i;
1905 0     globus_result_t                     result = GLOBUS_SUCCESS;
1906 0     GlobusFuncName(wsp_LanguageAssertion_array_copy_contents);
1907 0     GlobusSoapMessageDebugEnter();
1908
1909 0     dest_arr->length = src_arr->length;
1910 0     if(dest_arr->length > 0)
1911     {
1912 0         dest_arr->elements = (wsp_LanguageAssertion *) malloc(
1913             sizeof(wsp_LanguageAssertion) * dest_arr->length);
1914 0         if(!dest_arr->elements)
1915         {
1916 0             result = GlobusSoapMessageErrorOutOfMemory;
1917 0             GlobusSoapMessageDebugExit();
1918 0             return result;
1919         }
1920     }
1921     else
1922     {
1923 0         dest_arr->elements = NULL;
1924     }
1925     
1926 0     for(i = 0; i < dest_arr->length; i++)
1927     {
1928 0         result = wsp_LanguageAssertion_copy_contents(
1929             &dest_arr->elements[i], &src_arr->elements[i]);
1930 0         if(result != GLOBUS_SUCCESS)
1931         {
1932 0             while(i--)
1933             {
1934 0                 wsp_LanguageAssertion_destroy_contents(&dest_arr->elements[i]);
1935             }
1936
1937 0             globus_free(dest_arr->elements);
1938 0             dest_arr->elements = NULL;
1939 0             dest_arr->length = 0;
1940 0             break;
1941         }
1942     }
1943
1944 0     GlobusSoapMessageDebugExit();
1945 0     return result;
1946 }
1947
1948 wsp_LanguageAssertion *
1949 wsp_LanguageAssertion_array_push(
1950     wsp_LanguageAssertion_array * array)
1951 0 {
1952 0     GlobusFuncName(wsp_LanguageAssertion_array_push);
1953 0     GlobusSoapMessageDebugEnter();
1954
1955 0     array->elements = realloc(array->elements,
1956                               sizeof(wsp_LanguageAssertion) *
1957                               (array->length + 1));
1958 0     memset(&array->elements[array->length], 0, sizeof(wsp_LanguageAssertion));
1959 0     array->length++;
1960
1961 0     GlobusSoapMessageDebugExit();
1962 0     return (&array->elements[array->length - 1]);
1963 }
1964
1965 void *
1966 wsp_LanguageAssertion_array_push_wrapper(
1967     void * array)
1968 0 {
1969 0     return (void *) wsp_LanguageAssertion_array_push((wsp_LanguageAssertion_array *) array);
1970 }
1971
1972 globus_result_t
1973 wsp_LanguageAssertion_array_serialize(
1974     xsd_QName *                         element_qname,
1975     wsp_LanguageAssertion_array * array,
1976     globus_soap_message_handle_t        message,
1977     globus_xsd_element_options_t        options)
1978 0 {
1979 0     globus_result_t                     result = GLOBUS_SUCCESS;
1980 0     int                                 i = 0;
1981 0     GlobusFuncName(wsp_LanguageAssertion_array_serialize);
1982 0     GlobusSoapMessageDebugEnter();
1983
1984 0     for(; i < array->length; ++i)
1985     {
1986 0         result = wsp_LanguageAssertion_serialize(
1987             element_qname,
1988             &array->elements[i],
1989             message,
1990             options);
1991 0         if(result != GLOBUS_SUCCESS)
1992         {
1993 0             goto exit;
1994         }
1995     }
1996
1997 exit:
1998
1999 0     GlobusSoapMessageDebugExit();
2000 0     return result;
2001 }
2002
2003 globus_result_t
2004 wsp_LanguageAssertion_array_deserialize(
2005     xsd_QName *                         element_qname,
2006     wsp_LanguageAssertion_array * array,
2007     globus_soap_message_handle_t        message,
2008     globus_xsd_element_options_t        options)
2009 0 {
2010 0     globus_result_t                     result = GLOBUS_SUCCESS;
2011 0     int                                 i = 0;
2012 0     int                                 pre_length;
2013 0     GlobusFuncName(wsp_LanguageAssertion_array_deserialize);
2014 0     GlobusSoapMessageDebugEnter();
2015
2016 0     pre_length = array->length;
2017
2018 0     for(i = 0; i < pre_length; ++i)
2019     {
2020 0         result = wsp_LanguageAssertion_deserialize(
2021             element_qname,
2022             &array->elements[i],
2023             message,
2024             options);
2025 0         if(result != GLOBUS_SUCCESS)
2026         {
2027 0             if(GlobusSoapMessageStatusFailedElementCheck(result) ||
2028                GlobusSoapMessageStatusElementNotFoundCheck(result) ||
2029                GlobusSoapMessageStatusFailedWithTextCheck(result))
2030             {
2031 0                 result = GLOBUS_SUCCESS;
2032 0                 break;
2033             }
2034
2035 0             result = GlobusSoapMessageErrorDeserializeFailed(
2036                 result, element_qname);
2037 0             goto exit;
2038         }
2039     }
2040
2041 0     while(result == GLOBUS_SUCCESS)
2042     {
2043 0         wsp_LanguageAssertion                  next;
2044 0         memset(&next, 0, sizeof(wsp_LanguageAssertion));
2045
2046 0         result = wsp_LanguageAssertion_deserialize(
2047             element_qname,
2048             &next,
2049             message,
2050             options);
2051 0         if(result != GLOBUS_SUCCESS)
2052         {
2053 0             if(GlobusSoapMessageStatusFailedElementCheck(result) ||
2054                GlobusSoapMessageStatusElementNotFoundCheck(result) ||
2055                GlobusSoapMessageStatusFailedWithTextCheck(result))
2056             {
2057 0                 result = GLOBUS_SUCCESS;
2058 0                 break;
2059             }
2060
2061 0             result = GlobusSoapMessageErrorDeserializeFailed(
2062                 result, element_qname);
2063 0             goto exit;
2064         }
2065
2066 0         array->elements = realloc(
2067             array->elements,
2068             (array->length + 1) * sizeof(wsp_LanguageAssertion));
2069 0         if(!array->elements)
2070         {
2071 0             result = GlobusSoapMessageErrorOutOfMemory;
2072 0             goto exit;
2073         }
2074 0         array->elements[array->length] = next;
2075 0         array->length++;
2076 0         ++i;
2077     }
2078
2079   exit:
2080
2081 0     if(result != GLOBUS_SUCCESS)
2082     {
2083 0         int                             di = 0;
2084 0         for(; di < i; ++di)
2085         {
2086 0             wsp_LanguageAssertion_destroy_contents(
2087                 &array->elements[di]);
2088 0             memset(&array->elements[di], 0, sizeof(wsp_LanguageAssertion));
2089         }
2090     }
2091
2092 0     GlobusSoapMessageDebugExit();
2093 0     return result;