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 "wst_EncryptionType.h"
26
27 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
28 xsd_QName wst_EncryptionType_qname =
29 {
30     WST_ENCRYPTIONTYPE_NS,
31     WST_ENCRYPTIONTYPE_LOCAL
32 };
33 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
34
35 globus_result_t
36 wst_EncryptionType_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 wst_EncryptionType_serialize(
43         element_qname,
44         (const wst_EncryptionType *) instance,
45         message_handle, options);
46 }
47
48 globus_result_t
49 wst_EncryptionType_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 wst_EncryptionType_deserialize_pointer(
56         element_qname,
57         (wst_EncryptionType **) ip,
58         message_handle, options);
59 }
60
61 globus_result_t
62 wst_EncryptionType_init_wrapper(void **object)
63 0 {
64 0     return wst_EncryptionType_init(
65         (wst_EncryptionType **) object);
66 }
67
68 void
69 wst_EncryptionType_destroy_wrapper(
70     void *                          object)
71 0 {
72 0     wst_EncryptionType_destroy(
73         (wst_EncryptionType *) object);
74 }
75
76 globus_result_t
77 wst_EncryptionType_copy_wrapper(
78     void **                         dest_obj,
79     const void *                    src_obj)
80 0 {
81 0     return wst_EncryptionType_copy(
82         (wst_EncryptionType **) dest_obj,
83         (wst_EncryptionType *) src_obj);
84 }
85
86 globus_result_t
87 wst_EncryptionType_init_contents_wrapper(void *object)
88 0 {
89 0     return wst_EncryptionType_init_contents(
90         (wst_EncryptionType *) object);
91 }
92
93 void
94 wst_EncryptionType_destroy_contents_wrapper(
95     void *                          object)
96 0 {
97 0     wst_EncryptionType_destroy_contents(
98         (wst_EncryptionType *) object);
99 }
100
101 globus_result_t
102 wst_EncryptionType_copy_contents_wrapper(
103     void *                          dest_obj,
104     const void *                    src_obj)
105 0 {
106 0     return wst_EncryptionType_copy_contents(
107         (wst_EncryptionType *) dest_obj,
108         (const wst_EncryptionType *) src_obj);
109 }
110
111 globus_result_t
112 wst_EncryptionType_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 wst_EncryptionType_serialize_contents(
119         element_qname,
120         (wst_EncryptionType *) instance,
121         message_handle, options);
122 }
123
124 globus_result_t
125 wst_EncryptionType_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(wst_EncryptionType_deserialize_contents_wrapper);
133 0     GlobusSoapMessageDebugEnter();
134
135 0     if(!*instance)
136     {
137 0         result = wst_EncryptionType_init(
138             (wst_EncryptionType **)instance);
139 0         if(result != GLOBUS_SUCCESS)
140         {
141 0             goto error;
142         }
143     }
144
145 0     result = wst_EncryptionType_deserialize_contents(
146         element_qname,
147         *(wst_EncryptionType **)instance,
148         message_handle, options);
149 error:
150 0     GlobusSoapMessageDebugExit();
151 0     return result;
152 }
153
154 globus_result_t
155 wst_EncryptionType_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 wst_EncryptionType_array_serialize(
162         element,
163         (wst_EncryptionType_array *) instance,
164         message, options);
165 }
166
167 globus_result_t
168 wst_EncryptionType_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 = wst_EncryptionType_array_init(
179             (wst_EncryptionType_array **)inst);
180 0         if(result != GLOBUS_SUCCESS)
181         {
182 0             return result;
183         }
184     }
185
186 0     return wst_EncryptionType_array_deserialize(
187         element_qname,
188         *(wst_EncryptionType_array **) inst,
189         message, options);
190 }
191
192 globus_result_t
193 wst_EncryptionType_array_init_wrapper(
194     void **                             arr)
195 0 {
196 0     return wst_EncryptionType_array_init(
197         (wst_EncryptionType_array **) arr);
198 }
199
200 void
201 wst_EncryptionType_array_destroy_wrapper(
202     void *                              arr)
203 0 {
204 0     wst_EncryptionType_array_destroy(
205         (wst_EncryptionType_array *) arr);
206 }
207
208 globus_result_t
209 wst_EncryptionType_array_copy_wrapper(
210     void **                             dest_arr,
211     const void *                        src_arr)
212 0 {
213 0     return wst_EncryptionType_array_copy(
214         (wst_EncryptionType_array **) dest_arr,
215         (const wst_EncryptionType_array *) src_arr);
216 }
217
218 globus_result_t
219 wst_EncryptionType_array_init_contents_wrapper(
220     void *                              arr)
221 0 {
222 0     return wst_EncryptionType_array_init_contents(
223         (wst_EncryptionType_array *) arr);
224 }
225
226 void
227 wst_EncryptionType_array_destroy_contents_wrapper(
228     void *                              arr)
229 0 {
230 0     wst_EncryptionType_array_destroy_contents(
231         (wst_EncryptionType_array *) arr);
232 }
233
234 globus_result_t
235 wst_EncryptionType_array_copy_contents_wrapper(
236     void *                              dest_arr,
237     const void *                        src_arr)
238 0 {
239 0     return wst_EncryptionType_array_copy_contents(
240         (wst_EncryptionType_array *) dest_arr,
241         (const wst_EncryptionType_array *) src_arr);
242 }
243
244 struct globus_xsd_type_info_s wst_EncryptionType_contents_info =
245 {
246     &wst_EncryptionType_qname,
247     wst_EncryptionType_serialize_contents_wrapper,
248     wst_EncryptionType_deserialize_contents_wrapper,
249     wst_EncryptionType_init_wrapper,
250     wst_EncryptionType_destroy_wrapper,
251     wst_EncryptionType_copy_wrapper,
252     wst_EncryptionType_init_contents_wrapper,
253     wst_EncryptionType_destroy_contents_wrapper,
254     wst_EncryptionType_copy_contents_wrapper,
255     sizeof(wst_EncryptionType),
256     NULL,
257     NULL,
258     NULL
259 };
260
261 struct globus_xsd_type_info_s wst_EncryptionType_array_info =
262 {
263     &wst_EncryptionType_qname,
264     wst_EncryptionType_array_serialize_wrapper,
265     wst_EncryptionType_array_deserialize_wrapper,
266     wst_EncryptionType_array_init_wrapper,
267     wst_EncryptionType_array_destroy_wrapper,
268     wst_EncryptionType_array_copy_wrapper,
269     wst_EncryptionType_array_init_contents_wrapper,
270     wst_EncryptionType_array_destroy_contents_wrapper,
271     wst_EncryptionType_array_copy_contents_wrapper,
272     sizeof(wst_EncryptionType),
273     wst_EncryptionType_array_push_wrapper,
274     NULL,
275     NULL
276 };
277
278 struct globus_xsd_type_info_s wst_EncryptionType_info =
279 {
280     &wst_EncryptionType_qname,
281     wst_EncryptionType_serialize_wrapper,
282     wst_EncryptionType_deserialize_pointer_wrapper,
283     wst_EncryptionType_init_wrapper,
284     wst_EncryptionType_destroy_wrapper,
285     wst_EncryptionType_copy_wrapper,
286     wst_EncryptionType_init_contents_wrapper,
287     wst_EncryptionType_destroy_contents_wrapper,
288     wst_EncryptionType_copy_contents_wrapper,
289     sizeof(wst_EncryptionType),
290     NULL,
291     &wst_EncryptionType_contents_info,
292     &wst_EncryptionType_array_info
293 };
294
295 globus_result_t
296 wst_EncryptionType_init_contents(
297     wst_EncryptionType * instance)
298 0 {
299 0     globus_result_t                     result = GLOBUS_SUCCESS;
300 0     GlobusFuncName(wst_EncryptionType_init_contents);
301 0     GlobusSoapMessageDebugEnter();
302
303 0     memset(instance, 0, sizeof(wst_EncryptionType));
304
305 0     GlobusSoapMessageDebugExit();
306 0     return result;
307 }
308
309 globus_result_t
310 wst_EncryptionType_init(
311     wst_EncryptionType ** object)
312 0 {
313 0     wst_EncryptionType * instance;
314 0     globus_result_t                     result = GLOBUS_SUCCESS;
315 0     GlobusFuncName(wst_EncryptionType_init);
316 0     GlobusSoapMessageDebugEnter();
317
318 0     instance = globus_malloc(sizeof(wst_EncryptionType));
319 0     if(!instance)
320     {
321 0         result = GlobusSoapMessageErrorOutOfMemory;
322 0         goto exit;
323     }
324
325 0     memset(instance, 0, sizeof(wst_EncryptionType));
326
327 0     *object = instance;
328
329  exit:
330 0     GlobusSoapMessageDebugExit();
331 0     return result;
332 }
333
334 void
335 wst_EncryptionType_destroy(
336     wst_EncryptionType * instance)
337 0 {
338 0     GlobusFuncName(wst_EncryptionType_destroy);
339 0     GlobusSoapMessageDebugEnter();
340
341 0     if(!instance)
342     {
343 0         goto exit;
344     }
345
346 0     wst_EncryptionType_destroy_contents(instance);
347 0     globus_free(instance);
348
349  exit:
350
351 0     GlobusSoapMessageDebugExit();
352 }
353
354
355 void
356 wst_EncryptionType_destroy_contents(
357     wst_EncryptionType * instance)
358 0 {
359 0     GlobusFuncName(wst_EncryptionType_destroy_contents);
360 0     GlobusSoapMessageDebugEnter();
361
362 0     if(instance)
363     {
364
365
366 0     xsd_any_destroy_contents(
367          &instance->any);
368
369     }
370
371 0     GlobusSoapMessageDebugExit();
372 }
373
374
375 globus_result_t
376 wst_EncryptionType_copy(
377     wst_EncryptionType ** dest_obj,
378     const wst_EncryptionType * src_obj)
379 0 {
380 0     globus_result_t                     result = GLOBUS_SUCCESS;
381 0     wst_EncryptionType * instance;
382 0     GlobusFuncName(wst_EncryptionType_copy);
383
384 0     GlobusSoapMessageDebugEnter();
385
386 0     instance = calloc(1, sizeof(wst_EncryptionType));
387 0     if (instance == NULL)
388     {
389 0         GlobusSoapMessageDebugExit();
390 0         return GlobusSoapMessageErrorOutOfMemory;
391     }
392
393 0     result = wst_EncryptionType_copy_contents(instance, src_obj);
394 0     if(result != GLOBUS_SUCCESS)
395     {
396 0         globus_free(instance);
397 0         GlobusSoapMessageDebugExit();
398 0         return GlobusSoapMessageErrorOutOfMemory;
399     }
400
401 0     *dest_obj = instance;
402 0     GlobusSoapMessageDebugExit();
403 0     return result;
404 }
405
406 globus_result_t
407 wst_EncryptionType_copy_contents(
408     wst_EncryptionType * instance,
409     const wst_EncryptionType * src_obj)
410 0 {
411 0     globus_result_t                     result = GLOBUS_SUCCESS;
412 0     GlobusFuncName(wst_EncryptionType_copy_contents);
413
414 0     GlobusSoapMessageDebugEnter();
415
416 0     result = xsd_any_copy_contents(
417         &instance->any,
418         &src_obj->any);
419 0     if(result != GLOBUS_SUCCESS)
420     {
421 0         result = GlobusSoapMessageErrorCopyFailed(
422                 result, NULL, &xsd_any_qname);
423         goto any_destroy;
424     }
425
426 0     goto exit;
427
428  fail_deserialize:
429 0         xsd_any_destroy_contents(
430              &instance->any);
431
432  any_destroy:
433
434
435  exit:
436
437 0     GlobusSoapMessageDebugExit();
438 0     return result;
439 }
440
441
442
443 globus_result_t
444 wst_EncryptionType_serialize_contents(
445     const xsd_QName *                   element_qname, /* ignored */
446     const wst_EncryptionType *              inst,
447     globus_soap_message_handle_t        message_handle,
448     globus_xsd_element_options_t        options)
449 0 {
450 0     globus_result_t                     result = GLOBUS_SUCCESS;
451 0     GlobusFuncName(wst_EncryptionType_serialize_contents);
452 0     GlobusSoapMessageDebugEnter();
453
454 0     result = wst_EncryptionType_serialize(
455         NULL,
456         inst,
457         message_handle,
458         options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
459 0     if(result != GLOBUS_SUCCESS)
460     {
461 0         result = GlobusSoapMessageErrorSerializeFailed(
462             result, NULL, element_qname);
463         goto exit;
464     }
465
466  exit:
467
468 0     GlobusSoapMessageDebugExit();
469 0     return result;
470 }
471
472
473
474 globus_result_t
475 wst_EncryptionType_serialize(
476     const xsd_QName *                   element_qname,
477     const wst_EncryptionType *              instance,
478     globus_soap_message_handle_t        message_handle,
479     globus_xsd_element_options_t        options)
480 0 {
481 0     globus_result_t                     result = GLOBUS_SUCCESS;
482 0     xsd_QName                           subelement;
483 0     globus_list_t *                     any_attr_keys = NULL;
484 0     globus_list_t *                     any_attr_keys_iterator = NULL;
485 0     xsd_QName *                         type_attr = NULL;
486
487 0     char *                              prefix = NULL;
488 0     int                                 prefix_created;
489 0     int                                 define_prefix = 0;
490 0     int                                 save_options = options;
491
492 0     GlobusFuncName(wst_EncryptionType_serialize);
493 0     GlobusSoapMessageDebugEnter();
494
495
496 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
497     {
498         /* serialize wst_EncryptionType element */
499 0 result = globus_soap_message_element_ns_set(
500             message_handle,
501             element_qname,
502             element_qname->Namespace,
503             &options);
504 0         if(result != GLOBUS_SUCCESS)
505         {
506 0             result = GlobusSoapMessageErrorSerializeFailed(
507                 result, NULL, element_qname);
508 0             goto exit;
509         }
510
511     {
512         /*
513         int nsi;
514         for (nsi = 0; nsi < instance->any.namespaces.length; nsi++)
515         {
516             if (instance->any.namespaces.elements[nsi] != NULL)
517             {
518                 char * prefix;
519                 char * ns;
520                 prefix = globus_libc_strdup(
521                         instance->any.namespaces.elements[nsi]);
522                 if (prefix == NULL)
523                 {
524                     result = GlobusSoapMessageErrorOutOfMemory;
525
526                     goto exit;
527                 }
528                 ns = strchr(prefix, '=');
529                 if (ns == NULL)
530                 {
531                     free(prefix);
532
533                     result = GlobusSoapMessageErrorSerializeNamespaceFailed(ns, prefix);
534                     goto exit;
535                 }
536                 *(ns) = '\0';
537                 ns++;
538                 result = globus_soap_message_serialize_ns_set_prefix(
539                     message_handle,
540                     element_qname,
541                     ns,
542                     prefix,
543                     &options);
544                 free(prefix);
545                 if(result != GLOBUS_SUCCESS)
546                 {
547                     goto exit;
548                 }
549             }
550         }
551         */
552     }
553
554 0         if(((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
555    !globus_soap_message_serialize_is_c14n_subset(message_handle)))
556         {
557 0             result = globus_soap_message_attribute_ns_set(
558                 message_handle,
559                 element_qname,
560                 "http://www.w3.org/2001/XMLSchema-instance",
561                 &options);
562 0             if(result != GLOBUS_SUCCESS)
563             {
564 0                 result = GlobusSoapMessageErrorSerializeFailed(
565                     result, NULL, element_qname);
566 0                 goto exit;
567             }
568         }
569
570 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
571    !globus_soap_message_serialize_is_c14n_subset(message_handle))
572         {
573
574 0             result = globus_soap_message_attribute_ns_set(
575                 message_handle,
576                 element_qname,
577                 wst_EncryptionType_qname.Namespace,
578                 &options);
579 0             if(result != GLOBUS_SUCCESS)
580             {
581 0                 result = GlobusSoapMessageErrorSerializeFailed(
582                     result, NULL, element_qname);
583 0                 goto exit;
584             }
585         }
586
587 0         result = globus_soap_message_serialize_element(
588             message_handle,
589             element_qname,
590             options,
591             &wst_EncryptionType_qname);
592 0         if(result != GLOBUS_SUCCESS)
593         {
594 0             result = GlobusSoapMessageErrorSerializeFailed(
595                 result, NULL, element_qname);
596 0             goto exit;
597         }
598
599 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
600    !globus_soap_message_serialize_is_c14n_subset(message_handle))
601         {
602 0            xsd_QName_init(&type_attr);
603        
604 0            type_attr->local = globus_libc_strdup("type");
605 0            type_attr->Namespace = globus_libc_strdup(XSI_NS);
606         }
607
608
609         /* serialize namespaces */
610 0 result = globus_soap_message_element_ns_add(
611             message_handle,
612             element_qname,
613             element_qname->Namespace,
614             &options);
615 0         if(result != GLOBUS_SUCCESS)
616         {
617 0             result = GlobusSoapMessageErrorSerializeFailed(
618                 result, NULL, element_qname);
619 0             goto exit;
620         }
621
622     {
623         /*
624         int nsi;
625         for (nsi = 0; nsi < instance->any.namespaces.length; nsi++)
626         {
627             if (instance->any.namespaces.elements[nsi] != NULL)
628             {
629                 char * prefix;
630                 char * ns;
631
632                 prefix = globus_libc_strdup(
633                         instance->any.namespaces.elements[nsi]);
634                 if (prefix == NULL)
635                 {
636                     result = GlobusSoapMessageErrorOutOfMemory;
637
638                     goto exit;
639                 }
640                 ns = strchr(prefix, '=');
641                 if (ns == NULL)
642                 {
643                     free(prefix);
644
645                     result = GlobusSoapMessageErrorSerializeNamespaceFailed(ns, prefix);
646                     goto exit;
647                 }
648                 *(ns) = '\0';
649                 ns++;
650                 result = globus_soap_message_serialize_ns_add_prefix(
651                     message_handle,
652                     element_qname,
653                     ns,
654                     prefix,
655                     &options);
656                 free(prefix);
657                 if(result != GLOBUS_SUCCESS)
658                 {
659                     goto exit;
660                 }
661             }
662         }
663         */
664     }
665
666 0         if(((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
667    !globus_soap_message_serialize_is_c14n_subset(message_handle)))
668         {
669 0             result = globus_soap_message_attribute_ns_add(
670                 message_handle,
671                 element_qname,
672                 "http://www.w3.org/2001/XMLSchema-instance",
673                 &options);
674 0             if(result != GLOBUS_SUCCESS)
675             {
676 0                 result = GlobusSoapMessageErrorSerializeFailed(
677                     result, NULL, element_qname);
678 0                 goto exit;
679             }
680         }
681 0         if ((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
682    !globus_soap_message_serialize_is_c14n_subset(message_handle))
683         {
684
685 0             result = globus_soap_message_attribute_ns_add(
686                 message_handle,
687                 element_qname,
688                 wst_EncryptionType_qname.Namespace,
689                 &options);
690 0             if(result != GLOBUS_SUCCESS)
691             {
692 0                 result = GlobusSoapMessageErrorSerializeFailed(
693                     result, NULL, element_qname);
694 0                 goto exit;
695             }
696         }
697
698         /* serialize attributes */
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_serialize_QName_attribute(
704                 message_handle,
705                 type_attr,
706                 &wst_EncryptionType_qname);
707 0             if(result != GLOBUS_SUCCESS)
708             {
709 0                 result = GlobusSoapMessageErrorSerializeFailed(
710                     result, NULL, element_qname);
711 0                 goto exit;
712             }
713         }
714
715
716     }
717
718 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
719     {
720 0         result = globus_soap_message_serialize_element_begin_close(
721             message_handle, element_qname);
722 0         if(result != GLOBUS_SUCCESS)
723         {
724 0             result = GlobusSoapMessageErrorSerializeFailed(
725                 result, NULL, element_qname);
726 0             goto exit;
727         }
728     }
729 0     options &= ~GLOBUS_XSD_ELEMENT_CONTENTS_ONLY;
730
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_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             &wst_EncryptionType_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     {
774         /*
775         int nsi;
776         for (nsi = 0; nsi < instance->any.namespaces.length; nsi++)
777         {
778             if (instance->any.namespaces.elements[nsi] != NULL)
779             {
780                 char * prefix;
781                 char * ns;
782
783                 prefix = globus_libc_strdup(
784                         instance->any.namespaces.elements[nsi]);
785                 if (prefix == NULL)
786                 {
787                     result = GlobusSoapMessageErrorOutOfMemory;
788
789                     goto exit;
790                 }
791                 ns = strchr(prefix, '=');
792                 if (ns == NULL)
793                 {
794                     free(prefix);
795
796                     result = GlobusSoapMessageErrorSerializeNamespaceFailed(ns, prefix);
797                     goto exit;
798                 }
799                 *(ns) = '\0';
800                 ns++;
801
802                 globus_soap_message_serialize_ns_remove_prefix(
803                         message_handle,
804                         ns,
805                         prefix,
806                         &options);
807                 free(prefix);
808             }
809         }
810         */
811     }
812
813 0         if(((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
814    !globus_soap_message_serialize_is_c14n_subset(message_handle)))
815         {
816 0             globus_soap_message_attribute_ns_remove(
817                 message_handle,
818                 "http://www.w3.org/2001/XMLSchema-instance",
819                 &options);
820         }           
821 0         if((options & GLOBUS_XSD_ELEMENT_TYPE_ATTR) &&
822    !globus_soap_message_serialize_is_c14n_subset(message_handle))
823         {
824 0             globus_soap_message_attribute_ns_remove(
825                 message_handle,
826                 wst_EncryptionType_qname.Namespace,
827                 &options);
828         }           
829
830     }
831
832  exit:
833 0     if (type_attr)
834     {
835 0         xsd_QName_destroy(type_attr);
836     }
837
838
839 0     if(any_attr_keys)
840     {
841 0         globus_list_free(any_attr_keys);
842     }
843
844 0     GlobusSoapMessageDebugExit();
845 0     return result;
846 }
847
848
849
850 globus_result_t
851 wst_EncryptionType_deserialize_contents(
852     const xsd_QName *                   element_qname, /* ignored */
853     wst_EncryptionType *                    inst,
854     globus_soap_message_handle_t        message_handle,
855     globus_xsd_element_options_t        options)
856 0 {
857 0     globus_result_t                     result = GLOBUS_SUCCESS;
858 0     GlobusFuncName(wst_EncryptionType_deserialize_contents);
859 0     GlobusSoapMessageDebugEnter();
860
861 0     result = wst_EncryptionType_deserialize(
862         NULL,
863         inst,
864         message_handle,
865         options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
866 0     if(result != GLOBUS_SUCCESS)
867     {
868 0         result = GlobusSoapMessageErrorDeserializeFailed(
869             result, element_qname);
870         goto exit;
871     }
872
873  exit:
874
875 0     GlobusSoapMessageDebugExit();
876 0     return result;
877 }
878
879
880
881 globus_result_t
882 wst_EncryptionType_deserialize(
883     const xsd_QName *                   element_qname,
884     wst_EncryptionType *                    instance,
885     globus_soap_message_handle_t        message_handle,
886     globus_xsd_element_options_t        options)
887 0 {
888 0     globus_result_t                     result = GLOBUS_SUCCESS;
889 0     xsd_QName                           subelement;
890 0     GlobusFuncName(wst_EncryptionType_deserialize);
891 0     GlobusSoapMessageDebugEnter();
892
893
894 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
895     {
896 0         result = globus_soap_message_deserialize_element(
897             message_handle, element_qname);
898 0         if(result != GLOBUS_SUCCESS)
899         {
900 0             result = GlobusSoapMessageErrorDeserializeFailed(
901                 result, element_qname);
902 0             goto exit;
903         }
904
905
906 0         result = globus_soap_message_deserialize_element_begin_close(
907             message_handle);
908 0         if(result != GLOBUS_SUCCESS)
909         {
910 0             result = GlobusSoapMessageErrorDeserializeFailed(
911                 result, element_qname);
912 0             goto fail_deserialize;
913         }
914     }
915
916 0     subelement.local = "any";
917 0     subelement.Namespace = "http://www.w3.org/2001/XMLSchema";
918
919 0     result = xsd_any_deserialize(
920          &subelement,
921          &instance->any,
922          message_handle,
923          0);
924 0     if(result != GLOBUS_SUCCESS)
925     {
926 0         result = GlobusSoapMessageErrorDeserializeFailed(
927             result, 
928             &xsd_any_qname);
929 0         goto any_destroy;
930     }
931
932 0     if(!(options & GLOBUS_XSD_ELEMENT_CONTENTS_ONLY))
933     {
934 0         result = globus_soap_message_deserialize_element_end(
935             message_handle,
936             element_qname);
937 0         if(result != GLOBUS_SUCCESS)
938         {
939 0             result = GlobusSoapMessageErrorDeserializeFailed(
940                 result, element_qname);
941             goto fail_deserialize;
942         }
943     }
944
945 0     goto exit;
946
947  fail_deserialize:
948 0         xsd_any_destroy_contents(
949              &instance->any);
950
951  any_destroy:
952
953
954  exit:
955
956 0     GlobusSoapMessageDebugExit();
957 0     return result;
958 }
959
960
961
962 globus_result_t
963 wst_EncryptionType_deserialize_pointer(
964     const xsd_QName *                   element_qname,
965     wst_EncryptionType **                   ip,
966     globus_soap_message_handle_t        message_handle,
967     globus_xsd_element_options_t        options)
968 0 {
969 0     wst_EncryptionType * instance = NULL;
970 0     globus_result_t                     result = GLOBUS_SUCCESS;
971 0     xsd_QName                           subelement;
972 0     int                                 found_attrs = 0;
973 0     int                                 empty_element = 0;
974 0     GlobusFuncName(wst_EncryptionType_deserialize_pointer);
975 0     GlobusSoapMessageDebugEnter();
976
977 0     *ip = NULL;
978
979 0     result = globus_soap_message_deserialize_element(
980         message_handle, element_qname);
981 0     if(result != GLOBUS_SUCCESS &&
982        (GlobusSoapMessageStatusElementNotFoundCheck(result) ||
983         GlobusSoapMessageStatusFailedElementCheck(result) ||
984         GlobusSoapMessageStatusFailedWithTextCheck(result)))
985     {
986 0         result = GLOBUS_SUCCESS;
987 0         goto exit;
988     }
989
990 0     if(result != GLOBUS_SUCCESS)
991     {
992 0         result = GlobusSoapMessageErrorDeserializeFailed(
993             result, element_qname);
994 0         goto exit;
995     }
996
997 0     if(globus_soap_message_deserialize_element_is_empty(
998            message_handle))
999     {
1000 0         empty_element = 1;
1001     }
1002
1003 0     result = wst_EncryptionType_init(&instance);
1004 0     if(result != GLOBUS_SUCCESS)
1005     {
1006 0         result = GlobusSoapMessageErrorDeserializeFailed(
1007             result, element_qname);
1008 0         goto exit;
1009     }
1010
1011
1012 0     if(found_attrs == 0 && 
1013        globus_soap_message_deserialize_element_is_nil(message_handle))
1014     {
1015 0         wst_EncryptionType_destroy(instance);
1016         
1017 0         result = globus_soap_message_deserialize_element_end(
1018                 message_handle,
1019                 element_qname);
1020 0         if(result != GLOBUS_SUCCESS)
1021         {
1022 0             result = GlobusSoapMessageErrorDeserializeFailed(
1023                 result, element_qname);
1024 0             goto exit;
1025         }
1026
1027 0         *ip = NULL;
1028 0         globus_object_free(globus_error_get(result));
1029 0         result = GLOBUS_SUCCESS;
1030 0         goto exit;
1031     }
1032
1033
1034 0     if(empty_element)
1035     {
1036 0         result = globus_soap_message_deserialize_element_end(
1037             message_handle,
1038             element_qname);
1039 0         if(result != GLOBUS_SUCCESS)
1040         {
1041 0             result = GlobusSoapMessageErrorDeserializeFailed(
1042                 result, element_qname);
1043 0             goto fail_deserialize;
1044         }
1045
1046 0         *ip = instance;
1047 0         goto exit;
1048     }
1049
1050 0     result = globus_soap_message_deserialize_element_begin_close(
1051         message_handle);
1052 0     if(result != GLOBUS_SUCCESS)
1053     {
1054 0         result = GlobusSoapMessageErrorDeserializeFailed(
1055             result, element_qname);
1056 0         goto exit;
1057     }
1058
1059 0     result = wst_EncryptionType_deserialize(
1060             element_qname,
1061             instance,
1062             message_handle,
1063             options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
1064
1065 0     result = globus_soap_message_deserialize_element_end(
1066         message_handle,
1067         element_qname);
1068 0     if(result != GLOBUS_SUCCESS)
1069     {
1070 0         result = GlobusSoapMessageErrorDeserializeFailed(
1071             result, element_qname);
1072 0         goto fail_deserialize;
1073     }
1074
1075 0     *ip = instance;
1076
1077 0     goto exit;
1078
1079  fail_deserialize:
1080 0         xsd_any_destroy_contents(
1081              &instance->any);
1082
1083  any_destroy:
1084
1085  exit:
1086
1087 0     GlobusSoapMessageDebugExit();
1088 0     return result;
1089 }
1090
1091
1092 globus_result_t
1093 wst_EncryptionType_array_init_contents(
1094     wst_EncryptionType_array * array)
1095 0 {
1096 0     return globus_xsd_generic_array_init_contents(
1097         (globus_xsd_generic_array_t *) array,
1098         &wst_EncryptionType_info);
1099 }
1100 /* wst_EncryptionType_array_init_contents() */
1101
1102 globus_result_t
1103 wst_EncryptionType_array_init(
1104     wst_EncryptionType_array ** arr)
1105 0 {
1106 0     return globus_xsd_generic_array_init(
1107         (globus_xsd_generic_array_t **) arr,
1108         &wst_EncryptionType_info);
1109 }
1110 /* wst_EncryptionType_array_init() */
1111
1112 void
1113 wst_EncryptionType_array_destroy_contents(
1114     wst_EncryptionType_array * array)
1115 0 {
1116 0     globus_xsd_generic_array_destroy_contents(
1117         (globus_xsd_generic_array_t *) array);
1118 }
1119 /* wst_EncryptionType_array_destroy_contents() */
1120
1121 void
1122 wst_EncryptionType_array_destroy(
1123     wst_EncryptionType_array * array)
1124 0 {
1125 0     globus_xsd_generic_array_destroy(
1126         (globus_xsd_generic_array_t *) array);
1127 }
1128 /* wst_EncryptionType_array_destroy() */
1129
1130 globus_result_t
1131 wst_EncryptionType_array_copy(
1132     wst_EncryptionType_array ** dest_arr,
1133     const wst_EncryptionType_array * src_arr)
1134 0 {
1135 0     return globus_xsd_generic_array_copy(
1136         (globus_xsd_generic_array_t **) dest_arr,
1137         (globus_xsd_generic_array_t *) src_arr);
1138 }
1139 /* wst_EncryptionType_array_copy() */
1140
1141 globus_result_t
1142 wst_EncryptionType_array_copy_contents(
1143     wst_EncryptionType_array * dest_arr,
1144     const wst_EncryptionType_array * src_arr)
1145 0 {
1146 0     return globus_xsd_generic_array_copy_contents(
1147         (globus_xsd_generic_array_t *) dest_arr,
1148         (globus_xsd_generic_array_t *) src_arr);
1149 }
1150 /* wst_EncryptionType_array_copy_contents() */
1151
1152 wst_EncryptionType *
1153 wst_EncryptionType_array_push(
1154     wst_EncryptionType_array * array)
1155 0 {
1156     /* Some contents initializers don't initialize subelments but to set their
1157      * values to be NULL
1158      */
1159 0     if (array->type_info == NULL)
1160     {
1161 0         array->type_info = &wst_EncryptionType_info;
1162     }
1163
1164 0     return globus_xsd_generic_array_push(
1165         (globus_xsd_generic_array_t *) array);
1166 }
1167 /* wst_EncryptionType_array_push() */
1168
1169 void *
1170 wst_EncryptionType_array_push_wrapper(
1171     void * array)
1172 0 {
1173 0     return (void *) wst_EncryptionType_array_push((wst_EncryptionType_array *) array);
1174 }
1175
1176 globus_result_t
1177 wst_EncryptionType_array_serialize(
1178     const xsd_QName *                   element_qname,
1179     const wst_EncryptionType_array *        array,
1180     globus_soap_message_handle_t        message,
1181     globus_xsd_element_options_t        options)
1182 0 {
1183 0     return globus_xsd_generic_array_serialize(
1184         element_qname,
1185         (const globus_xsd_generic_array_t *) array,
1186         message,
1187         options);
1188 }
1189 /* wst_EncryptionType_array_serialize() */
1190
1191 globus_result_t
1192 wst_EncryptionType_array_deserialize(
1193     const xsd_QName *                   element_qname,
1194     wst_EncryptionType_array * array,
1195     globus_soap_message_handle_t        message,
1196     globus_xsd_element_options_t        options)
1197 0 {
1198     /* Some initializers set the array's contents to NULL */
1199 0     if (array->type_info == NULL)
1200     {
1201 0         array->type_info = &wst_EncryptionType_info;
1202     }
1203 0     return globus_xsd_generic_array_deserialize(
1204         element_qname,
1205         (globus_xsd_generic_array_t *) array,
1206         message,
1207         options);