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 #include "xsd_any.h"
14 #include "globus_soap_message.h"
15 #include "globus_soap_message_utils.h"
16 #include "globus_i_soap_message.h"
17 #include "globus_xml_buffer.h"
18 #include "globus_i_soap_message_wildcards.h"
19 #include "globus_i_xsd.h"
20
21 GLOBUS_I_XSD_DEFINE_QNAME(xsd, any);
22 40 GLOBUS_I_XSD_DEFINE_TYPE_INIT_ARRAY(xsd_any);
23 45992 GLOBUS_I_XSD_DEFINE_TYPE_DESTROY_ARRAY(xsd_any);
24 12635 GLOBUS_I_XSD_DEFINE_TYPE_COPY_ARRAY(xsd_any);
25 4210 GLOBUS_I_XSD_DEFINE_TYPE_SERIALIZE_ARRAY(xsd_any);
26 6444 GLOBUS_I_XSD_DEFINE_TYPE_DESERIALIZE_ARRAY(xsd_any);
27 989349 GLOBUS_I_XSD_DEFINE_TYPE_ARRAY_PUSH(xsd_any);
28 316 GLOBUS_I_XSD_DEFINE_TYPE_INIT(xsd_any);
29 446 GLOBUS_I_XSD_DEFINE_TYPE_DESTROY(xsd_any);
30 242 GLOBUS_I_XSD_DEFINE_TYPE_COPY(xsd_any);
31 0 GLOBUS_I_XSD_DEFINE_INIT_CONTENTS_GENERIC(xsd_any);
32
33 globus_result_t
34 xsd_any_serialize_wrapper(
35     xsd_QName *                         element_qname,
36     void *                              instance,
37     globus_soap_message_handle_t        message_handle,
38     globus_xsd_element_options_t        options)
39 {
40 32     return xsd_any_serialize(
41         element_qname,
42         (xsd_any *) instance,
43         message_handle, options);
44 }
45
46 globus_result_t
47 xsd_any_deserialize_pointer_wrapper(
48     xsd_QName *                         element_qname,
49     void **                             ip,
50     globus_soap_message_handle_t        message_handle,
51     globus_xsd_element_options_t        options)
52 0 {
53 0     return xsd_any_deserialize_pointer(
54         element_qname,
55         (xsd_any **) ip,
56         message_handle, options);
57 }
58
59 struct globus_xsd_type_info_s xsd_any_info =
60 {
61     &xsd_any_qname,
62     xsd_any_serialize_wrapper,
63     xsd_any_deserialize_pointer_wrapper,
64     xsd_any_init_wrapper,
65     xsd_any_destroy_wrapper,
66     xsd_any_copy_wrapper,
67     xsd_any_init_contents_wrapper,
68     xsd_any_destroy_contents_wrapper,
69     xsd_any_copy_contents_wrapper,
70     sizeof(xsd_any),
71     NULL,
72     NULL,
73     &xsd_any_array_info
74 };
75
76 struct globus_xsd_type_info_s xsd_any_array_info =
77 {
78     &xsd_any_qname,
79     xsd_any_array_serialize_wrapper,
80     xsd_any_array_deserialize_wrapper,
81     xsd_any_array_init_wrapper,
82     xsd_any_array_destroy_wrapper,
83     xsd_any_array_copy_wrapper,
84     xsd_any_array_init_contents_wrapper,
85     xsd_any_array_destroy_contents_wrapper,
86     xsd_any_array_copy_contents_wrapper,
87     sizeof(xsd_any),
88     xsd_any_array_push_wrapper,
89     NULL,
90     NULL
91 };
92
93 void
94 xsd_any_destroy_contents(
95     xsd_any *                           instance)
96 1493852 {
97 1493852     GlobusFuncName(xsd_any_destroy_contents);
98 1493852     GlobusSoapMessageDebugEnter();
99     
100 1493852     if(instance)
101     {
102 1493852         if(instance->value && instance->any_info)
103         {
104 1487232             instance->any_info->destroy(instance->value);
105 1487232             instance->value = NULL;
106         }
107     
108 1493852         if(instance->element)
109         {
110 1487227             xsd_QName_destroy(instance->element);
111 1487227             instance->element = NULL;
112         }
113     }
114
115 1493852     GlobusSoapMessageDebugExit();
116 }
117
118 globus_result_t
119 xsd_any_copy_contents(
120     xsd_any *                           dest,
121     const xsd_any *                     src)
122 498024 {
123 498024     globus_result_t                     result = GLOBUS_SUCCESS;
124 498024     GlobusFuncName(xsd_any_copy_contents);
125 498024     GlobusSoapMessageDebugEnter();
126
127 498024     if(dest && src)
128     {
129 498024         *dest = *src;
130 498024         if(src->element)
131         {
132 498020             result = xsd_QName_copy(&dest->element, src->element);
133 498020             if(result != GLOBUS_SUCCESS)
134             {
135 0                 goto error;
136             }
137         }
138         
139 498024         if(src->value && src->any_info)
140         {
141 498024             result = src->any_info->copy(&dest->value, src->value);
142 498024             if(result != GLOBUS_SUCCESS)
143             {
144 0                 if(dest->element)
145                 {
146 0                     xsd_QName_destroy(dest->element);
147 0                     dest->element = NULL;
148                     goto error;
149                 }
150             }
151         }
152     }
153
154 error:
155 498024     GlobusSoapMessageDebugExit();
156 498024     return result;
157 }
158
159 globus_result_t
160 xsd_any_serialize(
161     xsd_QName *                         element_qname,
162     xsd_any *                           anyinst,
163     globus_soap_message_handle_t        message_handle,
164     globus_xsd_element_options_t        options)
165 493680 {
166 493680     globus_result_t                     result = GLOBUS_SUCCESS;
167 493680     GlobusFuncName(xsd_any_serialize);
168 493680     GlobusSoapMessageDebugEnter();
169
170 /*     if(!anyinst->element) */
171 /*     { */
172 /*         result = GlobusSoapMessageErrorSerializeFailed( */
173 /*             GLOBUS_FAILURE,  */
174 /*             "element field in xsd:any variable is NULL.", */
175 /*             element_qname); */
176 /*         goto exit; */
177 /*     } */
178
179     /* serialize contents of type */
180 493680     result = anyinst->any_info->serialize(
181         anyinst->element,
182         anyinst->value,
183         message_handle,
184         options | GLOBUS_XSD_ELEMENT_TYPE_ATTR);
185 493680     if(result != GLOBUS_SUCCESS)
186     {
187 0         result = GlobusSoapMessageErrorSerializeFailed(
188             result, 
189             "Serialization of xsd:any failed",
190             anyinst->element);
191         goto exit;
192     }
193
194  exit:
195  
196 493680     GlobusSoapMessageDebugExit();
197 493680     return result;
198 }
199
200 globus_result_t
201 globus_i_xsd_deserialize_from_element_qname(
202     xsd_QName *                         deselem_qname,
203     globus_xsd_type_info_t *            found_any_info,
204     globus_xsd_type_registry_t          registry,
205     globus_soap_message_handle_t        message_handle)
206 495971 {
207 495971     globus_result_t                     result = GLOBUS_SUCCESS;
208 495971     globus_xsd_type_info_t              any_info = NULL;
209 495971     GlobusFuncName(globus_i_xsd_deserialize_from_element_qname);
210 495971     GlobusSoapMessageDebugEnter();
211
212 495971     GlobusSoapMessageDebugPrintf(
213         GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS, 
214         ("\tLooking for element {%s}%s:\n",
215          deselem_qname->Namespace, 
216          deselem_qname->local));
217
218 495971     GlobusSoapMessageDebugPrintf(
219         GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS, 
220         ("\t\tin instance registry\n"));
221     
222 495971     if(registry)
223     {
224         /* look for element QName in instance registry */
225 0         result = globus_xsd_type_registry_get(
226             registry, deselem_qname, &any_info);
227 0         if(result != GLOBUS_SUCCESS)
228         {
229 0             result = GlobusSoapMessageErrorFailedRegistryLookup(
230                 result, deselem_qname);
231 0             goto exit;
232         }
233
234 0         if(GlobusSoapMessageDebug(GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS))
235         {
236 0             if(any_info)
237             {
238 0                 GlobusSoapMessageDebugPrintf(
239                     GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS,
240                     ("\tFound type info: {%s}%s\n",
241                      any_info->type->Namespace,
242                      any_info->type->local));
243             }
244         }
245     }
246
247 495971     if(!any_info)
248     {
249 495971         globus_xsd_type_registry_t      message_registry;
250
251 495971         GlobusSoapMessageDebugPrintf(
252             GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS, 
253             ("\t\tin message registry\n")); 
254
255 495971         globus_soap_message_handle_get_registry(message_handle,
256                                                 &message_registry);
257 495971         if(message_registry)
258         {
259 494698             result = globus_xsd_type_registry_get(
260                 message_registry, deselem_qname, &any_info);
261 494698             if(result != GLOBUS_SUCCESS)
262             {
263 0                 result = GlobusSoapMessageErrorFailedRegistryLookup(
264                     result, deselem_qname);
265 0                 goto exit;
266             }
267
268 494698             if(GlobusSoapMessageDebug(GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS))
269             {
270 0                 if(any_info)
271                 {
272 0                     GlobusSoapMessageDebugPrintf(
273                         GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS,
274                         ("\tFound type info: {%s}%s\n",
275                          any_info->type->Namespace,
276                          any_info->type->local));
277                 }
278             }
279         }
280     }
281
282 495971     if(!any_info)
283     {
284 2613         GlobusSoapMessageDebugPrintf(
285             GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS, 
286             ("\t\tin global registry\n"));
287
288 2613         result = globus_xsd_type_registry_get(
289             GLOBUS_GLOBAL_TYPE_REGISTRY, deselem_qname, &any_info);
290 2613         if(result != GLOBUS_SUCCESS)
291         {
292 0             result = GlobusSoapMessageErrorFailedRegistryLookup(
293                 result, deselem_qname);
294 0             goto exit;
295         }
296
297 2613         if(GlobusSoapMessageDebug(GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS))
298         {
299 0             if(any_info)
300             {
301 0                 GlobusSoapMessageDebugPrintf(
302                     GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS, 
303                     ("Found type info: {%s}%s\n",
304                      any_info->type->Namespace,
305                      any_info->type->local));
306             }
307         }
308     }
309
310  exit:
311
312 495971     *found_any_info = any_info;
313
314 495971     GlobusSoapMessageDebugExit();
315 495971     return result;
316 }
317     
318
319 globus_result_t
320 globus_i_xsd_deserialize_from_xsi_type(
321     globus_xsd_type_info_t *            found_any_info,
322     globus_xsd_type_registry_t          registry,
323     globus_soap_message_handle_t        message_handle)
324 2607 {
325 2607     globus_result_t                     result = GLOBUS_SUCCESS;
326 2607     globus_xsd_type_info_t              any_info = NULL;
327 2607     xsd_QName                           type;
328 2607     xmlChar *                           type_string = NULL;
329 2607     xmlChar *                           type_prefix = NULL;
330 2607     xmlChar *                           type_local = NULL;
331 2607     xmlChar *                           type_ns = NULL;
332 2607     GlobusFuncName(globus_i_xsd_deserialize_from_xsi_type);
333 2607     GlobusSoapMessageDebugEnter();
334     
335 2607     type.Namespace = NULL;
336 2607     type.local = NULL;
337
338 2607     type_string = xmlTextReaderGetAttributeNs(
339         message_handle->reader, "type", XSI_NS);
340 2607     if(!type_string)
341     {
342 2123         goto exit;
343     }
344
345 484     type_local = xmlSplitQName2(type_string, &type_prefix);
346 484     if(type_prefix)
347     {
348 484         type_ns = xmlTextReaderLookupNamespace(
349             message_handle->reader, type_prefix);
350 484         if(!type_ns)
351         {
352 0             result = GlobusSoapMessageErrorUndefinedNamespace(type_prefix);
353 0             goto exit;
354         }
355
356 484         type.Namespace = globus_libc_strdup(type_ns);
357     }
358     else
359     {
360 0         type.Namespace = NULL;
361     }
362
363 484     type.local = globus_libc_strdup(type_local);
364
365 484     GlobusSoapMessageDebugPrintf(
366         GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS, 
367         ("\tLooking for xsi:type {%s}%s:\n",
368          type.Namespace, type.local));
369
370 484     if(!any_info && registry)
371     {
372 0         GlobusSoapMessageDebugPrintf(
373             GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS, 
374             ("\t\tin instance registry\n"));
375             
376 0         result = globus_xsd_type_registry_get(
377             registry, &type, &any_info);
378 0         if(result != GLOBUS_SUCCESS)
379         {
380 0             result = GlobusSoapMessageErrorFailedRegistryLookup(result, &type);
381 0             goto exit;
382         }
383
384 0         if(GlobusSoapMessageDebug(GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS))
385         {
386 0             if(any_info)
387             {
388 0                 GlobusSoapMessageDebugPrintf(
389                     GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS, 
390                     ("\t\tFound any info: {%s}%s\n",
391                      any_info->type->Namespace, any_info->type->local));
392             }
393         }
394     }
395
396 484     if(!any_info)
397     {
398 484         globus_xsd_type_registry_t      message_registry;
399  
400 484         GlobusSoapMessageDebugPrintf(
401             GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS, ("\t\tin message registry\n"));
402         
403 484         globus_soap_message_handle_get_registry(message_handle,
404                                                 &message_registry);
405 484         if(message_registry)
406         {
407 258             result = globus_xsd_type_registry_get(
408                 message_registry, &type, &any_info);
409 258             if(result != GLOBUS_SUCCESS)
410             {
411 0                 result = GlobusSoapMessageErrorFailedRegistryLookup(
412                     result, &type);
413 0                 goto exit;
414             }
415         }
416
417 484         if(GlobusSoapMessageDebug(GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS))
418         {
419 0             if(any_info)
420             {
421 0                 GlobusSoapMessageDebugPrintf(
422                     GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS, 
423                     ("\tFound any info: {%s}%s\n",
424                      any_info->type->Namespace,
425                      any_info->type->local));
426             }
427         }
428     }
429
430 484     if(!any_info)
431     {
432 484         GlobusSoapMessageDebugPrintf(
433             GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS, 
434             ("\t\tin global registry\n"));
435
436 484         result = globus_xsd_type_registry_get(
437             GLOBUS_GLOBAL_TYPE_REGISTRY, &type, &any_info);
438 484         if(result != GLOBUS_SUCCESS)
439         {
440 0             result = GlobusSoapMessageErrorFailedRegistryLookup(
441                 result, &type);
442 0             goto exit;
443         }
444
445 484         if(GlobusSoapMessageDebug(GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS))
446         {
447 0             if(any_info)
448             {
449 0                 GlobusSoapMessageDebugPrintf(
450                     GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS, 
451                     ("\tFound any info: {%s}%s\n",
452                     any_info->type->Namespace,
453                      any_info->type->local));
454             }
455         }
456     }
457
458 484     if(!any_info)
459     {
460 1         any_info = &globus_xml_buffer_contents_info;
461     }
462
463  exit:
464
465 2607     *found_any_info = any_info;
466
467 2607     if(type.local)
468     {
469 484         free(type.local);
470     }
471
472 2607     if(type.Namespace)
473     {
474 484         free(type.Namespace);
475     }
476
477 2607     if (type_string)
478     {
479 484         xmlFree(type_string);
480     }
481
482 2607     if (type_local)
483     {
484 484         xmlFree(type_local);
485     }
486
487 2607     if (type_prefix)
488     {
489 484         xmlFree(type_prefix);
490     }
491
492 2607     if (type_ns)
493     {
494 484         xmlFree(type_ns);
495     }
496
497 2607     GlobusSoapMessageDebugEnter();
498 2607     return result;
499 }
500
501 globus_result_t
502 xsd_any_deserialize(
503     xsd_QName *                         element_qname,
504     xsd_any *                           instance,
505     globus_soap_message_handle_t        message_handle,
506     globus_xsd_element_options_t        options)
507 502415 {
508 502415     globus_result_t                     result = GLOBUS_SUCCESS;
509 502415     xsd_QName *                         deselem_qname = NULL;
510 502415     int                                 element_exists = 0;
511 502415     GlobusFuncName(xsd_any_deserialize);
512 502415     GlobusSoapMessageDebugEnter();
513
514 502415     result = globus_soap_message_deserialize_element(
515         message_handle, NULL);
516 502415     if(result != GLOBUS_SUCCESS)
517     {
518 6444         if(GlobusSoapMessageStatusFailedWithTextCheck(result))
519         {
520 0             element_exists = 0;
521 0             instance->any_info = &globus_xml_buffer_contents_info;
522         }
523 6444         else if(!GlobusSoapMessageStatusCheck(result))
524         {
525 0             result = GlobusSoapMessageErrorDeserializeFailed(
526                 result, &xsd_any_qname);
527 0             goto exit;
528         }
529         else
530         {
531 495971     goto exit;
532         }
533     }
534     else
535     {
536 495971         element_exists = 1;
537 495971         globus_soap_message_deserialize_push_element(message_handle);
538     }
539
540 495971     GlobusSoapMessageDebugPrintf(
541         GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS, ("\n\nDeserializing xsd:any\n"));
542
543     /* only if an element exists, set the instance->element to it */
544 495971     if(element_exists)
545     {
546 495971         xsd_QName_init(&deselem_qname);
547         
548 495971         deselem_qname->local = globus_libc_strdup(
549             xmlTextReaderConstLocalName(
550                 message_handle->reader));
551 495971         deselem_qname->Namespace = globus_libc_strdup(
552             xmlTextReaderConstNamespaceUri(message_handle->reader));
553         
554 495971         instance->element = deselem_qname;
555
556         /* if instance->any_info isn't set, then look for info in registry
557          * based on QName of element
558          */
559 495971         if(!instance->any_info)
560         {
561 495971             result = globus_i_xsd_deserialize_from_element_qname(
562                 deselem_qname,
563                 &instance->any_info,
564                 instance->registry,
565                 message_handle);
566 495971             if(result != GLOBUS_SUCCESS)
567             {
568 0                 result = GlobusSoapMessageErrorDeserializeFailed(
569                     result, &xsd_any_qname);
570 0                 goto exit;
571             }
572         }
573     }
574         
575     /* no any_info, look for xsi:type */
576 495971     if(!instance->any_info)
577     {
578 2607         result = globus_i_xsd_deserialize_from_xsi_type(
579             &instance->any_info,
580             instance->registry,
581             message_handle);
582 2607         if(result != GLOBUS_SUCCESS)
583         {
584 0             result = GlobusSoapMessageErrorDeserializeFailed(
585                 result, &xsd_any_qname);
586 0             goto exit;
587         }
588     }
589
590 495971     if(!instance->any_info)
591     {
592 2123         instance->any_info = (&globus_xml_buffer_contents_info);
593     }
594
595 495971     GlobusSoapMessageDebugPrintf(
596         GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS, 
597         ("Using any info: {%s}%s\n",
598          instance->any_info->type->Namespace,
599          instance->any_info->type->local));
600
601 495971     result = instance->any_info->deserialize(
602         deselem_qname,
603         &instance->value,
604         message_handle,
605         options);
606 495971     if(result != GLOBUS_SUCCESS)
607     {
608 0         result = GlobusSoapMessageErrorDeserializeFailed(
609             result, instance->any_info->type);
610         goto exit;
611     }
612
613  exit:
614
615 502415     if(result != GLOBUS_SUCCESS)
616     {
617 6444         xsd_any_destroy_contents(instance);
618     }
619
620 502415     GlobusSoapMessageDebugExit();
621 502415     return result;
622 }
623
624 globus_result_t
625 xsd_any_deserialize_pointer(
626     xsd_QName *                         element_qname,
627     xsd_any **                          ip,
628     globus_soap_message_handle_t        message_handle,
629     globus_xsd_element_options_t        options)
630 67 {
631 67     xsd_any *                           instance;
632 67     xsd_QName *                         deselem_qname;
633 67     int                                 element_exists;
634 67     globus_result_t                     result = GLOBUS_SUCCESS;
635 67     GlobusFuncName(xsd_any_deserialize_pointer);
636 67     GlobusSoapMessageDebugEnter();
637
638 67     result = xsd_any_init(&instance);
639 67     if(result != GLOBUS_SUCCESS)
640     {
641 0         result = GlobusSoapMessageErrorDeserializeFailed(
642             result, &xsd_any_qname);
643 0         goto exit;
644     }
645
646 67     result = globus_soap_message_deserialize_element(
647         message_handle, NULL);
648 67     if(result != GLOBUS_SUCCESS)
649     {
650 67         if(GlobusSoapMessageStatusElementNotFoundCheck(result) ||
651            GlobusSoapMessageStatusFailedWithTextCheck(result))
652         {
653 2             element_exists = 0;
654 2             instance->any_info = &globus_xml_buffer_contents_info;
655 2             result = GLOBUS_SUCCESS;
656         }
657 65         else if(!GlobusSoapMessageStatusCheck(result))
658         {
659 0             result = GlobusSoapMessageErrorDeserializeFailed(
660                 result, &xsd_any_qname);
661 0             goto exit;
662         }
663         else
664         {
665 0             goto exit;
666         }
667     }
668     else
669     {
670 0         element_exists = 1;
671 0         globus_soap_message_deserialize_push_element(message_handle);
672     }
673
674 2     GlobusSoapMessageDebugPrintf(
675         GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS, ("\n\nDeserializing xsd:any\n"));
676     
677 2     if(element_exists)
678     {
679 0         xsd_QName_init(&deselem_qname);
680         
681 0         deselem_qname->local = globus_libc_strdup(
682             xmlTextReaderConstLocalName(message_handle->reader));
683 0         deselem_qname->Namespace = globus_libc_strdup(
684             xmlTextReaderConstNamespaceUri(message_handle->reader));
685         
686 0         instance->element = deselem_qname;
687
688         /* if instance->any_info isn't set, then look for info in registry
689          * based on QName of element
690          */
691 0         if(!instance->any_info)
692         {
693 0             result = globus_i_xsd_deserialize_from_element_qname(
694                 deselem_qname,
695                 &instance->any_info,
696                 instance->registry,
697                 message_handle);
698 0             if(result != GLOBUS_SUCCESS)
699             {
700 0                 result = GlobusSoapMessageErrorDeserializeFailed(
701                     result, &xsd_any_qname);
702 0                 goto exit;
703             }
704         }
705     }
706         
707     /* no any_info, look for xsi:type */
708 2     if(!instance->any_info)
709     {
710 0         result = globus_i_xsd_deserialize_from_xsi_type(
711             &instance->any_info,
712             instance->registry,
713             message_handle);
714 0         if(result != GLOBUS_SUCCESS)
715         {
716 0             result = GlobusSoapMessageErrorDeserializeFailed(
717                 result, &xsd_any_qname);
718 0             goto exit;
719         }
720     }
721
722 2     if(!instance->any_info)
723     {
724 0         instance->any_info = (&globus_xml_buffer_contents_info);
725     }
726
727 2     GlobusSoapMessageDebugPrintf(
728         GLOBUS_SOAP_MESSAGE_DEBUG_WILDCARDS, 
729         ("Using any info: {%s}%s\n",
730          instance->any_info->type->Namespace,
731          instance->any_info->type->local));
732
733 2     result = instance->any_info->deserialize(
734         deselem_qname,
735         &instance->value,
736         message_handle,
737         options);
738 2     if(result != GLOBUS_SUCCESS)
739     {
740 0         result = GlobusSoapMessageErrorDeserializeFailed(
741             result, instance->any_info->type);
742 0         goto exit;
743     }
744
745 2     *ip = instance;
746
747  exit:
748
749 67     if(result != GLOBUS_SUCCESS)
750     {
751 65         xsd_any_destroy(instance);
752     }
753
754 67     GlobusSoapMessageDebugExit();
755 67     return result;
756 }
757