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