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