1 /*
2  * Portions of this file Copyright 1999-2005 University of Chicago
3  * Portions of this file Copyright 1999-2005 The University of Southern California.
4  *
5  * This file or a portion of this file is licensed under the
6  * terms of the Globus Toolkit Public License, found at
7  * http://www.globus.org/toolkit/download/license.html.
8  * If you redistribute this file, with or without
9  * modifications, you must include this notice in the file.
10  */
11
12
13 /*
14  * This file is automatically generated by the Globus WSDLtoC converter
15  */
16
17 #include "xsd_QName.h"
18 #include "globus_soap_message.h"
19 #include "globus_xsd_type_info.h"
20 #include "wsp_PolicyAttachmentType.h"
21
22 xsd_QName wsp_PolicyAttachmentType_choice_qname =
23 {
24     "http://schemas.xmlsoap.org/ws/2002/12/policy",
25     "PolicyAttachmentType_choice"
26 };
27
28 globus_result_t
29 wsp_PolicyAttachmentType_choice_serialize_wrapper(
30     xsd_QName *                         element_qname,
31     void *                              instance,
32     globus_soap_message_handle_t        message_handle,
33     globus_xsd_element_options_t        options)
34 0 {
35 0     return wsp_PolicyAttachmentType_choice_serialize(
36         element_qname,
37         (wsp_PolicyAttachmentType_choice *) instance,
38         message_handle, options);
39 }
40
41 globus_result_t
42 wsp_PolicyAttachmentType_choice_deserialize_pointer_wrapper(
43     xsd_QName *                         element_qname,
44     void **                             ip,
45     globus_soap_message_handle_t        message_handle,
46     globus_xsd_element_options_t        options)
47 0 {
48 0     return wsp_PolicyAttachmentType_choice_deserialize_pointer(
49         element_qname,
50         (wsp_PolicyAttachmentType_choice **) ip,
51         message_handle, options);
52 }
53
54 globus_result_t
55 wsp_PolicyAttachmentType_choice_init_wrapper(void **object)
56 0 {
57 0     return wsp_PolicyAttachmentType_choice_init(
58         (wsp_PolicyAttachmentType_choice **) object);
59 }
60
61 void
62 wsp_PolicyAttachmentType_choice_destroy_wrapper(
63     void *                          object)
64 0 {
65 0     wsp_PolicyAttachmentType_choice_destroy(
66         (wsp_PolicyAttachmentType_choice *) object);
67 }
68
69 globus_result_t
70 wsp_PolicyAttachmentType_choice_copy_wrapper(
71     void **                         dest_obj,
72     void *                          src_obj)
73 0 {
74 0     return wsp_PolicyAttachmentType_choice_copy(
75         (wsp_PolicyAttachmentType_choice **) dest_obj,
76         (wsp_PolicyAttachmentType_choice *) src_obj);
77 }
78
79 globus_result_t
80 wsp_PolicyAttachmentType_choice_init_contents_wrapper(void *object)
81 0 {
82 0     return wsp_PolicyAttachmentType_choice_init_contents(
83         (wsp_PolicyAttachmentType_choice *) object);
84 }
85
86 void
87 wsp_PolicyAttachmentType_choice_destroy_contents_wrapper(
88     void *                          object)
89 0 {
90 0     wsp_PolicyAttachmentType_choice_destroy_contents(
91         (wsp_PolicyAttachmentType_choice *) object);
92 }
93
94 globus_result_t
95 wsp_PolicyAttachmentType_choice_copy_contents_wrapper(
96     void *                          dest_obj,
97     void *                          src_obj)
98 0 {
99 0     return wsp_PolicyAttachmentType_choice_copy_contents(
100         (wsp_PolicyAttachmentType_choice *) dest_obj,
101         (wsp_PolicyAttachmentType_choice *) src_obj);
102 }
103
104 globus_result_t
105 wsp_PolicyAttachmentType_choice_serialize_contents_wrapper(
106     xsd_QName *                         element_qname,
107     void *                              instance,
108     globus_soap_message_handle_t        message_handle,
109     globus_xsd_element_options_t        options)
110 0 {
111 0     return wsp_PolicyAttachmentType_choice_serialize_contents(
112         element_qname,
113         (wsp_PolicyAttachmentType_choice *) instance,
114         message_handle, options);
115 }
116
117 globus_result_t
118 wsp_PolicyAttachmentType_choice_deserialize_contents_wrapper(
119     xsd_QName *                         element_qname,
120     void **                             instance,
121     globus_soap_message_handle_t        message_handle,
122     globus_xsd_element_options_t        options)
123 0 {
124 0     globus_result_t                     result;
125 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_deserialize_contents_wrapper);
126 0     GlobusSoapMessageDebugEnter();
127
128 0     if(!*instance)
129     {
130 0         result = wsp_PolicyAttachmentType_choice_init(
131             (wsp_PolicyAttachmentType_choice **)instance);
132 0         if(result != GLOBUS_SUCCESS)
133         {
134 0             goto error;
135         }
136     }
137
138 0     result = wsp_PolicyAttachmentType_choice_deserialize_contents(
139         element_qname,
140         *(wsp_PolicyAttachmentType_choice **)instance,
141         message_handle, options);
142 error:
143 0     GlobusSoapMessageDebugExit();
144 0     return result;
145 }
146
147 globus_result_t
148 wsp_PolicyAttachmentType_choice_array_serialize_wrapper(
149     xsd_QName *                     element,
150     void *                          instance,
151     globus_soap_message_handle_t    message,
152     globus_xsd_element_options_t    options)
153 0 {
154 0     return wsp_PolicyAttachmentType_choice_array_serialize(
155         element,
156         (wsp_PolicyAttachmentType_choice_array *) instance,
157         message, options);
158 }
159
160 globus_result_t
161 wsp_PolicyAttachmentType_choice_array_deserialize_wrapper(
162     xsd_QName *                         element_qname,
163     void **                             inst,
164     globus_soap_message_handle_t        message,
165     globus_xsd_element_options_t        options)
166 0 {
167 0     if(!*inst)
168     {
169 0         globus_result_t                 result;
170
171 0         result = wsp_PolicyAttachmentType_choice_array_init(
172             (wsp_PolicyAttachmentType_choice_array **)inst);
173 0         if(result != GLOBUS_SUCCESS)
174         {
175 0             return result;
176         }
177     }
178
179 0     return wsp_PolicyAttachmentType_choice_array_deserialize(
180         element_qname,
181         *(wsp_PolicyAttachmentType_choice_array **) inst,
182         message, options);
183 }
184
185 globus_result_t
186 wsp_PolicyAttachmentType_choice_array_init_wrapper(
187     void **                             arr)
188 0 {
189 0     return wsp_PolicyAttachmentType_choice_array_init(
190         (wsp_PolicyAttachmentType_choice_array **) arr);
191 }
192
193 void
194 wsp_PolicyAttachmentType_choice_array_destroy_wrapper(
195     void *                              arr)
196 0 {
197 0     wsp_PolicyAttachmentType_choice_array_destroy(
198         (wsp_PolicyAttachmentType_choice_array *) arr);
199 }
200
201 globus_result_t
202 wsp_PolicyAttachmentType_choice_array_copy_wrapper(
203     void **                             dest_arr,
204     void *                              src_arr)
205 0 {
206 0     return wsp_PolicyAttachmentType_choice_array_copy(
207         (wsp_PolicyAttachmentType_choice_array **) dest_arr,
208         (wsp_PolicyAttachmentType_choice_array *) src_arr);
209 }
210
211 globus_result_t
212 wsp_PolicyAttachmentType_choice_array_init_contents_wrapper(
213     void *                              arr)
214 0 {
215 0     return wsp_PolicyAttachmentType_choice_array_init_contents(
216         (wsp_PolicyAttachmentType_choice_array *) arr);
217 }
218
219 void
220 wsp_PolicyAttachmentType_choice_array_destroy_contents_wrapper(
221     void *                              arr)
222 0 {
223 0     wsp_PolicyAttachmentType_choice_array_destroy_contents(
224         (wsp_PolicyAttachmentType_choice_array *) arr);
225 }
226
227 globus_result_t
228 wsp_PolicyAttachmentType_choice_array_copy_contents_wrapper(
229     void *                              dest_arr,
230     void *                              src_arr)
231 0 {
232 0     return wsp_PolicyAttachmentType_choice_array_copy_contents(
233         (wsp_PolicyAttachmentType_choice_array *) dest_arr,
234         (wsp_PolicyAttachmentType_choice_array *) src_arr);
235 }
236
237 struct globus_xsd_type_info_s wsp_PolicyAttachmentType_choice_array_info =
238 {
239     &wsp_PolicyAttachmentType_choice_qname,
240     wsp_PolicyAttachmentType_choice_array_serialize_wrapper,
241     wsp_PolicyAttachmentType_choice_array_deserialize_wrapper,
242     wsp_PolicyAttachmentType_choice_array_init_wrapper,
243     wsp_PolicyAttachmentType_choice_array_destroy_wrapper,
244     wsp_PolicyAttachmentType_choice_array_copy_wrapper,
245     wsp_PolicyAttachmentType_choice_array_init_contents_wrapper,
246     wsp_PolicyAttachmentType_choice_array_destroy_contents_wrapper,
247     wsp_PolicyAttachmentType_choice_array_copy_contents_wrapper,
248     sizeof(wsp_PolicyAttachmentType_choice),
249     wsp_PolicyAttachmentType_choice_array_push_wrapper,
250     NULL,
251     NULL
252 };
253
254 struct globus_xsd_type_info_s wsp_PolicyAttachmentType_choice_contents_info =
255 {
256     &wsp_PolicyAttachmentType_choice_qname,
257     wsp_PolicyAttachmentType_choice_serialize_contents_wrapper,
258     wsp_PolicyAttachmentType_choice_deserialize_contents_wrapper,
259     wsp_PolicyAttachmentType_choice_init_wrapper,
260     wsp_PolicyAttachmentType_choice_destroy_wrapper,
261     wsp_PolicyAttachmentType_choice_copy_wrapper,
262     wsp_PolicyAttachmentType_choice_init_contents_wrapper,
263     wsp_PolicyAttachmentType_choice_destroy_contents_wrapper,
264     wsp_PolicyAttachmentType_choice_copy_contents_wrapper,
265     sizeof(wsp_PolicyAttachmentType_choice),
266     NULL,
267     NULL,
268     NULL
269 };
270
271 struct globus_xsd_type_info_s wsp_PolicyAttachmentType_choice_info =
272 {
273     &wsp_PolicyAttachmentType_choice_qname,
274     wsp_PolicyAttachmentType_choice_serialize_wrapper,
275     wsp_PolicyAttachmentType_choice_deserialize_pointer_wrapper,
276     wsp_PolicyAttachmentType_choice_init_wrapper,
277     wsp_PolicyAttachmentType_choice_destroy_wrapper,
278     wsp_PolicyAttachmentType_choice_copy_wrapper,
279     wsp_PolicyAttachmentType_choice_init_contents_wrapper,
280     wsp_PolicyAttachmentType_choice_destroy_contents_wrapper,
281     wsp_PolicyAttachmentType_choice_copy_contents_wrapper,
282     sizeof(wsp_PolicyAttachmentType),
283     NULL,
284     &wsp_PolicyAttachmentType_choice_contents_info,
285     &wsp_PolicyAttachmentType_choice_array_info
286 };
287
288 globus_result_t
289 wsp_PolicyAttachmentType_choice_init_contents(
290     wsp_PolicyAttachmentType_choice *                    instance)
291 0 {
292 0     globus_result_t                     result = GLOBUS_SUCCESS;
293 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_init_contents);
294 0     GlobusSoapMessageDebugEnter();
295
296 0     memset(instance, 0, sizeof(wsp_PolicyAttachmentType));
297
298 0     GlobusSoapMessageDebugExit();
299 0     return result;
300 }
301
302 globus_result_t
303 wsp_PolicyAttachmentType_choice_init(
304     wsp_PolicyAttachmentType_choice ** object)
305 0 {
306 0     wsp_PolicyAttachmentType_choice * instance;
307 0     globus_result_t                     result = GLOBUS_SUCCESS;
308 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_init);
309 0     GlobusSoapMessageDebugEnter();
310
311 0     instance = globus_malloc(sizeof(wsp_PolicyAttachmentType_choice));
312 0     if(!instance)
313     {
314 0         result = GlobusSoapMessageErrorOutOfMemory;
315 0         goto exit;
316     }
317
318 0     memset(instance, 0, sizeof(wsp_PolicyAttachmentType_choice));
319
320 0     *object = instance;
321
322  exit:
323 0     GlobusSoapMessageDebugExit();
324 0     return result;
325 }
326
327 void
328 wsp_PolicyAttachmentType_choice_destroy(
329     wsp_PolicyAttachmentType_choice * instance)
330 0 {
331 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_destroy);
332 0     GlobusSoapMessageDebugEnter();
333
334 0     if(!instance)
335     {
336 0         goto exit;
337     }
338
339 0     wsp_PolicyAttachmentType_choice_destroy_contents(instance);
340 0     free(instance);
341
342  exit:
343
344 0     GlobusSoapMessageDebugExit();
345 }
346
347
348
349 void
350 wsp_PolicyAttachmentType_choice_destroy_contents(
351     wsp_PolicyAttachmentType_choice * instance)
352 0 {
353 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_destroy_contents);
354 0     GlobusSoapMessageDebugEnter();
355
356 0     switch(instance->type)
357     {
358
359     case wsp_PolicyAttachmentType_Policy:
360
361 0         wsp_PolicyExpression_destroy_contents(
362              &instance->value.Policy);
363 0         break;
364
365     case wsp_PolicyAttachmentType_PolicyReference:
366
367 0         wsp_PolicyReferenceType_destroy_contents(
368              &instance->value.PolicyReference);
369         break;
370
371         default:
372 0             break;
373     }
374
375 0     instance->type = wsp_PolicyAttachmentType_undefined;
376
377 0     GlobusSoapMessageDebugExit();
378 }
379
380 globus_result_t
381 wsp_PolicyAttachmentType_choice_copy(
382     wsp_PolicyAttachmentType_choice ** dest_obj,
383     const wsp_PolicyAttachmentType_choice * src_obj)
384 0 {
385 0     globus_result_t                     result = GLOBUS_SUCCESS;
386 0     wsp_PolicyAttachmentType_choice * instance;
387 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_copy);
388
389 0     GlobusSoapMessageDebugEnter();
390
391 0     instance = malloc(sizeof(wsp_PolicyAttachmentType_choice));
392 0     if (instance == NULL)
393     {
394 0         GlobusSoapMessageDebugExit();
395 0         return GlobusSoapMessageErrorOutOfMemory;
396     }
397
398 0     result = wsp_PolicyAttachmentType_choice_copy_contents(instance, src_obj);
399 0     if(result != GLOBUS_SUCCESS)
400     {
401 0         globus_free(instance);
402 0         GlobusSoapMessageDebugExit();
403 0         return GlobusSoapMessageErrorOutOfMemory;
404     }
405
406 0     *dest_obj = instance;
407 0     GlobusSoapMessageDebugExit();
408 0     return result;
409 }
410
411
412
413 globus_result_t
414 wsp_PolicyAttachmentType_choice_copy_contents(
415     wsp_PolicyAttachmentType_choice * instance,
416     const wsp_PolicyAttachmentType_choice * src_obj)
417 0 {
418 0     xsd_QName                           subelement;
419 0     globus_result_t                     result = GLOBUS_SUCCESS;
420 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_copy_contents);
421
422 0     GlobusSoapMessageDebugEnter();
423
424 0     switch(src_obj->type)
425     {
426
427     case wsp_PolicyAttachmentType_Policy:
428 0         instance->type = wsp_PolicyAttachmentType_Policy;
429 0         result = wsp_PolicyExpression_copy_contents(
430             &instance->value.Policy,
431             &src_obj->value.Policy);
432 0         if(result != GLOBUS_SUCCESS)
433         {
434 0             result = GlobusSoapMessageErrorSerializeFailed(
435                 result, NULL, &wsp_PolicyAttachmentType_choice_qname);
436 0             goto exit;
437         }
438
439 0         break;
440
441     case wsp_PolicyAttachmentType_PolicyReference:
442 0         instance->type = wsp_PolicyAttachmentType_PolicyReference;
443 0         result = wsp_PolicyReferenceType_copy_contents(
444             &instance->value.PolicyReference,
445             &src_obj->value.PolicyReference);
446 0         if(result != GLOBUS_SUCCESS)
447         {
448 0             result = GlobusSoapMessageErrorSerializeFailed(
449                 result, NULL, &wsp_PolicyAttachmentType_choice_qname);
450             goto exit;
451         }
452
453 0         break;
454
455     default:
456 0         break;
457     }
458
459  exit:
460
461 0     GlobusSoapMessageDebugExit();
462 0     return result;
463 }
464
465
466
467
468
469 globus_result_t
470 wsp_PolicyAttachmentType_choice_serialize_contents(
471     xsd_QName *                         element_qname, /* ignored */
472     wsp_PolicyAttachmentType_choice * instance,
473     globus_soap_message_handle_t        message_handle,
474     globus_xsd_element_options_t        options)
475 0 {
476 0     xsd_QName                           subelement;
477 0     globus_result_t                     result = GLOBUS_SUCCESS;
478 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_serialize_contents);
479 0     GlobusSoapMessageDebugEnter();
480
481 0     switch(instance->type)
482     {
483
484     case wsp_PolicyAttachmentType_Policy:
485
486 0         subelement.local = "Policy";
487 0         subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/12/policy";
488 0         result = wsp_PolicyExpression_serialize(
489             &subelement,
490             &instance->value.Policy,
491             message_handle,
492             options);
493 0         if(result != GLOBUS_SUCCESS)
494         {
495 0             result = GlobusSoapMessageErrorSerializeFailed(
496                 result, NULL, &wsp_PolicyAttachmentType_choice_qname);
497 0             goto exit;
498         }
499
500 0         break;
501
502     case wsp_PolicyAttachmentType_PolicyReference:
503
504 0         subelement.local = "PolicyReference";
505 0         subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/12/policy";
506 0         result = wsp_PolicyReferenceType_serialize(
507             &subelement,
508             &instance->value.PolicyReference,
509             message_handle,
510             options);
511 0         if(result != GLOBUS_SUCCESS)
512         {
513 0             result = GlobusSoapMessageErrorSerializeFailed(
514                 result, NULL, &wsp_PolicyAttachmentType_choice_qname);
515             goto exit;
516         }
517
518 0         break;
519
520         default:
521 0             break;
522     }
523
524  exit:
525
526 0     GlobusSoapMessageDebugExit();
527 0     return result;
528 }
529
530
531
532 globus_result_t
533 wsp_PolicyAttachmentType_choice_serialize(
534     xsd_QName *                         element_qname,
535     wsp_PolicyAttachmentType_choice *             instance,
536     globus_soap_message_handle_t        message_handle,
537     globus_xsd_element_options_t        options)
538 0 {
539 0     globus_result_t                     result = GLOBUS_SUCCESS;
540 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_serialize);
541 0     GlobusSoapMessageDebugEnter();
542
543 0     result = wsp_PolicyAttachmentType_choice_serialize_contents(
544         element_qname,
545         instance,
546         message_handle,
547         options);
548 0     if(result != GLOBUS_SUCCESS)
549     {
550 0         result = GlobusSoapMessageErrorSerializeFailed(
551             result, NULL, &wsp_PolicyAttachmentType_choice_qname);
552         goto exit;
553     }
554
555  exit:
556 0     GlobusSoapMessageDebugExit();
557 0     return result;
558 }
559
560
561
562
563
564 globus_result_t
565 wsp_PolicyAttachmentType_choice_deserialize_contents(
566     xsd_QName *                         element_qname, /* ignored */
567     wsp_PolicyAttachmentType_choice * instance,
568     globus_soap_message_handle_t        message_handle,
569     globus_xsd_element_options_t        options)
570 0 {
571 0     globus_result_t                     result = GLOBUS_SUCCESS;
572 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_deserialize_contents);
573 0     GlobusSoapMessageDebugEnter();
574
575 0     result = wsp_PolicyAttachmentType_choice_deserialize(
576         NULL,
577         instance,
578         message_handle,
579         options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
580 0     if(result != GLOBUS_SUCCESS)
581     {
582 0         result = GlobusSoapMessageErrorDeserializeFailed(
583             result, element_qname);
584         goto exit;
585     }
586
587  exit:
588
589 0     GlobusSoapMessageDebugExit();
590 0     return result;
591 }
592
593
594
595 globus_result_t
596 wsp_PolicyAttachmentType_choice_deserialize(
597     xsd_QName *                         element_qname,
598     wsp_PolicyAttachmentType_choice * instance,
599     globus_soap_message_handle_t        message_handle,
600     globus_xsd_element_options_t        options)
601 0 {
602 0     globus_result_t                     result = GLOBUS_SUCCESS;
603 0     xsd_QName                           subelement;
604 0     xsd_QName                           deselem_qname = { NULL, NULL } ;
605 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_deserialize);
606 0     GlobusSoapMessageDebugEnter();
607
608 0     xsd_QName_init_contents(&deselem_qname);
609
610 0     do
611     {
612 0         result = globus_soap_message_deserialize_element_unknown(
613             message_handle, &deselem_qname);
614 0         if(result != GLOBUS_SUCCESS)
615         {
616 0             result = GlobusSoapMessageErrorDeserializeFailed(
617                 result, &wsp_PolicyAttachmentType_choice_qname);
618 0             goto exit;
619         }
620
621 0         if(globus_soap_message_deserialize_element_is_nil(message_handle))
622         {
623 0             xsd_QName_destroy_contents(&deselem_qname);
624 0             result = globus_soap_message_deserialize_element_end(
625                 message_handle,
626                 element_qname);
627 0             if(result != GLOBUS_SUCCESS)
628             {
629 0                 result = GlobusSoapMessageErrorDeserializeFailed(
630                     result, &wsp_PolicyAttachmentType_choice_qname);
631 0                 goto exit;
632             }
633         }
634         else
635         {
636 0             break;
637         }
638 0     } while(1);
639
640 0     globus_soap_message_deserialize_push_element(message_handle);
641
642 0     subelement.local = "Policy";
643 0     subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/12/policy";
644 0     if(xsd_QName_keyeq((void *)&subelement, (void *)&deselem_qname))
645     {
646 0         instance->type=wsp_PolicyAttachmentType_Policy;
647 0         result = wsp_PolicyExpression_deserialize(
648             &subelement,
649             &instance->value.Policy,
650             message_handle,
651             options);
652 0         if(result != GLOBUS_SUCCESS)
653         {
654 0             result = GlobusSoapMessageErrorDeserializeFailed(
655                 result, &wsp_PolicyAttachmentType_choice_qname);
656 0             goto Policy_destroy;
657         }
658
659 0         goto exit;
660     }
661
662 0     subelement.local = "PolicyReference";
663 0     subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/12/policy";
664 0     if(xsd_QName_keyeq((void *)&subelement, (void *)&deselem_qname))
665     {
666 0         instance->type=wsp_PolicyAttachmentType_PolicyReference;
667 0         result = wsp_PolicyReferenceType_deserialize(
668             &subelement,
669             &instance->value.PolicyReference,
670             message_handle,
671             options);
672 0         if(result != GLOBUS_SUCCESS)
673         {
674 0             result = GlobusSoapMessageErrorDeserializeFailed(
675                 result, &wsp_PolicyAttachmentType_choice_qname);
676 0             goto PolicyReference_destroy;
677         }
678
679 0         goto exit;
680     }
681
682 0     instance->type = wsp_PolicyAttachmentType_undefined;
683  
684     goto exit;
685
686  deserialize_failed:
687
688  PolicyReference_destroy:
689
690  Policy_destroy:
691
692  exit:
693
694 0     xsd_QName_destroy_contents(&deselem_qname);
695
696 0     if(result == GLOBUS_SUCCESS)
697     {
698 0         do
699         {
700 0             result = globus_soap_message_deserialize_element(
701                 message_handle, NULL);
702 0             if(result != GLOBUS_SUCCESS &&
703                (GlobusSoapMessageStatusElementNotFoundCheck(result) ||
704                 GlobusSoapMessageStatusFailedElementCheck(result) ||
705                 GlobusSoapMessageStatusFailedWithTextCheck(result)))
706             {
707 0                 result = GLOBUS_SUCCESS;
708 0                 break;
709             }
710
711 0             if(globus_soap_message_deserialize_element_is_nil(
712                    message_handle))
713             {
714 0                 result = globus_soap_message_deserialize_element_end(
715                     message_handle,
716                     element_qname);
717 0                 if(result != GLOBUS_SUCCESS)
718                 {
719 0                     result = GlobusSoapMessageErrorDeserializeFailed(
720                         result, &wsp_PolicyAttachmentType_choice_qname);
721                     break;
722                 }
723             }
724             else
725             {
726 0                 break;
727             }
728
729 0         } while(1);
730     }
731
732 0     xsd_QName_destroy_contents(&deselem_qname);
733
734 0     GlobusSoapMessageDebugExit();
735 0     return result;
736 }
737
738
739
740 globus_result_t
741 wsp_PolicyAttachmentType_choice_deserialize_pointer(
742     xsd_QName *                         element_qname,
743     wsp_PolicyAttachmentType_choice ** ip,
744     globus_soap_message_handle_t        message_handle,
745     globus_xsd_element_options_t        options)
746 0 {
747 0     wsp_PolicyAttachmentType_choice * instance = NULL;
748 0     globus_result_t                     result = GLOBUS_SUCCESS;
749 0     xsd_QName                           subelement;
750 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_deserialize_pointer);
751 0     GlobusSoapMessageDebugEnter();
752
753 0     *ip = NULL;
754
755 0     result = wsp_PolicyAttachmentType_choice_init(&instance);
756 0     if(result != GLOBUS_SUCCESS)
757     {
758 0         result = GlobusSoapMessageErrorDeserializeFailed(
759             result, element_qname);
760 0         goto exit;
761     }
762
763 0     result = wsp_PolicyAttachmentType_choice_deserialize_contents(
764         element_qname,
765         instance,
766         message_handle,
767         options);
768 0     if(result != GLOBUS_SUCCESS)
769     {
770 0         goto exit;
771     }
772
773 0     *ip = instance;
774
775  exit:
776
777 0     GlobusSoapMessageDebugExit();
778 0     return result;
779 }
780
781
782
783 globus_result_t
784 wsp_PolicyAttachmentType_choice_array_init_contents(
785     wsp_PolicyAttachmentType_choice_array * array)
786 0 {
787 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_array_init_contents);
788 0     GlobusSoapMessageDebugEnter();
789
790 0     memset(array, 0, sizeof(wsp_PolicyAttachmentType_choice_array));
791
792 0     GlobusSoapMessageDebugExit();
793 0     return GLOBUS_SUCCESS;
794 }
795
796 globus_result_t
797 wsp_PolicyAttachmentType_choice_array_init(
798     wsp_PolicyAttachmentType_choice_array ** arr)
799 0 {
800 0     wsp_PolicyAttachmentType_choice_array * array;
801 0     globus_result_t                     result;
802 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_array_init);
803 0     GlobusSoapMessageDebugEnter();
804
805 0     array = (wsp_PolicyAttachmentType_choice_array *)
806         globus_malloc(sizeof(wsp_PolicyAttachmentType_choice_array));
807 0     if(!array)
808     {
809 0         result = GlobusSoapMessageErrorOutOfMemory;
810 0         goto exit;
811     }
812        
813 0     result = wsp_PolicyAttachmentType_choice_array_init_contents(array);
814 0     if(result != GLOBUS_SUCCESS)
815     {
816 0         globus_free(array);
817 0         array = NULL;
818     }
819
820 0     *arr = array;
821
822  exit:
823 0     GlobusSoapMessageDebugExit();
824 0     return result;
825 }
826
827 void
828 wsp_PolicyAttachmentType_choice_array_destroy_contents(
829     wsp_PolicyAttachmentType_choice_array * array)
830 0 {
831 0     int                                 i = 0;
832 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_array_destroy_contents);
833 0     GlobusSoapMessageDebugEnter();
834
835 0     for(; i < array->length; ++i)
836     {
837 0         wsp_PolicyAttachmentType_choice_destroy_contents(&array->elements[i]);
838     }
839
840 0     if(array->elements)
841     {
842 0         globus_free(array->elements);
843 0         array->elements = NULL;
844     }
845 0     array->length = 0;
846
847 0     GlobusSoapMessageDebugExit();
848 }
849
850 void
851 wsp_PolicyAttachmentType_choice_array_destroy(
852     wsp_PolicyAttachmentType_choice_array * array)
853 0 {
854 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_array_destroy);
855 0     GlobusSoapMessageDebugEnter();
856
857 0     wsp_PolicyAttachmentType_choice_array_destroy_contents(array);
858 0     globus_free(array);
859
860 0     GlobusSoapMessageDebugExit();
861 }
862
863 globus_result_t
864 wsp_PolicyAttachmentType_choice_array_copy(
865     wsp_PolicyAttachmentType_choice_array ** dest_arr,
866     const wsp_PolicyAttachmentType_choice_array * src_arr)
867 0 {
868 0     wsp_PolicyAttachmentType_choice_array * array;
869 0     globus_result_t                     result;
870 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_array_copy);
871 0     GlobusSoapMessageDebugEnter();
872
873 0     array = (wsp_PolicyAttachmentType_choice_array *) malloc(
874         sizeof(wsp_PolicyAttachmentType_choice_array));
875 0     if(!array)
876     {
877 0         result = GlobusSoapMessageErrorOutOfMemory;
878 0         GlobusSoapMessageDebugExit();
879 0         return result;
880     }
881
882 0     result = wsp_PolicyAttachmentType_choice_array_copy_contents(array, src_arr);
883 0     if(result != GLOBUS_SUCCESS)
884     {
885 0         globus_free(array);
886 0         GlobusSoapMessageDebugExit();
887 0         return result;
888     }
889
890 0     *dest_arr = array;
891
892 0     GlobusSoapMessageDebugExit();
893 0     return GLOBUS_SUCCESS;
894 }
895
896 globus_result_t
897 wsp_PolicyAttachmentType_choice_array_copy_contents(
898     wsp_PolicyAttachmentType_choice_array * dest_arr,
899     const wsp_PolicyAttachmentType_choice_array * src_arr)
900 0 {
901 0     int                                 i;
902 0     globus_result_t                     result = GLOBUS_SUCCESS;
903 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_array_copy_contents);
904 0     GlobusSoapMessageDebugEnter();
905
906 0     dest_arr->length = src_arr->length;
907 0     if(dest_arr->length > 0)
908     {
909 0         dest_arr->elements = (wsp_PolicyAttachmentType_choice *) malloc(
910             sizeof(wsp_PolicyAttachmentType_choice) * dest_arr->length);
911 0         if(!dest_arr->elements)
912         {
913 0             result = GlobusSoapMessageErrorOutOfMemory;
914 0             goto exit;
915         }
916     }
917     else
918     {
919 0         dest_arr->elements = NULL;
920     }
921     
922 0     for(i = 0; i < dest_arr->length; i++)
923     {
924 0         result = wsp_PolicyAttachmentType_choice_copy_contents(
925             &dest_arr->elements[i], &src_arr->elements[i]);
926 0         if(result != GLOBUS_SUCCESS)
927         {
928 0             while(i--)
929             {
930 0                 wsp_PolicyAttachmentType_choice_destroy_contents(&dest_arr->elements[i]);
931             }
932
933 0             globus_free(dest_arr->elements);
934 0             dest_arr->elements = NULL;
935 0             dest_arr->length = 0;
936 0             break;
937         }
938     }
939
940  exit:
941 0     GlobusSoapMessageDebugExit();
942 0     return result;
943 }
944
945 wsp_PolicyAttachmentType_choice *
946 wsp_PolicyAttachmentType_choice_array_push(
947     wsp_PolicyAttachmentType_choice_array * array)
948 0 {
949 0     wsp_PolicyAttachmentType_choice *             tmp;
950
951 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_array_push);
952 0     GlobusSoapMessageDebugEnter();
953
954 0     tmp = realloc(array->elements,
955                           sizeof(wsp_PolicyAttachmentType_choice) *
956                           (array->length + 1));
957 0     if (tmp == NULL)
958     {
959 0         goto error;
960     }
961 0     array->elements = tmp;
962
963 0     memset(&array->elements[array->length], 0, sizeof(wsp_PolicyAttachmentType_choice));
964 0     array->length++;
965
966 0     GlobusSoapMessageDebugExit();
967 0     return (&array->elements[array->length - 1]);
968 error:
969 0     GlobusSoapMessageDebugExit();
970 0     return NULL;
971 }
972
973 void *
974 wsp_PolicyAttachmentType_choice_array_push_wrapper(
975     void * array)
976 0 {
977 0     return (void *) wsp_PolicyAttachmentType_choice_array_push(
978         (wsp_PolicyAttachmentType_choice_array *) array);
979 }
980
981 globus_result_t
982 wsp_PolicyAttachmentType_choice_array_serialize(
983     xsd_QName *                         element_qname,
984     wsp_PolicyAttachmentType_choice_array * array,
985     globus_soap_message_handle_t        message,
986     globus_xsd_element_options_t        options)
987 0 {
988 0     globus_result_t                     result = GLOBUS_SUCCESS;
989 0     int                                 i = 0;
990 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_array_serialize);
991 0     GlobusSoapMessageDebugEnter();
992
993 0     for(; i < array->length; ++i)
994     {
995 0         result = wsp_PolicyAttachmentType_choice_serialize(
996             element_qname,
997             &array->elements[i],
998             message,
999             options);
1000 0         if(result != GLOBUS_SUCCESS)
1001         {
1002 0             goto exit;
1003         }
1004     }
1005
1006 exit:
1007
1008 0     GlobusSoapMessageDebugExit();
1009 0     return result;
1010 }
1011
1012 globus_result_t
1013 wsp_PolicyAttachmentType_choice_array_deserialize(
1014     xsd_QName *                         element_qname,
1015     wsp_PolicyAttachmentType_choice_array * array,
1016     globus_soap_message_handle_t        message,
1017     globus_xsd_element_options_t        options)
1018 0 {
1019 0     globus_result_t                     result = GLOBUS_SUCCESS;
1020 0     int                                 i = 0;
1021 0     int                                 pre_length;
1022 0     GlobusFuncName(wsp_PolicyAttachmentType_choice_array_deserialize);
1023 0     GlobusSoapMessageDebugEnter();
1024
1025 0     pre_length = array->length;
1026
1027 0     for(i = 0; i < pre_length; ++i)
1028     {
1029 0         result = wsp_PolicyAttachmentType_choice_deserialize(
1030             element_qname,
1031             &array->elements[i],
1032             message,
1033             options);
1034 0         if(result != GLOBUS_SUCCESS)
1035         {
1036 0             if(GlobusSoapMessageStatusFailedElementCheck(result) ||
1037                GlobusSoapMessageStatusElementNotFoundCheck(result) ||
1038                GlobusSoapMessageStatusFailedWithTextCheck(result))
1039             {
1040 0                 result = GLOBUS_SUCCESS;
1041 0                 break;
1042             }
1043
1044 0             result = GlobusSoapMessageErrorDeserializeFailed(
1045                 result, element_qname);
1046 0             goto exit;
1047         }
1048     }
1049
1050 0     while(result == GLOBUS_SUCCESS)
1051     {
1052 0         wsp_PolicyAttachmentType_choice next;
1053 0         memset(&next, 0, sizeof(wsp_PolicyAttachmentType_choice));
1054
1055 0         result = wsp_PolicyAttachmentType_choice_deserialize(
1056             element_qname,
1057             &next,
1058             message,
1059             options);
1060 0         if(result != GLOBUS_SUCCESS)
1061         {
1062 0             if(GlobusSoapMessageStatusFailedElementCheck(result) ||
1063                GlobusSoapMessageStatusElementNotFoundCheck(result) ||
1064                GlobusSoapMessageStatusFailedWithTextCheck(result))
1065             {
1066 0                 result = GLOBUS_SUCCESS;
1067 0                 break;
1068             }
1069
1070 0             result = GlobusSoapMessageErrorDeserializeFailed(
1071                 result, element_qname);
1072 0             goto exit;
1073         }
1074
1075 0         array->elements = realloc(
1076             array->elements,
1077             (array->length + 1) * sizeof(wsp_PolicyAttachmentType_choice));
1078 0         if(!array->elements)
1079         {
1080 0             result = GlobusSoapMessageErrorOutOfMemory;
1081 0             goto exit;
1082         }
1083 0         array->elements[array->length] = next;
1084 0         array->length++;
1085 0         ++i;
1086     }
1087
1088   exit:
1089
1090 0     if(result != GLOBUS_SUCCESS)
1091     {
1092 0         int                             di = 0;
1093 0         for(; di < i; ++di)
1094         {
1095 0             wsp_PolicyAttachmentType_choice_destroy_contents(
1096                 &array->elements[di]);
1097 0             memset(&array->elements[di], 0, sizeof(wsp_PolicyAttachmentType_choice));
1098         }
1099     }
1100
1101 0     GlobusSoapMessageDebugExit();
1102 0     return result;