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