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 "globus_common.h"
14 #include "globus_i_soap_message.h"
15 #include "globus_soap_message.h"
16 #include "globus_soap_message_markers.h"
17 #include "globus_soap_message_handle.h"
18 #include "globus_soap_message_fault.h"
19 #include "globus_xml_buffer.h"
20 #include "openssl/evp.h"
21 #include "globus_xio_buffer.h"
22 #include "math.h"
23
24 #include "libxml/xmlschemastypes.h"
25
26 #ifdef __alpha /* Tru64 Unix does not define these */
27 #ifndef INT32_MIN
28 #define INT32_MIN INT_MIN
29 #endif
30 #ifndef INT32_MAX
31 #define INT32_MAX INT_MAX
32 #endif
33 #ifndef INT64_MIN
34 #define INT64_MIN LONG_MIN
35 #endif
36 #ifndef INT64_MAX
37 #define INT64_MAX LONG_MAX
38 #endif
39 #ifndef UINT32_MAX
40 #define UINT32_MAX UINT_MAX
41 #endif
42 #ifndef UINT64_MAX
43 #define UINT64_MAX ULONG_MAX
44 #endif
45 #endif /* __alpha */
46
47 #define XSI_NS "http://www.w3.org/2001/XMLSchema-instance"
48 #define XSI_NIL "nil"
49
50 static
51 char *
52 globus_l_soap_message_my_strtok(
53 const char * str,
54 size_t str_length,
55 int * token_start_index,
56 int * token_end_index,
57 const char * delims)
58 515405 {
59 const char * locator;
60 const char * start_token;
61 int delim_count,
62 ind,
63 i,
64 between_tokens,
65 len;
66 515405 char * new_token = NULL;
67 515405 ind = 0;
68 515405 i = 0;
69 515405 between_tokens = 0;
70 515405 delim_count = strlen(delims);
71 515405 locator = str;
72
73 2061620 for(i = 0; i < delim_count; ++i)
74 {
75 1546215 if(*locator == delims[i])
76 {
77 44 between_tokens = 1;
78 }
79 }
80
81 516153 while(between_tokens && locator && ind < str_length)
82 {
83 2332 for(i = 0; i < delim_count; ++i)
84 {
85 2288 if(*locator == delims[i])
86 {
87 1540 break;
88 }
89 }
90
91 792 if(i == delim_count)
92 {
93 44 between_tokens = 0;
94 44 break;
95 }
96
97 748 locator++;
98 748 ind++;
99 }
100
101 515405 start_token = locator;
102 515405 if(token_start_index)
103 {
104 515405 *token_start_index = ind;
105 }
106
107 11626132 while(!between_tokens && *locator && ind < str_length)
108 {
109 44442776 for(i = 0; i < delim_count; ++i)
110 {
111 33332093 if(*locator == delims[i])
112 {
113 44 if(token_end_index)
114 {
115 44 *token_end_index = ind;
116 }
117 44 between_tokens = 1;
118 44 break;
119 }
120 }
121
122 11110727 locator++;
123 11110727 ind++;
124 }
125
126 515405 if(ind == str_length)
127 {
128 515361 *token_end_index = -1;
129 }
130 else
131 {
132 44 ind--;
133 }
134
135 515405 len = ind + (str - start_token);
136 515405 if(len > 0)
137 {
138 515405 new_token = malloc(len+1);
139 515405 memcpy(new_token, start_token, len + 1);
140 515405 new_token[len] = '\0';
141 }
142
143 515405 return new_token;
144 }
145
146 static
147 int
148 globus_i_soap_message_split_qnames(
149 const xmlChar * qname_string,
150 globus_list_t ** qnames)
151 0 {
152 xmlChar * tmpstr;
153 xmlChar * newstr;
154 int start_token;
155 int end_token;
156 char * token;
157
158 0 newstr = globus_libc_strdup(qname_string);
159 0 tmpstr = newstr;
160 0 token = globus_l_soap_message_my_strtok(
161 tmpstr, strlen(tmpstr), &start_token, &end_token, "\n\t ");
162 0 tmpstr += end_token;
163
164 while(1)
165 {
166 0 globus_list_insert(qnames, token);
167 0 if(end_token < 0)
168 {
169 0 break;
170 }
171
172 0 token = globus_l_soap_message_my_strtok(
173 tmpstr, strlen(tmpstr), &start_token, &end_token, "\n\t ");
174 0 tmpstr += end_token;
175 0 if(!token)
176 {
177 0 break;
178 }
179
180 0 globus_list_insert(qnames, token);
181 0 }
182
183 0 globus_free(newstr);
184 0 return 0;
185 }
186
187 void
188 globus_soap_message_deserialize_push_element(
189 globus_soap_message_handle_t handle)
190 804668 {
191 GlobusFuncName(globus_soap_message_deserialize_push_element);
192 804668 GlobusSoapMessageDebugEnter();
193
194 804668 handle->next_ready++;
195
196 804668 GlobusSoapMessageDebugExit();
197 }
198
199 globus_result_t
200 globus_i_soap_message_deserialize_read(
201 globus_soap_message_handle_t handle)
202 0 {
203 0 globus_result_t result = GLOBUS_SUCCESS;
204 GlobusFuncName(globus_i_soap_message_deserialize_next_element);
205 0 GlobusSoapMessageDebugEnter();
206
207 0 if(xmlTextReaderNodeType(handle->reader) != XML_READER_TYPE_NONE &&
208 xmlTextReaderIsEmptyElement(handle->reader))
209 {
210 0 if(handle->next_ready > 0)
211 {
212 0 handle->next_ready--;
213 }
214 else
215 {
216 0 result = GLOBUS_SOAP_MESSAGE_STATUS_FAILED_ELEMENT;
217 }
218
219 goto exit;
220 }
221
222 0 if(handle->next_ready > 0)
223 {
224 0 handle->next_ready--;
225 }
226 else
227 {
228 0 if(xmlTextReaderRead(handle->reader) <= 0)
229 {
230 0 result = GlobusSoapMessageErrorFailedNextNode(handle->result);
231 goto exit;
232 }
233 }
234
235 0 exit:
236 0 GlobusSoapMessageDebugExit();
237 0 return result;
238 }
239
240 globus_result_t
241 globus_i_soap_message_deserialize_next_element(
242 globus_soap_message_handle_t handle)
243 2089003 {
244 2089003 globus_result_t result = GLOBUS_SUCCESS;
245 2089003 char * idval = NULL;
246 GlobusFuncName(globus_i_soap_message_deserialize_next_element);
247 2089003 xmlReaderTypes type = XML_READER_TYPE_NONE;
248
249 2089003 GlobusSoapMessageDebugEnter();
250
251 2089003 if(xmlTextReaderNodeType(handle->reader) != type &&
252 xmlTextReaderIsEmptyElement(handle->reader))
253 {
254 460 if(handle->next_ready > 0)
255 {
256 442 handle->next_ready--;
257 }
258 else
259 {
260 18 result = GLOBUS_SOAP_MESSAGE_STATUS_FAILED_ELEMENT;
261 }
262
263 goto exit;
264 }
265
266 4153138 while(type != XML_READER_TYPE_ELEMENT)
267 {
268 2090618 if(handle->next_ready > 0)
269 {
270 786291 handle->next_ready--;
271 }
272 else
273 {
274 1304327 if(xmlTextReaderRead(handle->reader) <= 0)
275 {
276 0 result = GlobusSoapMessageErrorFailedNextNode(handle->result);
277 0 goto exit;
278 }
279 }
280
281 2090618 type = xmlTextReaderNodeType(handle->reader);
282 2090618 if(type == XML_READER_TYPE_END_ELEMENT)
283 {
284 26010 result = GLOBUS_SOAP_MESSAGE_STATUS_FAILED_ELEMENT;
285 26010 goto exit;
286 }
287 2064608 else if(type == XML_READER_TYPE_TEXT)
288 {
289 13 xmlChar * str = NULL;
290 13 if (handle->verbose)
291 {
292 0 str = xmlTextReaderValue(handle->reader);
293 }
294 13 result = GlobusSoapMessageErrorFailedWithText(handle->verbose, str);
295
296 13 if (str)
297 {
298 0 xmlFree(str);
299 }
300
301 goto exit;
302 }
303 }
304
305 2062520 if(type == XML_READER_TYPE_ELEMENT)
306 {
307 2062520 if(handle->callout_table)
308 {
309 xsd_QName qn;
310
311 0 qn.local = (char *)
312 xmlTextReaderConstLocalName(handle->reader);
313 0 qn.Namespace = (char *)
314 xmlTextReaderConstNamespaceUri(handle->reader);
315
316 0 result = globus_soap_message_invoke_callouts(
317 handle,
318 &qn,
319 GLOBUS_SOAP_MESSAGE_CALLOUT_BEGIN);
320 0 if(result != GLOBUS_SUCCESS)
321 {
322 0 result = GlobusSoapMessageErrorFailedNextNode(result);
323 0 goto exit;
324 }
325 }
326
327 2062520 if((idval = xmlTextReaderGetAttribute(
328 handle->reader,
329 "Id")) != NULL)
330 {
331 0 result = globus_soap_message_deserialize_mark(
332 handle,
333 idval);
334 0 if(result != GLOBUS_SUCCESS)
335 {
336 0 result = GlobusSoapMessageErrorSettingId(
337 result);
338 0 goto exit;
339 }
340 0 xmlFree(idval);
341 }
342 }
343
344 2089003 exit:
345
346 2089003 GlobusSoapMessageDebugExit();
347 2089003 return result;
348 }
349
350 globus_result_t
351 globus_soap_message_deserialize_element_end(
352 globus_soap_message_handle_t handle,
353 xsd_QName * qname)
354 1284247 {
355 1284247 char * idval = NULL;
356 1284247 globus_result_t result = GLOBUS_SUCCESS;
357 1284247 xmlReaderTypes type = XML_READER_TYPE_NONE;
358 1284247 int res = 0;
359 GlobusFuncName(globus_soap_message_deserialize_element_end);
360 1284247 GlobusSoapMessageDebugEnter();
361
362 1284247 if(xmlTextReaderIsEmptyElement(handle->reader))
363 {
364 392 if (qname)
365 {
366 xsd_QName tmp;
367 xmlChar * qname_ns;
368 xmlChar * qname_local;
369
370 392 tmp.Namespace = (char *)
371 xmlTextReaderConstNamespaceUri(handle->reader);
372 392 tmp.local = (char *)
373 xmlTextReaderConstLocalName(handle->reader);
374 392 qname_ns = xmlTextReaderConstString(handle->reader,
375 qname->Namespace);
376 392 qname_local = xmlTextReaderConstString(handle->reader,
377 qname->local);
378 392 if (qname_ns != tmp.Namespace || qname_local != tmp.local)
379 {
380 0 result = GlobusSoapMessageErrorFailedEndElement(
381 handle->verbose,
382 &tmp);
383 0 goto exit;
384 }
385 }
386 392 res = xmlTextReaderRead(handle->reader);
387 392 if(res < 0)
388 {
389 0 result = GlobusSoapMessageErrorFailedNextNode(handle->result);
390 0 goto exit;
391 }
392 392 handle->next_ready++;
393
394 392 goto exit;
395 }
396
397 2567740 while(type != XML_READER_TYPE_END_ELEMENT)
398 {
399 1283885 if(handle->next_ready > 0)
400 {
401 15236 handle->next_ready--;
402 }
403 else
404 {
405 1268649 res = xmlTextReaderRead(handle->reader);
406 1268649 if(res < 0)
407 {
408 0 result = GlobusSoapMessageErrorFailedNextNode(handle->result);
409 0 goto exit;
410 }
411 1268649 else if(res == 0)
412 {
413 1283885 goto exit;
414 }
415 }
416
417 1283885 type = xmlTextReaderNodeType(handle->reader);
418 1283885 if(type == XML_READER_TYPE_ELEMENT)
419 {
420 xsd_QName unexpected_qn;
421
422 0 if (handle->verbose)
423 {
424 0 unexpected_qn.Namespace = (char *)
425 xmlTextReaderConstNamespaceUri(handle->reader);
426 0 unexpected_qn.local = (char *)
427 xmlTextReaderConstLocalName(handle->reader);
428 }
429 0 result = GlobusSoapMessageErrorFailedEndElement(
430 handle->verbose,
431 &unexpected_qn);
432
433 0 goto exit;
434 }
435 1283885 else if (type == XML_READER_TYPE_TEXT)
436 {
437 0 xmlChar * str = NULL;
438 0 if (handle->verbose)
439 {
440 0 str = xmlTextReaderValue(handle->reader);
441 }
442 0 result = GlobusSoapMessageErrorFailedWithText(handle->verbose, str);
443
444 0 goto exit;
445 }
446 }
447
448 1283855 if(type == XML_READER_TYPE_END_ELEMENT)
449 {
450 xsd_QName qn;
451
452 1283855 if(handle->callout_table)
453 {
454 0 qn.local = (char *)
455 xmlTextReaderConstLocalName(handle->reader);
456 0 qn.Namespace = (char *)
457 xmlTextReaderConstNamespaceUri(handle->reader);
458
459 0 result = globus_soap_message_invoke_callouts(
460 handle,
461 &qn,
462 GLOBUS_SOAP_MESSAGE_CALLOUT_END);
463 }
464
465 1283855 if((idval = xmlTextReaderGetAttribute(
466 handle->reader,
467 "Id")) != NULL)
468 {
469 char * end_idval =
470 0 globus_common_create_string("%s-end", idval);
471
472 0 if(handle->next_ready == 0)
473 {
474 0 result = globus_i_soap_message_deserialize_read(handle);
475 0 if(result != GLOBUS_SUCCESS &&
476 !GlobusSoapMessageStatusFailedElementCheck(result))
477 {
478 0 result = GLOBUS_SUCCESS;
479 0 goto exit;
480 }
481
482 0 globus_soap_message_deserialize_push_element(handle);
483 }
484
485 0 result = globus_soap_message_deserialize_mark(
486 handle, end_idval);
487 0 if(result != GLOBUS_SUCCESS)
488 {
489 0 result = GlobusSoapMessageErrorSettingId(
490 result);
491 0 goto exit;
492 }
493 0 xmlFree(idval);
494 0 globus_free(end_idval);
495 }
496 }
497
498 1284247 exit:
499
500 1284247 GlobusSoapMessageDebugExit();
501 1284247 return result;
502 }
503
504 globus_result_t
505 globus_soap_message_deserialize_skip(
506 globus_soap_message_handle_t handle)
507 0 {
508 0 globus_result_t result = GLOBUS_SUCCESS;
509 GlobusFuncName(globus_soap_message_deserialize_skip);
510 0 GlobusSoapMessageDebugEnter();
511
512 0 if(xmlTextReaderSkip(handle->reader, handle->next_ready) <= 0)
513 {
514 0 result = GlobusSoapMessageErrorFailedNextNode(handle->result);
515 0 goto exit;
516 }
517
518 0 if(!handle->next_ready)
519 {
520 0 handle->next_ready++;
521 }
522
523 0 exit:
524
525 0 GlobusSoapMessageDebugExit();
526 0 return result;
527 }
528
529 globus_result_t
530 globus_i_soap_message_deserialize_next_content(
531 globus_soap_message_handle_t handle)
532 1258229 {
533 1258229 globus_result_t result = GLOBUS_SUCCESS;
534 1258229 xmlReaderTypes type = XML_READER_TYPE_NONE;
535 GlobusFuncName(globus_i_soap_message_deserialize_next_content);
536 1258229 GlobusSoapMessageDebugEnter();
537
538 1258229 if(xmlTextReaderIsEmptyElement(handle->reader))
539 {
540 goto exit;
541 }
542
543 2516458 while(type != XML_READER_TYPE_TEXT)
544 {
545 1258229 if(handle->next_ready > 0)
546 {
547 0 handle->next_ready--;
548 }
549 1258229 else if(xmlTextReaderRead(handle->reader) <= 0)
550 {
551 0 result = GlobusSoapMessageErrorFailedNextNode(handle->result);
552 0 goto exit;
553 }
554
555 1258229 type = xmlTextReaderNodeType(handle->reader);
556 1258229 if(type == XML_READER_TYPE_END_ELEMENT)
557 {
558 /* no content in between nodes */
559 0 globus_soap_message_deserialize_push_element(handle);
560 0 goto exit;
561 }
562
563 1258229 if(type != XML_READER_TYPE_TEXT &&
564 type != XML_READER_TYPE_ATTRIBUTE)
565 {
566 0 result = GlobusSoapMessageErrorFailedContent();
567 0 goto exit;
568 }
569 }
570
571 1258229 exit:
572
573 1258229 GlobusSoapMessageDebugExit();
574 1258229 return result;
575 }
576
577 globus_result_t
578 globus_i_soap_message_deserialize_next_attribute(
579 globus_soap_message_handle_t handle)
580 0 {
581 0 globus_result_t result = GLOBUS_SUCCESS;
582 0 xmlReaderTypes type = XML_READER_TYPE_NONE;
583 GlobusFuncName(globus_i_soap_message_deserialize_next_attribute);
584 0 GlobusSoapMessageDebugEnter();
585
586 0 if(xmlTextReaderRead(handle->reader) <= 0)
587 {
588 0 result = GlobusSoapMessageErrorFailedNextNode(handle->result);
589 0 goto exit;
590 }
591
592 0 type = xmlTextReaderNodeType(handle->reader);
593 0 if(type != XML_READER_TYPE_ATTRIBUTE)
594 {
595 0 result = GlobusSoapMessageErrorFailedAttribute();
596 goto exit;
597 }
598
599 0 exit:
600
601 0 GlobusSoapMessageDebugExit();
602 0 return result;
603 }
604
605 globus_result_t
606 globus_soap_message_deserialize_envelope(
607 globus_soap_message_handle_t handle)
608 5196 {
609 xsd_QName local_qn;
610 const xmlChar * local;
611 const xmlChar * soap_env;
612 5196 globus_result_t result = GLOBUS_SUCCESS;
613
614 GlobusFuncName(globus_soap_message_deserialize_envelope);
615 5196 GlobusSoapMessageDebugEnter();
616
617 5196 result = globus_soap_message_set_marker(
618 handle,
619 GLOBUS_SOAP_MESSAGE_MARKER_ENVELOPE);
620 5196 if(result != GLOBUS_SUCCESS)
621 {
622 0 result = GlobusSoapMessageErrorDeserializeFailed(
623 result, &soap_env_qname);
624 0 goto exit;
625 }
626
627 5196 result = globus_i_soap_message_deserialize_next_element(handle);
628 5196 if(result != GLOBUS_SUCCESS)
629 {
630 0 result = GlobusSoapMessageErrorDeserializeFailed(
631 result, &soap_env_qname);
632 0 goto exit;
633 }
634
635 5196 soap_env = xmlTextReaderConstString(handle->reader, SOAP_ENV);
636 5196 local = xmlTextReaderConstLocalName(handle->reader);
637 5196 if(soap_env != local)
638 {
639 0 if (handle->verbose)
640 {
641 0 local_qn.Namespace = (char *)
642 xmlTextReaderConstNamespaceUri(handle->reader);
643 0 local_qn.local = (char *) local;
644 }
645 0 result = GlobusSoapMessageErrorElementNotFound(
646 handle->verbose,
647 &soap_env_qname,
648 &local_qn);
649 goto exit;
650 }
651
652 5196 exit:
653
654 5196 GlobusSoapMessageDebugExit();
655 5196 return result;
656 }
657
658 globus_result_t
659 globus_soap_message_deserialize_envelope_end(
660 globus_soap_message_handle_t handle)
661 5194 {
662 5194 globus_result_t result = GLOBUS_SUCCESS;
663 GlobusFuncName(globus_soap_message_deserialize_envelope_end);
664 5194 GlobusSoapMessageDebugEnter();
665
666 5194 result = globus_soap_message_deserialize_element_end(
667 handle,
668 &soap_env_qname);
669 5194 if(result != GLOBUS_SUCCESS)
670 {
671 0 result = GlobusSoapMessageErrorDeserializeFailed(
672 result, &soap_env_qname);
673 0 goto exit;
674 }
675
676 5194 result = globus_xio_handle_cntl(
677 handle->xio_handle, globus_i_soap_message_buffer_driver,
678 GLOBUS_XIO_BUFFER_SET_READ_MARKER_AT_INDEX,
679 GLOBUS_SOAP_MESSAGE_MARKER_ENVELOPE_END,
680 xmlTextReaderReadPosition(handle->reader));
681 5194 if(result != GLOBUS_SUCCESS)
682 {
683 0 result = GlobusSoapMessageErrorWithMarker(
684 result, "Failed to set read marker: %s",
685 GLOBUS_SOAP_MESSAGE_MARKER_ENVELOPE_END);
686 goto exit;
687 }
688
689 5194 exit:
690
691 5194 GlobusSoapMessageDebugExit();
692 5194 return result;
693 }
694
695 globus_result_t
696 globus_soap_message_deserialize_header(
697 globus_soap_message_handle_t handle)
698 5196 {
699 const xmlChar * local;
700 const xmlChar * soap_header;
701 5196 globus_result_t result = GLOBUS_SUCCESS;
702
703 GlobusFuncName(globus_soap_message_deserialize_header);
704 5196 GlobusSoapMessageDebugEnter();
705
706 5196 result = globus_i_soap_message_deserialize_next_element(handle);
707 5196 if(result != GLOBUS_SUCCESS)
708 {
709 0 result = GlobusSoapMessageErrorDeserializeFailed(
710 result, &soap_header_qname);
711 0 goto exit;
712 }
713
714 5196 soap_header = xmlTextReaderConstString(handle->reader, SOAP_HEADER);
715 5196 local = xmlTextReaderConstLocalName(handle->reader);
716 5196 if(soap_header != local)
717 {
718 1 result = GlobusSoapMessageErrorDeserializeFailed(
719 GLOBUS_SUCCESS, &soap_header_qname);
720 goto exit;
721 }
722
723 5196 exit:
724
725 5196 GlobusSoapMessageDebugExit();
726 5196 return result;
727 }
728
729 globus_result_t
730 globus_soap_message_deserialize_header_end(
731 globus_soap_message_handle_t handle)
732 5195 {
733 5195 globus_result_t result = GLOBUS_SUCCESS;
734 GlobusFuncName(globus_soap_message_deserialize_header_end);
735 5195 GlobusSoapMessageDebugEnter();
736
737 5195 result = globus_soap_message_deserialize_element_end(
738 handle,
739 &soap_header_qname);
740 5195 if(result != GLOBUS_SUCCESS)
741 {
742 0 GlobusSoapMessageErrorDeserializeFailed(
743 result, &soap_header_qname);
744 goto exit;
745 }
746
747 5195 exit:
748
749 5195 GlobusSoapMessageDebugExit();
750 5195 return result;
751 }
752
753 globus_result_t
754 globus_soap_message_add_required_header_element(
755 globus_soap_message_handle_t handle,
756 const xsd_QName * qn)
757 0 {
758 0 globus_result_t result = GLOBUS_SUCCESS;
759 xsd_QName * value;
760 GlobusFuncName(globus_soap_message_add_required_header_element);
761 0 GlobusSoapMessageDebugEnter();
762
763 0 if(!handle->mustUnderstand_hash)
764 {
765 0 globus_hashtable_init(
766 &handle->mustUnderstand_hash,
767 10,
768 xsd_QName_hash,
769 xsd_QName_keyeq);
770 }
771
772 0 xsd_QName_copy(&value, qn);
773
774 0 globus_hashtable_insert(
775 &handle->mustUnderstand_hash,
776 value, value);
777
778 0 GlobusSoapMessageDebugExit();
779 0 return result;
780 }
781
782 globus_result_t
783 globus_soap_message_remove_required_header_element(
784 globus_soap_message_handle_t handle,
785 const xsd_QName * qn)
786 8524 {
787 xsd_QName * entry;
788 8524 if(handle->mustUnderstand_hash)
789 {
790 0 entry = globus_hashtable_remove(
791 &handle->mustUnderstand_hash, (void *)qn);
792 0 xsd_QName_destroy(entry);
793 }
794 8524 return GLOBUS_SUCCESS;
795 }
796
797 globus_result_t
798 globus_soap_message_check_required_headers(
799 globus_soap_message_handle_t handle)
800 5125 {
801 5125 if(!handle->mustUnderstand_hash)
802 {
803 5125 return GLOBUS_SUCCESS;
804 }
805
806 0 if(globus_hashtable_empty(&handle->mustUnderstand_hash))
807 {
808 0 return GLOBUS_SUCCESS;
809 }
810 else
811 {
812 xsd_QName * element;
813 0 globus_result_t result = GLOBUS_SUCCESS;
814
815 0 element = globus_hashtable_first(&handle->mustUnderstand_hash);
816
817 0 while(element)
818 {
819 0 result = GlobusSoapMessageErrorMustUnderstand(
820 result, element);
821 0 element = globus_hashtable_next(&handle->mustUnderstand_hash);
822 }
823
824 0 return result;
825 }
826 }
827
828 globus_result_t
829 globus_soap_message_deserialize_body(
830 globus_soap_message_handle_t handle)
831 5195 {
832 const xmlChar * local;
833 const xmlChar * soap_body;
834 xsd_QName local_qn;
835 5195 globus_result_t result = GLOBUS_SUCCESS;
836
837 GlobusFuncName(globus_soap_message_deserialize_body);
838 5195 GlobusSoapMessageDebugEnter();
839
840 5195 result = globus_i_soap_message_deserialize_next_element(handle);
841 5195 if(result != GLOBUS_SUCCESS)
842 {
843 0 result = GlobusSoapMessageErrorDeserializeFailed(
844 result, &soap_body_qname);
845 0 goto exit;
846 }
847
848 5195 soap_body = xmlTextReaderConstString(handle->reader, SOAP_BODY);
849 5195 local = xmlTextReaderConstLocalName(handle->reader);
850 5195 if(soap_body != local)
851 {
852 0 if (handle->verbose)
853 {
854 0 local_qn.Namespace = (char *)
855 xmlTextReaderNamespaceUri(handle->reader);
856 0 local_qn.local = (char *) local;
857 }
858
859 0 result = GlobusSoapMessageErrorElementNotFound(
860 handle->verbose,
861 &soap_body_qname,
862 &local_qn);
863 goto exit;
864 }
865
866 5195 exit:
867
868 5195 GlobusSoapMessageDebugExit();
869 5195 return result;
870 }
871
872 globus_result_t
873 globus_soap_message_deserialize_fault(
874 globus_soap_message_handle_t handle,
875 globus_soap_message_fault_t * soap_fault_handle,
876 globus_soap_fault_callback_func_t fault_callback,
877 xsd_any ** fault_any,
878 void * user_data)
879 3064 {
880 const xmlChar * local;
881 const xmlChar * soap_fault;
882 const xmlChar * element_name;
883 const xmlChar * faultcode_name;
884 const xmlChar * faultstring_name;
885 const xmlChar * faultactor_name;
886 const xmlChar * detail_name;
887 globus_xml_buffer * detail_buffer;
888 3064 globus_result_t result = GLOBUS_SUCCESS;
889 3064 globus_soap_message_fault_t fault = NULL;
890
891 GlobusFuncName(globus_soap_message_deserialize_fault);
892 3064 GlobusSoapMessageDebugEnter();
893
894 3064 result = globus_i_soap_message_deserialize_next_element(handle);
895 3064 if(result != GLOBUS_SUCCESS)
896 {
897 0 result = GlobusSoapMessageErrorDeserializeFailed(
898 result, &soap_fault_qname);
899 0 goto exit;
900 }
901
902 3064 soap_fault = xmlTextReaderConstString(handle->reader, SOAP_FAULT);
903 3064 local = xmlTextReaderConstLocalName(handle->reader);
904 3064 if(soap_fault != local)
905 {
906 2994 globus_soap_message_deserialize_push_element(handle);
907 2994 goto exit;
908 }
909
910 70 globus_soap_message_fault_init(&fault);
911
912 70 faultcode_name = xmlTextReaderConstString(
913 handle->reader, SOAP_FAULTCODE);
914 70 faultactor_name = xmlTextReaderConstString(
915 handle->reader, SOAP_FAULTACTOR);
916 70 faultstring_name = xmlTextReaderConstString(
917 handle->reader, SOAP_FAULTSTRING);
918 70 detail_name = xmlTextReaderConstString(
919 handle->reader, SOAP_FAULT_DETAIL);
920
921 280 while(result == GLOBUS_SUCCESS)
922 {
923 210 result = globus_i_soap_message_deserialize_next_element(handle);
924 210 if(result != GLOBUS_SUCCESS)
925 {
926 4 if(GlobusSoapMessageStatusFailedElementCheck(result) ||
927 GlobusSoapMessageStatusFailedWithTextCheck(result))
928 {
929 4 globus_soap_message_deserialize_push_element(handle);
930 4 result = GLOBUS_SUCCESS;
931 4 break;
932 }
933
934 0 result = GlobusSoapMessageErrorDeserializeFailed(
935 result, &soap_fault_qname);
936 0 goto exit;
937 }
938
939 206 element_name = xmlTextReaderConstLocalName(handle->reader);
940 206 if(element_name == faultcode_name)
941 {
942 70 result = globus_i_soap_message_deserialize_next_content(handle);
943 70 if(result != GLOBUS_SUCCESS)
944 {
945 0 result = GlobusSoapMessageErrorDeserializeFailed(
946 result, &soap_fault_qname);
947 0 goto exit;
948 }
949
950 70 fault->faultcode =
951 xmlTextReaderValue(handle->reader);
952 }
953 136 else if(element_name == faultstring_name)
954 {
955 70 result = globus_i_soap_message_deserialize_next_content(handle);
956 70 if(result != GLOBUS_SUCCESS)
957 {
958 0 result = GlobusSoapMessageErrorDeserializeFailed(
959 result, &soap_faultstring_qname);
960 0 goto exit;
961 }
962
963 70 fault->faultstring =
964 xmlTextReaderValue(handle->reader);
965 }
966 66 else if(element_name == faultactor_name)
967 {
968 0 result = globus_i_soap_message_deserialize_next_content(handle);
969 0 if(result != GLOBUS_SUCCESS)
970 {
971 0 result = GlobusSoapMessageErrorDeserializeFailed(
972 result, &soap_fault_qname);
973 0 goto exit;
974 }
975
976 0 fault->faultactor =
977 xmlTextReaderValue(handle->reader);
978 }
979 66 else if(element_name == detail_name)
980 {
981 66 xsd_any * dummy_any = NULL;
982 xsd_QName fault_qname;
983
984 66 result = globus_soap_message_deserialize_element_unknown(
985 handle, &fault_qname);
986 66 if(result != GLOBUS_SUCCESS)
987 {
988 0 result = GlobusSoapMessageErrorDeserializeFailed(
989 result, &soap_fault_detail_qname);
990 0 goto exit;
991 }
992
993 66 globus_soap_message_deserialize_push_element(handle);
994
995 66 globus_soap_message_set_marker(handle, "FAULT_DETAIL_BEGIN");
996
997 66 xsd_any_init(fault_any);
998
999 66 result = xsd_any_deserialize(
1000 NULL, (*fault_any), handle, 0);
1001 66 if(result != GLOBUS_SUCCESS)
1002 {
1003 0 result = GlobusSoapMessageErrorDeserializeFailed(
1004 result, &soap_fault_detail_qname);
1005 0 goto exit;
1006 }
1007
1008 66 globus_soap_message_set_marker(handle, "FAULT_DETAIL_END");
1009
1010 66 xsd_any_init(&fault->detail);
1011 66 fault->detail->any_info = (&globus_xml_buffer_contents_info);
1012
1013 66 globus_xml_buffer_init(&detail_buffer);
1014 66 result = globus_soap_message_get_marked_buffers(
1015 handle,
1016 "FAULT_DETAIL_BEGIN",
1017 "FAULT_DETAIL_END",
1018 &detail_buffer->buffer,
1019 (size_t *)&detail_buffer->length);
1020 66 if(result != GLOBUS_SUCCESS)
1021 {
1022 0 globus_xml_buffer_destroy(detail_buffer);
1023 0 result = GlobusSoapMessageErrorDeserializeFailed(
1024 result, &soap_fault_detail_qname);
1025 0 goto exit;
1026 }
1027
1028 66 fault->detail->value = detail_buffer;
1029
1030 66 fault_callback(handle,
1031 (*fault_any)->any_info->type,
1032 user_data,
1033 NULL);
1034
1035 do
1036 {
1037 67 result = xsd_any_deserialize_pointer(
1038 NULL, &dummy_any, handle, 0);
1039 67 if(result != GLOBUS_SUCCESS)
1040 {
1041 66 if(GlobusSoapMessageStatusFailedElementCheck(result))
1042 {
1043 66 result = GLOBUS_SUCCESS;
1044 66 goto exit;
1045 }
1046
1047 0 result = GlobusSoapMessageErrorDeserializeFailed(
1048 result, &soap_fault_detail_qname);
1049 0 goto exit;
1050 }
1051 1 xsd_any_destroy(dummy_any);
1052 1 dummy_any = NULL;
1053
1054 1 } while(result == GLOBUS_SUCCESS);
1055
1056 break;
1057 }
1058 else
1059 {
1060 0 result = GlobusSoapMessageErrorUnexpectedElement(
1061 &soap_fault_qname);
1062 0 goto exit;
1063 }
1064
1065 140 result = globus_soap_message_deserialize_element_end(
1066 handle,
1067 &soap_fault_qname);
1068 140 if(result != GLOBUS_SUCCESS)
1069 {
1070 0 result = GlobusSoapMessageErrorDeserializeFailed(
1071 result, &soap_fault_qname);
1072 0 goto exit;
1073 }
1074 }
1075
1076 3064 exit:
1077
1078 3064 *soap_fault_handle = fault;
1079
1080 3064 GlobusSoapMessageDebugExit();
1081 3064 return result;
1082 }
1083
1084 globus_bool_t
1085 globus_soap_message_deserialize_element_is_nil(
1086 globus_soap_message_handle_t handle)
1087 4725 {
1088 xmlChar * nil_value;
1089 GlobusFuncName(globus_soap_message_deserialize_element_is_nil);
1090 4725 GlobusSoapMessageDebugEnter();
1091
1092 4725 nil_value = xmlTextReaderGetAttributeNs(
1093 handle->reader,
1094 XSI_NIL,
1095 XSI_NS);
1096 4725 if(nil_value && !(xmlStrcmp(nil_value, "true")))
1097 {
1098 0 xmlFree(nil_value);
1099 0 return GLOBUS_TRUE;
1100 }
1101
1102 4725 if(!nil_value)
1103 {
1104 4725 xmlFree(nil_value);
1105 }
1106
1107 4725 return GLOBUS_FALSE;
1108 }
1109
1110 globus_result_t
1111 globus_soap_message_deserialize_element_unknown(
1112 globus_soap_message_handle_t handle,
1113 xsd_QName * qname)
1114 32130 {
1115 32130 globus_result_t result = GLOBUS_SUCCESS;
1116
1117 GlobusFuncName(globus_soap_message_deserialize_element);
1118 32130 GlobusSoapMessageDebugEnter();
1119
1120 32130 result = globus_i_soap_message_deserialize_next_element(handle);
1121 32130 if(result != GLOBUS_SUCCESS)
1122 {
1123 5450 xsd_QName * q = NULL;
1124
1125 5450 if(GlobusSoapMessageStatusFailedElementCheck(result) ||
1126 GlobusSoapMessageStatusFailedWithTextCheck(result))
1127 {
1128 5450 globus_soap_message_deserialize_push_element(handle);
1129 5450 goto exit;
1130 }
1131 else
1132 {
1133 0 result = GlobusSoapMessageErrorDeserializeFailed(
1134 result, q);
1135 }
1136 0 goto exit;
1137 }
1138
1139 26680 qname->local = xmlTextReaderLocalName(handle->reader);
1140 26680 qname->Namespace = xmlTextReaderNamespaceUri(handle->reader);
1141
1142 32130 exit:
1143
1144 32130 GlobusSoapMessageDebugExit();
1145 32130 return result;
1146 }
1147
1148 globus_bool_t
1149 globus_soap_message_deserialize_element_is_empty(
1150 globus_soap_message_handle_t handle)
1151 4057 {
1152 4057 return ((handle->next_ready == 0) &&
1153 xmlTextReaderIsEmptyElement(handle->reader));
1154 }
1155
1156 globus_result_t
1157 globus_soap_message_deserialize_element(
1158 globus_soap_message_handle_t handle,
1159 const xsd_QName * qname)
1160 2032684 {
1161 const xmlChar * local;
1162 const xmlChar * local_ns;
1163 const xmlChar * element;
1164 const xmlChar * element_ns;
1165 xsd_QName local_qn;
1166 2032684 globus_result_t result = GLOBUS_SUCCESS;
1167
1168 GlobusFuncName(globus_soap_message_deserialize_element);
1169 2032684 GlobusSoapMessageDebugEnter();
1170
1171 2032684 result = globus_i_soap_message_deserialize_next_element(handle);
1172 2032684 if(result != GLOBUS_SUCCESS)
1173 {
1174 20522 if(GlobusSoapMessageStatusFailedElementCheck(result) ||
1175 GlobusSoapMessageStatusFailedWithTextCheck(result))
1176 {
1177 20522 if (!xmlTextReaderIsEmptyElement(handle->reader))
1178 {
1179 20504 globus_soap_message_deserialize_push_element(handle);
1180 }
1181
1182 goto exit;
1183 }
1184 else
1185 {
1186 0 result = GlobusSoapMessageErrorDeserializeFailed(
1187 result, qname);
1188 }
1189 0 goto exit;
1190 }
1191
1192 2012162 if(qname)
1193 {
1194 1266473 element = xmlTextReaderConstString(handle->reader, qname->local);
1195 1266473 local = xmlTextReaderConstString(
1196 handle->reader, xmlTextReaderConstLocalName(handle->reader));
1197 1266473 if(element != local)
1198 {
1199 82 if (handle->verbose)
1200 {
1201 0 local_qn.Namespace = (char *) xmlTextReaderConstString(
1202 handle->reader,
1203 xmlTextReaderConstNamespaceUri(handle->reader));
1204 0 local_qn.local = (char *) local;
1205 }
1206 82 globus_soap_message_deserialize_push_element(handle);
1207
1208 82 result = GlobusSoapMessageErrorElementNotFound(
1209 handle->verbose,
1210 qname,
1211 &local_qn);
1212 82 goto exit;
1213 }
1214
1215 1266391 element_ns = xmlTextReaderConstString(
1216 handle->reader, qname->Namespace);
1217 1266391 local_ns = xmlTextReaderConstString(
1218 handle->reader, xmlTextReaderConstNamespaceUri(handle->reader));
1219 1266391 if(local_ns && element_ns != local_ns)
1220 {
1221 0 if (handle->verbose)
1222 {
1223 0 local_qn.Namespace = (char *) local_ns;
1224 0 local_qn.local = (char *) local;
1225 }
1226 0 result = GlobusSoapMessageErrorElementNotFound(
1227 handle->verbose,
1228 qname,
1229 &local_qn);
1230 goto exit;
1231 }
1232 }
1233
1234 2032684 exit:
1235
1236 2032684 GlobusSoapMessageDebugExit();
1237 2032684 return result;
1238 }
1239
1240 globus_result_t
1241 globus_soap_message_deserialize_anyURI(
1242 globus_soap_message_handle_t handle,
1243 xsd_anyURI * str)
1244 21792 {
1245 const xmlChar * constval;
1246 21792 globus_result_t result = GLOBUS_SUCCESS;
1247 int start_token, end_token;
1248 GlobusFuncName(globus_soap_message_deserialize_anyURI);
1249 21792 GlobusSoapMessageDebugEnter();
1250
1251 21792 result = globus_i_soap_message_deserialize_next_content(handle);
1252 21792 if(result != GLOBUS_SUCCESS)
1253 {
1254 0 result = GlobusSoapMessageErrorDeserializeFailed(
1255 result, &xsd_string_qname);
1256 0 goto exit;
1257 }
1258
1259 21792 constval = xmlTextReaderConstValue(handle->reader);
1260 21792 if(constval)
1261 {
1262 21792 *str = globus_l_soap_message_my_strtok(
1263 constval, strlen(constval), &start_token, &end_token, "\n\t ");
1264 21792 if (*str == NULL)
1265 {
1266 0 result = GlobusSoapMessageErrorDeserializeFailed(
1267 result, &xsd_anyURI_qname);
1268 0 goto exit;
1269 }
1270 }
1271 else
1272 {
1273 0 *str = NULL;
1274 }
1275
1276 21792 exit:
1277
1278 21792 GlobusSoapMessageDebugExit();
1279 21792 return result;
1280 }
1281
1282 globus_result_t
1283 globus_soap_message_deserialize_string(
1284 globus_soap_message_handle_t handle,
1285 xsd_string * str)
1286 2539 {
1287 2539 globus_result_t result = GLOBUS_SUCCESS;
1288 GlobusFuncName(globus_soap_message_deserialize_string);
1289 2539 GlobusSoapMessageDebugEnter();
1290
1291 2539 result = globus_i_soap_message_deserialize_next_content(handle);
1292 2539 if(result != GLOBUS_SUCCESS)
1293 {
1294 0 result = GlobusSoapMessageErrorDeserializeFailed(
1295 result, &xsd_string_qname);
1296 0 goto exit;
1297 }
1298
1299 2539 *str = (xsd_string) xmlTextReaderValue(handle->reader);
1300
1301 2539 exit:
1302
1303 2539 GlobusSoapMessageDebugExit();
1304 2539 return result;
1305 }
1306
1307 globus_result_t
1308 globus_soap_message_deserialize_string_attribute(
1309 globus_soap_message_handle_t handle,
1310 const xsd_QName * attr_name,
1311 xsd_string * str)
1312 224 {
1313 const xmlChar * attr_ns;
1314 const xmlChar * local_ns;
1315 224 globus_result_t result = GLOBUS_SUCCESS;
1316 GlobusFuncName(globus_soap_message_deserialize_string_attribute);
1317 224 GlobusSoapMessageDebugEnter();
1318
1319 224 attr_ns = xmlTextReaderConstString(
1320 handle->reader, attr_name->Namespace);
1321 224 local_ns = xmlTextReaderConstNamespaceUri(handle->reader);
1322
1323 224 if(attr_ns != local_ns && (attr_ns != NULL) && (*attr_ns != '\0'))
1324 {
1325 0 *str = xmlTextReaderGetAttributeNs(
1326 handle->reader, attr_name->local, attr_name->Namespace);
1327 }
1328 else
1329 {
1330 224 *str = xmlTextReaderGetAttribute(
1331 handle->reader, attr_name->local);
1332 }
1333 224 if(!*str)
1334 {
1335 0 result = GlobusSoapMessageErrorAttributeNotFound(
1336 handle->verbose,
1337 attr_name);
1338 goto exit;
1339 }
1340
1341 224 exit:
1342
1343 224 GlobusSoapMessageDebugExit();
1344 224 return result;
1345 }
1346
1347
1348 globus_result_t
1349 globus_soap_message_deserialize_string_list(
1350 globus_soap_message_handle_t handle,
1351 xsd_string_array * inst)
1352 0 {
1353 0 const xmlChar * tmp_value = NULL;
1354 char * newstr;
1355 char * tmpstr;
1356 char * token;
1357 int start_token, end_token;
1358 0 xsd_string * new_element = NULL;
1359 0 globus_result_t result = GLOBUS_SUCCESS;
1360 GlobusFuncName(globus_soap_message_deserialize_string_list);
1361 0 GlobusSoapMessageDebugEnter();
1362
1363 0 result = globus_i_soap_message_deserialize_next_content(handle);
1364 0 if(result != GLOBUS_SUCCESS)
1365 {
1366 0 result = GlobusSoapMessageErrorDeserializeFailed(
1367 result, &xsd_QName_qname);
1368 0 goto exit;
1369 }
1370
1371 0 tmp_value = xmlTextReaderConstValue(handle->reader);
1372 0 if(!tmp_value)
1373 {
1374 0 result = GlobusSoapMessageErrorDeserializeFailed(
1375 result, &xsd_QName_qname);
1376 0 goto exit;
1377 }
1378
1379 0 newstr = globus_libc_strdup(tmp_value);
1380 0 tmpstr = newstr;
1381 0 token = globus_l_soap_message_my_strtok(
1382 tmpstr, strlen(tmpstr), &start_token, &end_token, "\n\t ");
1383 0 tmpstr += end_token;
1384
1385 0 while(token)
1386 {
1387 0 new_element = xsd_string_array_push(inst);
1388 0 *new_element = token;
1389
1390 0 if(end_token < 0)
1391 {
1392 0 break;
1393 }
1394
1395 0 token = globus_l_soap_message_my_strtok(
1396 tmpstr, strlen(tmpstr), &start_token, &end_token, "\n\t ");
1397 0 tmpstr += end_token;
1398 }
1399
1400 0 globus_free(newstr);
1401
1402 0 exit:
1403
1404 0 GlobusSoapMessageDebugExit();
1405 0 return result;
1406 }
1407
1408 globus_result_t
1409 globus_soap_message_deserialize_string_attribute_list(
1410 globus_soap_message_handle_t handle,
1411 const xsd_QName * attr_qname,
1412 xsd_string_array * inst)
1413 0 {
1414 0 const xmlChar * attr_ns = NULL;
1415 0 const xmlChar * local_ns = NULL;
1416 0 xmlChar * tmp_value = NULL;
1417 char * newstr;
1418 char * tmpstr;
1419 char * token;
1420 int start_token, end_token;
1421 0 xsd_string * new_element = NULL;
1422 0 globus_result_t result = GLOBUS_SUCCESS;
1423 GlobusFuncName(globus_soap_message_deserialize_string_attribute_list);
1424 0 GlobusSoapMessageDebugEnter();
1425
1426 0 attr_ns = xmlTextReaderConstString(
1427 handle->reader, attr_qname->Namespace);
1428 0 local_ns = xmlTextReaderConstNamespaceUri(handle->reader);
1429
1430 0 if(attr_ns != local_ns && (attr_ns != NULL) && (*attr_ns != '\0'))
1431 {
1432 0 tmp_value = xmlTextReaderGetAttributeNs(
1433 handle->reader, attr_qname->local, attr_qname->Namespace);
1434 }
1435 else
1436 {
1437 0 tmp_value = xmlTextReaderGetAttribute(
1438 handle->reader, attr_qname->local);
1439 }
1440
1441 0 if(!tmp_value)
1442 {
1443 0 goto exit;
1444 }
1445
1446 0 if(!(*tmp_value))
1447 {
1448 0 result = GlobusSoapMessageErrorDeserializeFailed(
1449 result, &xsd_string_qname);
1450 0 goto exit;
1451 }
1452
1453 0 newstr = globus_libc_strdup(tmp_value);
1454 0 tmpstr = newstr;
1455 0 token = globus_l_soap_message_my_strtok(
1456 tmpstr, strlen(tmpstr), &start_token, &end_token, "\n\t ");
1457 0 tmpstr += end_token;
1458
1459 0 while(token)
1460 {
1461 0 new_element = xsd_string_array_push(inst);
1462 0 *new_element = token;
1463
1464 0 if(end_token < 0)
1465 {
1466 0 break;
1467 }
1468
1469 0 token = globus_l_soap_message_my_strtok(
1470 tmpstr, strlen(tmpstr), &start_token, &end_token, "\n\t ");
1471 0 tmpstr += end_token;
1472 }
1473
1474 0 globus_free(newstr);
1475
1476 0 exit:
1477
1478 0 if(tmp_value)
1479 {
1480 0 xmlFree(tmp_value);
1481 }
1482
1483 0 GlobusSoapMessageDebugExit();
1484 0 return result;
1485 }
1486
1487 globus_result_t
1488 globus_soap_message_deserialize_duration_attribute(
1489 globus_soap_message_handle_t handle,
1490 const xsd_QName * attr_name,
1491 xsd_duration * val)
1492 0 {
1493 const xmlChar * attr_ns;
1494 const xmlChar * local_ns;
1495 xmlChar * tmp_value;
1496 0 xmlSchemaValPtr schema_val = NULL;
1497 int res;
1498 0 globus_result_t result = GLOBUS_SUCCESS;
1499 GlobusFuncName(globus_soap_message_deserialize_duration_attribute);
1500 0 GlobusSoapMessageDebugEnter();
1501
1502 0 attr_ns = xmlTextReaderConstString(
1503 handle->reader, attr_name->Namespace);
1504 0 local_ns = xmlTextReaderConstNamespaceUri(handle->reader);
1505
1506 0 if(attr_ns != local_ns && (attr_ns != NULL) && (*attr_ns != '\0'))
1507 {
1508 0 tmp_value = xmlTextReaderGetAttributeNs(
1509 handle->reader, attr_name->local, attr_name->Namespace);
1510 }
1511 else
1512 {
1513 0 tmp_value = xmlTextReaderGetAttribute(
1514 handle->reader, attr_name->local);
1515 }
1516
1517 0 if(!tmp_value)
1518 {
1519 0 result = GlobusSoapMessageErrorAttributeNotFound(
1520 handle->verbose,
1521 attr_name);
1522 0 goto exit;
1523 }
1524
1525 0 res = xmlSchemaValidatePredefinedType(
1526 xmlSchemaGetBuiltInType(XML_SCHEMAS_DURATION),
1527 tmp_value,
1528 &schema_val);
1529 0 if(res != 0)
1530 {
1531 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
1532 &xsd_duration_qname, tmp_value);
1533 0 goto exit;
1534 }
1535
1536 0 val->tm_mon = schema_val->value.date.mon - 1;
1537 0 val->tm_mday = schema_val->value.date.day;
1538 0 val->tm_sec = (int) schema_val->value.date.sec;
1539
1540 0 xmlSchemaFreeValue(schema_val);
1541
1542 0 exit:
1543
1544 0 if(tmp_value)
1545 {
1546 0 xmlFree(tmp_value);
1547 }
1548
1549 0 GlobusSoapMessageDebugExit();
1550 0 return result;
1551 }
1552
1553 globus_result_t
1554 globus_soap_message_deserialize_dateTime_attribute(
1555 globus_soap_message_handle_t handle,
1556 const xsd_QName * attr_name,
1557 xsd_dateTime * val)
1558 0 {
1559 const xmlChar * attr_ns;
1560 const xmlChar * local_ns;
1561 0 xmlChar * tmp_value = NULL;
1562 0 xmlSchemaValPtr schema_val = NULL;
1563 int res;
1564 0 globus_result_t result = GLOBUS_SUCCESS;
1565 GlobusFuncName(globus_soap_message_deserialize_dateTime_attribute);
1566 0 GlobusSoapMessageDebugEnter();
1567
1568 0 attr_ns = xmlTextReaderConstString(
1569 handle->reader, attr_name->Namespace);
1570 0 local_ns = xmlTextReaderConstNamespaceUri(handle->reader);
1571
1572 0 if(attr_ns != local_ns && (attr_ns != NULL) && (*attr_ns != '\0'))
1573 {
1574 0 tmp_value = xmlTextReaderGetAttributeNs(
1575 handle->reader, attr_name->local, attr_name->Namespace);
1576 }
1577 else
1578 {
1579 0 tmp_value = xmlTextReaderGetAttribute(
1580 handle->reader, attr_name->local);
1581 }
1582 0 if(!tmp_value)
1583 {
1584 0 result = GlobusSoapMessageErrorAttributeNotFound(
1585 handle->verbose,
1586 attr_name);
1587 0 goto exit;
1588 }
1589
1590 0 res = xmlSchemaValidatePredefinedType(
1591 xmlSchemaGetBuiltInType(XML_SCHEMAS_DATETIME),
1592 tmp_value,
1593 &schema_val);
1594 0 if(res != 0)
1595 {
1596 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
1597 &xsd_dateTime_qname, tmp_value);
1598 0 goto exit;
1599 }
1600
1601 0 val->tm_year = schema_val->value.date.year - 1900;
1602 0 val->tm_mon = schema_val->value.date.mon;
1603 0 val->tm_mday = schema_val->value.date.day;
1604 0 val->tm_hour = schema_val->value.date.hour;
1605 0 val->tm_min = schema_val->value.date.min;
1606 0 val->tm_sec = schema_val->value.date.sec;
1607 0 if(schema_val->value.date.tz_flag)
1608 {
1609 0 val->tm_min += schema_val->value.date.tzo;
1610 }
1611
1612 0 xmlSchemaFreeValue(schema_val);
1613
1614 0 exit:
1615
1616 0 if(tmp_value)
1617 {
1618 0 xmlFree(tmp_value);
1619 }
1620
1621 0 GlobusSoapMessageDebugExit();
1622 0 return result;
1623 }
1624
1625 globus_result_t
1626 globus_soap_message_deserialize_date_attribute(
1627 globus_soap_message_handle_t handle,
1628 const xsd_QName * attr_name,
1629 xsd_date * val)
1630 0 {
1631 const xmlChar * attr_ns;
1632 const xmlChar * local_ns;
1633 0 xmlChar * tmp_value = NULL;
1634 0 xmlSchemaValPtr schema_val = NULL;
1635 int res;
1636 0 globus_result_t result = GLOBUS_SUCCESS;
1637 GlobusFuncName(globus_soap_message_deserialize_date_attribute);
1638 0 GlobusSoapMessageDebugEnter();
1639
1640 0 attr_ns = xmlTextReaderConstString(
1641 handle->reader, attr_name->Namespace);
1642 0 local_ns = xmlTextReaderConstNamespaceUri(handle->reader);
1643
1644 0 if(attr_ns != local_ns && (attr_ns != NULL) && (*attr_ns != '\0'))
1645 {
1646 0 tmp_value = xmlTextReaderGetAttributeNs(
1647 handle->reader, attr_name->local, attr_name->Namespace);
1648 }
1649 else
1650 {
1651 0 tmp_value = xmlTextReaderGetAttribute(
1652 handle->reader, attr_name->local);
1653 }
1654 0 if(!tmp_value)
1655 {
1656 0 result = GlobusSoapMessageErrorAttributeNotFound(
1657 handle->verbose,
1658 attr_name);
1659 0 goto exit;
1660 }
1661
1662
1663 0 res = xmlSchemaValidatePredefinedType(
1664 xmlSchemaGetBuiltInType(XML_SCHEMAS_DATE),
1665 tmp_value,
1666 &schema_val);
1667 0 if(res != 0)
1668 {
1669 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
1670 &xsd_date_qname, tmp_value);
1671 0 goto exit;
1672 }
1673
1674 0 val->tm_year = schema_val->value.date.year - 1900;
1675 0 val->tm_mon = schema_val->value.date.mon - 1;
1676 0 val->tm_mday = schema_val->value.date.day;
1677
1678 0 xmlSchemaFreeValue(schema_val);
1679
1680 0 exit:
1681
1682 0 if(tmp_value)
1683 {
1684 0 xmlFree(tmp_value);
1685 }
1686
1687 0 GlobusSoapMessageDebugExit();
1688 0 return result;
1689 }
1690
1691 globus_result_t
1692 globus_soap_message_deserialize_int_attribute(
1693 globus_soap_message_handle_t handle,
1694 const xsd_QName * attr_name,
1695 xsd_int * val)
1696 23804 {
1697 const xmlChar * attr_ns;
1698 const xmlChar * local_ns;
1699 xmlChar * tmp_value;
1700 23804 globus_result_t result = GLOBUS_SUCCESS;
1701 GlobusFuncName(globus_soap_message_deserialize_int_attribute);
1702 23804 GlobusSoapMessageDebugEnter();
1703
1704 23804 attr_ns = xmlTextReaderConstString(
1705 handle->reader, attr_name->Namespace);
1706 23804 local_ns = xmlTextReaderConstNamespaceUri(handle->reader);
1707
1708 47608 if(attr_ns != local_ns && (attr_ns != NULL) && (*attr_ns != '\0'))
1709 {
1710 23804 tmp_value = xmlTextReaderGetAttributeNs(
1711 handle->reader, attr_name->local, attr_name->Namespace);
1712 }
1713 else
1714 {
1715 0 tmp_value = xmlTextReaderGetAttribute(
1716 handle->reader, attr_name->local);
1717 }
1718 23804 if(!tmp_value)
1719 {
1720 19045 result = GlobusSoapMessageErrorAttributeNotFound(
1721 handle->verbose,
1722 attr_name);
1723 19045 goto exit;
1724 }
1725
1726 4759 *val = strtol((const char *)tmp_value, NULL, 0);
1727 4759 if(*val == INT32_MAX || *val == INT32_MIN)
1728 {
1729 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
1730 &xsd_int_qname, tmp_value);
1731 goto exit;
1732 }
1733
1734 23804 exit:
1735
1736 23804 if(tmp_value)
1737 {
1738 4759 xmlFree(tmp_value);
1739 }
1740
1741 23804 GlobusSoapMessageDebugExit();
1742 23804 return result;
1743 }
1744
1745 globus_result_t
1746 globus_soap_message_deserialize_integer_attribute(
1747 globus_soap_message_handle_t handle,
1748 const xsd_QName * attr_name,
1749 xsd_integer * val)
1750 0 {
1751 int rc;
1752 0 xmlChar * tmp_value = NULL;
1753 0 char * tmp = NULL;
1754 char * tmp_start;
1755 char * tmp_end;
1756 0 globus_result_t result = GLOBUS_SUCCESS;
1757 GlobusFuncName(globus_soap_message_deserialize_integer_attribute);
1758 0 GlobusSoapMessageDebugEnter();
1759
1760 0 tmp_value = xmlTextReaderGetAttributeNs(
1761 handle->reader, attr_name->local, attr_name->Namespace);
1762 0 if(!tmp_value)
1763 {
1764 0 result = GlobusSoapMessageErrorDeserializeFailed(
1765 result, &xsd_integer_qname);
1766 0 goto exit;
1767 }
1768
1769 0 tmp = globus_libc_strdup(tmp_value);
1770 0 tmp_start = tmp;
1771
1772 0 while(*tmp_start && isspace(*tmp_start))
1773 {
1774 0 tmp_start++;
1775 }
1776 0 if (*tmp_start == '+')
1777 {
1778 0 tmp_start++;
1779 }
1780 0 if (*tmp_start != '-' && !isdigit(*tmp_start))
1781 {
1782 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
1783 &xsd_integer_qname, tmp_value);
1784 0 goto exit;
1785 }
1786 0 tmp_end = tmp_start;
1787
1788 0 if (*tmp_end == '-')
1789 {
1790 0 tmp_end++;
1791 }
1792 0 while (*tmp_end && isdigit(*tmp_end))
1793 {
1794 0 tmp_end++;
1795 }
1796
1797 0 if (*tmp_end && isspace(*tmp_end))
1798 {
1799 0 *tmp_end = '\0';
1800 0 tmp_end++;
1801 }
1802 0 while (*tmp_end && isspace(*tmp_end))
1803 {
1804 0 tmp_end++;
1805 }
1806 0 if (*tmp_end)
1807 {
1808 /* garbage at end */
1809 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
1810 &xsd_integer_qname, tmp_value);
1811 0 goto exit;
1812 }
1813 0 rc = BN_dec2bn(val, tmp_start);
1814 0 if (rc == 0)
1815 {
1816 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
1817 &xsd_integer_qname, tmp_value);
1818 goto exit;
1819 }
1820
1821 0 exit:
1822
1823 0 if(tmp_value)
1824 {
1825 0 xmlFree(tmp_value);
1826 }
1827 0 if(tmp)
1828 {
1829 0 free(tmp);
1830 }
1831
1832 0 GlobusSoapMessageDebugExit();
1833 0 return result;
1834 }
1835
1836 globus_result_t
1837 globus_soap_message_deserialize_long_attribute(
1838 globus_soap_message_handle_t handle,
1839 const xsd_QName * attr_name,
1840 xsd_long * val)
1841 0 {
1842 const xmlChar * attr_ns;
1843 const xmlChar * local_ns;
1844 xmlChar * tmp_value;
1845 0 globus_result_t result = GLOBUS_SUCCESS;
1846 GlobusFuncName(globus_soap_message_deserialize_long_attribute);
1847 0 GlobusSoapMessageDebugEnter();
1848
1849 0 attr_ns = xmlTextReaderConstString(
1850 handle->reader, attr_name->Namespace);
1851 0 local_ns = xmlTextReaderConstNamespaceUri(handle->reader);
1852
1853 0 if(attr_ns != local_ns && (attr_ns != NULL) && (*attr_ns != '\0'))
1854 {
1855 0 tmp_value = xmlTextReaderGetAttributeNs(
1856 handle->reader, attr_name->local, attr_name->Namespace);
1857 }
1858 else
1859 {
1860 0 tmp_value = xmlTextReaderGetAttribute(
1861 handle->reader, attr_name->local);
1862 }
1863 0 if(!tmp_value)
1864 {
1865 0 result = GlobusSoapMessageErrorAttributeNotFound(
1866 handle->verbose,
1867 attr_name);
1868 0 goto exit;
1869 }
1870
1871 0 *val = strtoll(tmp_value, NULL, 0);
1872 0 if(*val == INT64_MAX || *val == INT64_MIN)
1873 {
1874 0 if(errno == ERANGE)
1875 {
1876 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
1877 &xsd_long_qname, tmp_value);
1878 goto exit;
1879 }
1880 }
1881
1882 0 exit:
1883
1884 0 if(tmp_value)
1885 {
1886 0 xmlFree(tmp_value);
1887 }
1888
1889 0 GlobusSoapMessageDebugExit();
1890 0 return result;
1891 }
1892
1893 globus_result_t
1894 globus_soap_message_deserialize_float_attribute(
1895 globus_soap_message_handle_t handle,
1896 const xsd_QName * attr_name,
1897 xsd_float * val)
1898 0 {
1899 const xmlChar * attr_ns;
1900 const xmlChar * local_ns;
1901 0 xmlChar * tmp_value = NULL;
1902 0 globus_result_t result = GLOBUS_SUCCESS;
1903 GlobusFuncName(globus_soap_message_deserialize_float_attribute);
1904 0 GlobusSoapMessageDebugEnter();
1905
1906 0 attr_ns = xmlTextReaderConstString(
1907 handle->reader, attr_name->Namespace);
1908 0 local_ns = xmlTextReaderConstNamespaceUri(handle->reader);
1909
1910 0 if(attr_ns != local_ns && (attr_ns != NULL) && (*attr_ns != '\0'))
1911 {
1912 0 tmp_value = xmlTextReaderGetAttributeNs(
1913 handle->reader, attr_name->local, attr_name->Namespace);
1914 }
1915 else
1916 {
1917 0 tmp_value = xmlTextReaderGetAttribute(
1918 handle->reader, attr_name->local);
1919 }
1920 0 if(!tmp_value)
1921 {
1922 0 result = GlobusSoapMessageErrorAttributeNotFound(
1923 handle->verbose,
1924 attr_name);
1925 0 goto exit;
1926 }
1927
1928 0 *val = (float) strtod(tmp_value, NULL);
1929
1930 0 exit:
1931
1932 0 if(tmp_value)
1933 {
1934 0 xmlFree(tmp_value);
1935 }
1936
1937 0 GlobusSoapMessageDebugExit();
1938 0 return result;
1939 }
1940
1941 globus_result_t
1942 globus_soap_message_deserialize_base64Binary_attribute(
1943 globus_soap_message_handle_t handle,
1944 const xsd_QName * attr_qname,
1945 xsd_base64Binary * val)
1946 0 {
1947 0 xmlChar * tmp_value = NULL;
1948 int length;
1949 0 globus_result_t result = GLOBUS_SUCCESS;
1950
1951 GlobusFuncName(globus_soap_message_deserialize_base64Binary_attribute);
1952 0 GlobusSoapMessageDebugEnter();
1953
1954 0 tmp_value = xmlTextReaderGetAttributeNs(
1955 handle->reader, attr_qname->local, attr_qname->Namespace);
1956 0 if(!tmp_value)
1957 {
1958 0 result = GlobusSoapMessageErrorDeserializeFailed(
1959 result, &xsd_float_qname);
1960 0 goto exit;
1961 }
1962
1963 0 length = strlen(tmp_value);
1964
1965 0 val->length = (int)ceil((length * 3) / 4) + 1;
1966 0 val->value = globus_malloc(val->length);
1967 0 if(!val->value)
1968 {
1969 0 result = GlobusSoapMessageErrorOutOfMemory;
1970 0 goto exit;
1971 }
1972
1973 0 if(xmlBase64Decode(
1974 tmp_value,
1975 (unsigned long *)&length,
1976 val->value,
1977 (unsigned long *)&val->length) < 0)
1978 {
1979 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
1980 attr_qname, tmp_value);
1981 goto exit;
1982 }
1983
1984 0 exit:
1985
1986 0 if(tmp_value)
1987 {
1988 0 xmlFree(tmp_value);
1989 }
1990
1991 0 GlobusSoapMessageDebugExit();
1992 0 return result;
1993 }
1994
1995 globus_result_t
1996 globus_soap_message_deserialize_boolean(
1997 globus_soap_message_handle_t handle,
1998 xsd_boolean * val)
1999 1 {
2000 1 const xmlChar * tmp_value = NULL;
2001 1 globus_result_t result = GLOBUS_SUCCESS;
2002
2003 GlobusFuncName(globus_soap_message_deserialize_boolean);
2004 1 GlobusSoapMessageDebugEnter();
2005
2006 1 result = globus_i_soap_message_deserialize_next_content(handle);
2007 1 if(result != GLOBUS_SUCCESS)
2008 {
2009 0 result = GlobusSoapMessageErrorDeserializeFailed(
2010 result, &xsd_boolean_qname);
2011 0 goto exit;
2012 }
2013
2014 1 tmp_value = xmlTextReaderConstValue(handle->reader);
2015 1 if(!tmp_value)
2016 {
2017 0 result = GlobusSoapMessageErrorDeserializeFailed(
2018 GLOBUS_SUCCESS, &xsd_boolean_qname);
2019 0 goto exit;
2020 }
2021
2022 1 if(!xmlStrcmp(tmp_value, "false"))
2023 {
2024 0 *val = 0;
2025 }
2026 else
2027 {
2028 1 *val = 1;
2029 }
2030
2031 1 exit:
2032
2033 1 GlobusSoapMessageDebugExit();
2034 1 return result;
2035 }
2036
2037 globus_result_t
2038 globus_soap_message_deserialize_boolean_attribute(
2039 globus_soap_message_handle_t handle,
2040 const xsd_QName * attr_name,
2041 xsd_boolean * val)
2042 60 {
2043 const xmlChar * attr_ns;
2044 const xmlChar * local_ns;
2045 xmlChar * tmp_value;
2046 60 globus_result_t result = GLOBUS_SUCCESS;
2047
2048 GlobusFuncName(globus_soap_message_deserialize_boolean_attribute);
2049 60 GlobusSoapMessageDebugEnter();
2050
2051 60 attr_ns = xmlTextReaderConstString(
2052 handle->reader, attr_name->Namespace);
2053 60 local_ns = xmlTextReaderConstNamespaceUri(handle->reader);
2054
2055 60 if(attr_ns != local_ns && (attr_ns != NULL) && (*attr_ns != '\0'))
2056 {
2057 0 tmp_value = xmlTextReaderGetAttributeNs(
2058 handle->reader, attr_name->local, attr_name->Namespace);
2059 }
2060 else
2061 {
2062 60 tmp_value = xmlTextReaderGetAttribute(
2063 handle->reader, attr_name->local);
2064 }
2065 60 if(!tmp_value)
2066 {
2067 24 result = GlobusSoapMessageErrorAttributeNotFound(
2068 handle->verbose,
2069 attr_name);
2070 24 goto exit;
2071 }
2072
2073 36 if(!xmlStrcmp(tmp_value, "false"))
2074 {
2075 12 *val = 0;
2076 }
2077 else
2078 {
2079 24 *val = 1;
2080 }
2081
2082 60 exit:
2083
2084 60 if(tmp_value)
2085 {
2086 36 xmlFree(tmp_value);
2087 }
2088
2089 60 GlobusSoapMessageDebugExit();
2090 60 return result;
2091 }
2092
2093 globus_result_t
2094 globus_soap_message_deserialize_dateTime(
2095 globus_soap_message_handle_t handle,
2096 xsd_dateTime * val)
2097 740059 {
2098 740059 xmlSchemaValPtr schema_val = NULL;
2099 740059 int res = 0;
2100 const xmlChar * tmp_value;
2101 740059 globus_result_t result = GLOBUS_SUCCESS;
2102
2103 GlobusFuncName(globus_soap_message_deserialize_dateTime);
2104 740059 GlobusSoapMessageDebugEnter();
2105
2106 740059 result = globus_i_soap_message_deserialize_next_content(handle);
2107 740059 if(result != GLOBUS_SUCCESS)
2108 {
2109 0 result = GlobusSoapMessageErrorDeserializeFailed(
2110 result, &xsd_dateTime_qname);
2111 0 goto exit;
2112 }
2113
2114 740059 tmp_value = xmlTextReaderConstValue(handle->reader);
2115 740059 if(!tmp_value)
2116 {
2117 0 result = GlobusSoapMessageErrorDeserializeFailed(
2118 result, &xsd_dateTime_qname);
2119 0 goto exit;
2120 }
2121
2122 740059 res = xmlSchemaValidatePredefinedType(
2123 xmlSchemaGetBuiltInType(XML_SCHEMAS_DATETIME),
2124 tmp_value,
2125 &schema_val);
2126 740059 if(res != 0)
2127 {
2128 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
2129 &xsd_dateTime_qname, tmp_value);
2130 0 goto exit;
2131 }
2132
2133 740059 val->tm_year = schema_val->value.date.year - 1900;
2134 740059 val->tm_mon = schema_val->value.date.mon - 1;
2135 740059 val->tm_mday = schema_val->value.date.day;
2136 740059 val->tm_hour = schema_val->value.date.hour;
2137 740059 val->tm_min = schema_val->value.date.min;
2138 740059 val->tm_sec = schema_val->value.date.sec;
2139 740059 if(schema_val->value.date.tz_flag)
2140 {
2141 740059 val->tm_min += schema_val->value.date.tzo;
2142 }
2143
2144 740059 xmlSchemaFreeValue(schema_val);
2145
2146 740059 exit:
2147
2148 740059 GlobusSoapMessageDebugExit();
2149 740059 return result;
2150 }
2151
2152 globus_result_t
2153 globus_soap_message_deserialize_date(
2154 globus_soap_message_handle_t handle,
2155 xsd_date * val)
2156 0 {
2157 0 int res = 0;
2158 0 xmlSchemaValPtr schema_val = NULL;
2159 const xmlChar * tmp_value;
2160 0 globus_result_t result = GLOBUS_SUCCESS;
2161
2162 GlobusFuncName(globus_soap_message_deserialize_date);
2163 0 GlobusSoapMessageDebugEnter();
2164
2165 0 result = globus_i_soap_message_deserialize_next_content(handle);
2166 0 if(result != GLOBUS_SUCCESS)
2167 {
2168 0 result = GlobusSoapMessageErrorDeserializeFailed(
2169 result, &xsd_date_qname);
2170 0 goto exit;
2171 }
2172
2173 0 tmp_value = xmlTextReaderConstValue(handle->reader);
2174 0 if(!tmp_value)
2175 {
2176 0 result = GlobusSoapMessageErrorDeserializeFailed(
2177 GLOBUS_SUCCESS, &xsd_date_qname);
2178 0 goto exit;
2179 }
2180
2181 0 res = xmlSchemaValidatePredefinedType(
2182 xmlSchemaGetBuiltInType(XML_SCHEMAS_DATE),
2183 tmp_value,
2184 &schema_val);
2185 0 if(res != 0)
2186 {
2187 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
2188 &xsd_date_qname, tmp_value);
2189 0 goto exit;
2190 }
2191
2192 0 val->tm_year = schema_val->value.date.year - 1900;
2193 0 val->tm_mon = schema_val->value.date.mon - 1;
2194 0 val->tm_mday = schema_val->value.date.day;
2195
2196 0 xmlSchemaFreeValue(schema_val);
2197
2198 0 exit:
2199
2200 0 GlobusSoapMessageDebugExit();
2201 0 return result;
2202 }
2203
2204 globus_result_t
2205 globus_soap_message_deserialize_time(
2206 globus_soap_message_handle_t handle,
2207 xsd_time * val)
2208 0 {
2209 0 xmlSchemaValPtr schema_val = NULL;
2210 int res;
2211 const xmlChar * tmp_value;
2212 0 globus_result_t result = GLOBUS_SUCCESS;
2213
2214 GlobusFuncName(globus_soap_message_deserialize_time);
2215 0 GlobusSoapMessageDebugEnter();
2216
2217 0 result = globus_i_soap_message_deserialize_next_content(handle);
2218 0 if(result != GLOBUS_SUCCESS)
2219 {
2220 0 result = GlobusSoapMessageErrorDeserializeFailed(
2221 result, &xsd_time_qname);
2222 0 goto exit;
2223 }
2224
2225 0 tmp_value = xmlTextReaderConstValue(handle->reader);
2226 0 if(!tmp_value)
2227 {
2228 0 result = GlobusSoapMessageErrorDeserializeFailed(
2229 result, &xsd_time_qname);
2230 0 goto exit;
2231 }
2232
2233 0 res = xmlSchemaValidatePredefinedType(
2234 xmlSchemaGetBuiltInType(XML_SCHEMAS_TIME),
2235 tmp_value,
2236 &schema_val);
2237 0 if(res != 0)
2238 {
2239 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
2240 &xsd_time_qname, tmp_value);
2241 0 goto exit;
2242 }
2243
2244 0 val->tm_hour = schema_val->value.date.hour;
2245 0 val->tm_min = schema_val->value.date.min;
2246 0 val->tm_sec = schema_val->value.date.sec;
2247
2248 0 if(schema_val->value.date.tz_flag)
2249 {
2250 0 val->tm_sec += (schema_val->value.date.tzo * 60);
2251 }
2252
2253 0 xmlSchemaFreeValue(schema_val);
2254
2255 0 exit:
2256
2257 0 GlobusSoapMessageDebugExit();
2258 0 return result;
2259 }
2260
2261
2262 globus_result_t
2263 globus_soap_message_deserialize_duration(
2264 globus_soap_message_handle_t handle,
2265 xsd_duration * val)
2266 0 {
2267 0 xmlSchemaValPtr schema_val = NULL;
2268 int res;
2269 const xmlChar * tmp_value;
2270 0 globus_result_t result = GLOBUS_SUCCESS;
2271
2272 GlobusFuncName(globus_soap_message_deserialize_duration);
2273 0 GlobusSoapMessageDebugEnter();
2274
2275 0 result = globus_i_soap_message_deserialize_next_content(handle);
2276 0 if(result != GLOBUS_SUCCESS)
2277 {
2278 0 result = GlobusSoapMessageErrorDeserializeFailed(
2279 result, &xsd_duration_qname);
2280 0 goto exit;
2281 }
2282
2283 0 tmp_value = xmlTextReaderConstValue(handle->reader);
2284 0 if(!tmp_value)
2285 {
2286 0 result = GlobusSoapMessageErrorDeserializeFailed(
2287 result, &xsd_duration_qname);
2288 0 goto exit;
2289 }
2290
2291 0 res = xmlSchemaValidatePredefinedType(
2292 xmlSchemaGetBuiltInType(XML_SCHEMAS_DURATION),
2293 tmp_value,
2294 &schema_val);
2295 0 if(res != 0)
2296 {
2297 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
2298 &xsd_duration_qname, tmp_value);
2299 0 goto exit;
2300 }
2301
2302 0 val->tm_mon = schema_val->value.date.mon - 1;
2303 0 val->tm_mday = schema_val->value.date.day;
2304 0 val->tm_sec = (int) schema_val->value.date.sec;
2305
2306 0 xmlSchemaFreeValue(schema_val);
2307
2308 0 exit:
2309
2310 0 GlobusSoapMessageDebugExit();
2311 0 return result;
2312 }
2313
2314
2315 globus_result_t
2316 globus_soap_message_deserialize_float(
2317 globus_soap_message_handle_t handle,
2318 xsd_float * val)
2319 0 {
2320 const xmlChar * tmp_value;
2321 0 globus_result_t result = GLOBUS_SUCCESS;
2322
2323 GlobusFuncName(globus_soap_message_deserialize_float);
2324 0 GlobusSoapMessageDebugEnter();
2325
2326 0 result = globus_i_soap_message_deserialize_next_content(handle);
2327 0 if(result != GLOBUS_SUCCESS)
2328 {
2329 0 result = GlobusSoapMessageErrorDeserializeFailed(
2330 result, &xsd_float_qname);
2331 0 goto exit;
2332 }
2333
2334 0 tmp_value = xmlTextReaderConstValue(handle->reader);
2335 0 if(!tmp_value)
2336 {
2337 0 result = GlobusSoapMessageErrorDeserializeFailed(
2338 result, &xsd_float_qname);
2339 0 goto exit;
2340 }
2341
2342 0 *val = (float) strtod(tmp_value, NULL);
2343
2344 0 exit:
2345
2346 0 GlobusSoapMessageDebugExit();
2347 0 return result;
2348 }
2349
2350 globus_result_t
2351 globus_soap_message_deserialize_double(
2352 globus_soap_message_handle_t handle,
2353 xsd_double * val)
2354 0 {
2355 const xmlChar * tmp_value;
2356 0 globus_result_t result = GLOBUS_SUCCESS;
2357
2358 GlobusFuncName(globus_soap_message_deserialize_double);
2359 0 GlobusSoapMessageDebugEnter();
2360
2361 0 result = globus_i_soap_message_deserialize_next_content(handle);
2362 0 if(result != GLOBUS_SUCCESS)
2363 {
2364 0 result = GlobusSoapMessageErrorDeserializeFailed(
2365 result, &xsd_double_qname);
2366 0 goto exit;
2367 }
2368
2369 0 tmp_value = xmlTextReaderConstValue(handle->reader);
2370 0 if(!tmp_value)
2371 {
2372 0 result = GlobusSoapMessageErrorDeserializeFailed(
2373 result, &xsd_double_qname);
2374 0 goto exit;
2375 }
2376
2377 0 *val = strtod(tmp_value, NULL);
2378
2379 0 exit:
2380
2381 0 GlobusSoapMessageDebugExit();
2382 0 return result;
2383 }
2384
2385 globus_result_t
2386 globus_soap_message_deserialize_int(
2387 globus_soap_message_handle_t handle,
2388 xsd_int * val)
2389 85 {
2390 const xmlChar * tmp_value;
2391 85 globus_result_t result = GLOBUS_SUCCESS;
2392
2393 GlobusFuncName(globus_soap_message_deserialize_int);
2394 85 GlobusSoapMessageDebugEnter();
2395
2396 85 result = globus_i_soap_message_deserialize_next_content(handle);
2397 85 if(result != GLOBUS_SUCCESS)
2398 {
2399 0 result = GlobusSoapMessageErrorDeserializeFailed(
2400 result, &xsd_int_qname);
2401 0 goto exit;
2402 }
2403
2404 85 tmp_value = xmlTextReaderConstValue(handle->reader);
2405 85 if(!tmp_value)
2406 {
2407 0 result = GlobusSoapMessageErrorDeserializeFailed(
2408 result, &xsd_int_qname);
2409 0 goto exit;
2410 }
2411
2412 85 *val = strtol((const char *)tmp_value, NULL, 0);
2413 85 if(*val == INT32_MAX || *val == INT32_MIN)
2414 {
2415 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
2416 &xsd_int_qname, tmp_value);
2417 goto exit;
2418 }
2419
2420 85 exit:
2421
2422 85 GlobusSoapMessageDebugExit();
2423 85 return result;
2424 }
2425
2426 globus_result_t
2427 globus_soap_message_deserialize_long(
2428 globus_soap_message_handle_t handle,
2429 xsd_long * val)
2430 0 {
2431 const xmlChar * tmp_value;
2432 0 globus_result_t result = GLOBUS_SUCCESS;
2433
2434 GlobusFuncName(globus_soap_message_deserialize_long);
2435 0 GlobusSoapMessageDebugEnter();
2436
2437 0 result = globus_i_soap_message_deserialize_next_content(handle);
2438 0 if(result != GLOBUS_SUCCESS)
2439 {
2440 0 result = GlobusSoapMessageErrorDeserializeFailed(
2441 result, &xsd_long_qname);
2442 0 goto exit;
2443 }
2444
2445 0 tmp_value = xmlTextReaderConstValue(handle->reader);
2446 0 if(!tmp_value)
2447 {
2448 0 result = GlobusSoapMessageErrorDeserializeFailed(
2449 GLOBUS_SUCCESS, &xsd_long_qname);
2450 0 goto exit;
2451 }
2452
2453 0 *val = strtoll(tmp_value, NULL, 0);
2454 0 if(*val == INT64_MAX || *val == INT64_MIN)
2455 {
2456 0 if(errno == ERANGE)
2457 {
2458 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
2459 &xsd_long_qname, tmp_value);
2460 goto exit;
2461 }
2462 }
2463
2464 0 exit:
2465
2466 0 GlobusSoapMessageDebugExit();
2467 0 return result;
2468 }
2469
2470
2471 globus_result_t
2472 globus_soap_message_deserialize_decimal(
2473 globus_soap_message_handle_t handle,
2474 xsd_decimal * val)
2475 0 {
2476 GlobusFuncName(globus_soap_message_deserialize_decimal);
2477 0 GlobusSoapMessageDebugEnter();
2478
2479 /* not implemented */
2480 0 globus_panic(GLOBUS_SOAP_MESSAGE_MODULE, GLOBUS_SUCCESS,
2481 "%s NOT IMPLEMENTED", _globus_func_name);
2482
2483 0 GlobusSoapMessageDebugExit();
2484 0 return GLOBUS_FAILURE;
2485 }
2486
2487 globus_result_t
2488 globus_soap_message_deserialize_integer(
2489 globus_soap_message_handle_t handle,
2490 xsd_integer * val)
2491 0 {
2492 const xmlChar * tmp_value;
2493 0 char * tmp = NULL;
2494 char * tmp_start;
2495 char * tmp_end;
2496 int rc;
2497 0 globus_result_t result = GLOBUS_SUCCESS;
2498
2499 GlobusFuncName(globus_soap_message_deserialize_integer);
2500 0 GlobusSoapMessageDebugEnter();
2501
2502 0 result = globus_i_soap_message_deserialize_next_content(handle);
2503 0 if(result != GLOBUS_SUCCESS)
2504 {
2505 0 result = GlobusSoapMessageErrorDeserializeFailed(
2506 result, &xsd_integer_qname);
2507 0 goto exit;
2508 }
2509
2510 0 tmp_value = xmlTextReaderConstValue(handle->reader);
2511 0 if(!tmp_value)
2512 {
2513 0 result = GlobusSoapMessageErrorDeserializeFailed(
2514 GLOBUS_SUCCESS, &xsd_integer_qname);
2515 0 goto exit;
2516 }
2517
2518 0 tmp = globus_libc_strdup(tmp_value);
2519 0 tmp_start = tmp;
2520
2521 0 while(*tmp_start && isspace(*tmp_start))
2522 {
2523 0 tmp_start++;
2524 }
2525 0 if (*tmp_start == '+')
2526 {
2527 0 tmp_start++;
2528 }
2529 0 if (*tmp_start != '-' && !isdigit(*tmp_start))
2530 {
2531 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
2532 &xsd_integer_qname, tmp_value);
2533 0 goto exit;
2534 }
2535 0 tmp_end = tmp_start;
2536
2537 0 if (*tmp_end == '-')
2538 {
2539 0 tmp_end++;
2540 }
2541 0 while (*tmp_end && isdigit(*tmp_end))
2542 {
2543 0 tmp_end++;
2544 }
2545
2546 0 if (*tmp_end && isspace(*tmp_end))
2547 {
2548 0 *tmp_end = '\0';
2549 0 tmp_end++;
2550 }
2551 0 while (*tmp_end && isspace(*tmp_end))
2552 {
2553 0 tmp_end++;
2554 }
2555 0 if (*tmp_end)
2556 {
2557 /* garbage at end */
2558 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
2559 &xsd_integer_qname, tmp_value);
2560 0 goto exit;
2561 }
2562 0 rc = BN_dec2bn(val, tmp_start);
2563 0 if (rc == 0)
2564 {
2565 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
2566 &xsd_integer_qname, tmp_value);
2567 goto exit;
2568 }
2569
2570 0 exit:
2571 0 if (tmp)
2572 {
2573 0 free(tmp);
2574 }
2575
2576 0 GlobusSoapMessageDebugExit();
2577 0 return result;
2578 }
2579
2580 globus_result_t
2581 globus_soap_message_deserialize_byte(
2582 globus_soap_message_handle_t handle,
2583 xsd_byte * val)
2584 0 {
2585 const xmlChar * tmp_value;
2586 short sval;
2587 0 globus_result_t result = GLOBUS_SUCCESS;
2588
2589 GlobusFuncName(globus_soap_message_deserialize_byte);
2590 0 GlobusSoapMessageDebugEnter();
2591
2592 0 result = globus_i_soap_message_deserialize_next_content(handle);
2593 0 if(result != GLOBUS_SUCCESS)
2594 {
2595 0 result = GlobusSoapMessageErrorDeserializeFailed(
2596 result, &xsd_byte_qname);
2597 0 goto exit;
2598 }
2599
2600 0 tmp_value = xmlTextReaderConstValue(handle->reader);
2601 0 if(!tmp_value)
2602 {
2603 0 result = GlobusSoapMessageErrorDeserializeFailed(
2604 result, &xsd_byte_qname);
2605 0 goto exit;
2606 }
2607
2608 0 sscanf(tmp_value, "%hd", &sval);
2609 0 *val = (char) sval;
2610
2611 0 exit:
2612
2613 0 GlobusSoapMessageDebugExit();
2614 0 return result;
2615 }
2616
2617 globus_result_t
2618 globus_soap_message_deserialize_unsignedByte(
2619 globus_soap_message_handle_t handle,
2620 xsd_unsignedByte * val)
2621 0 {
2622 const xmlChar * tmp_value;
2623 unsigned short sval;
2624 0 globus_result_t result = GLOBUS_SUCCESS;
2625
2626 GlobusFuncName(globus_soap_message_deserialize_unsignedByte);
2627 0 GlobusSoapMessageDebugEnter();
2628
2629 0 result = globus_i_soap_message_deserialize_next_content(handle);
2630 0 if(result != GLOBUS_SUCCESS)
2631 {
2632 0 result = GlobusSoapMessageErrorDeserializeFailed(
2633 result, &xsd_unsignedByte_qname);
2634 0 goto exit;
2635 }
2636
2637 0 tmp_value = xmlTextReaderConstValue(handle->reader);
2638 0 if(!tmp_value)
2639 {
2640 0 result = GlobusSoapMessageErrorDeserializeFailed(
2641 GLOBUS_SUCCESS, &xsd_unsignedByte_qname);
2642 0 goto exit;
2643 }
2644
2645 0 if(sscanf(tmp_value, "%hu", &sval) == 0)
2646 {
2647 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
2648 &xsd_unsignedByte_qname, tmp_value);
2649 0 goto exit;
2650 }
2651
2652 0 *val = (unsigned char) sval;
2653
2654 0 exit:
2655
2656 0 GlobusSoapMessageDebugExit();
2657 0 return result;
2658 }
2659
2660 globus_result_t
2661 globus_soap_message_deserialize_unsignedLong(
2662 globus_soap_message_handle_t handle,
2663 xsd_unsignedLong * val)
2664 0 {
2665 const xmlChar * tmp_value;
2666 0 globus_result_t result = GLOBUS_SUCCESS;
2667
2668 GlobusFuncName(globus_soap_message_deserialize_unsignedLong);
2669 0 GlobusSoapMessageDebugEnter();
2670
2671 0 result = globus_i_soap_message_deserialize_next_content(handle);
2672 0 if(result != GLOBUS_SUCCESS)
2673 {
2674 0 result = GlobusSoapMessageErrorDeserializeFailed(
2675 result, &xsd_unsignedLong_qname);
2676 0 goto exit;
2677 }
2678
2679 0 tmp_value = xmlTextReaderConstValue(handle->reader);
2680 0 if(!tmp_value)
2681 {
2682 0 result = GlobusSoapMessageErrorDeserializeFailed(
2683 GLOBUS_SUCCESS, &xsd_unsignedLong_qname);
2684 0 goto exit;
2685 }
2686
2687 0 *val = strtoull(tmp_value, NULL, 0);
2688 0 if(*val == UINT64_MAX)
2689 {
2690 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
2691 &xsd_unsignedLong_qname, tmp_value);
2692 goto exit;
2693 }
2694
2695 0 exit:
2696
2697 0 GlobusSoapMessageDebugExit();
2698 0 return result;
2699 }
2700
2701 globus_result_t
2702 globus_soap_message_deserialize_unsignedInt(
2703 globus_soap_message_handle_t handle,
2704 xsd_unsignedInt * val)
2705 0 {
2706 const xmlChar * tmp_value;
2707 0 globus_result_t result = GLOBUS_SUCCESS;
2708
2709 GlobusFuncName(globus_soap_message_deserialize_unsignedInt);
2710 0 GlobusSoapMessageDebugEnter();
2711
2712 0 result = globus_i_soap_message_deserialize_next_content(handle);
2713 0 if(result != GLOBUS_SUCCESS)
2714 {
2715 0 result = GlobusSoapMessageErrorDeserializeFailed(
2716 result, &xsd_unsignedInt_qname);
2717 0 goto exit;
2718 }
2719
2720 0 tmp_value = xmlTextReaderConstValue(handle->reader);
2721 0 if(!tmp_value)
2722 {
2723 0 result = GlobusSoapMessageErrorDeserializeFailed(
2724 GLOBUS_SUCCESS, &xsd_unsignedInt_qname);
2725 0 goto exit;
2726 }
2727
2728 0 *val = strtoul(tmp_value, NULL, 0);
2729 0 if(*val == UINT32_MAX)
2730 {
2731 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
2732 &xsd_unsignedInt_qname, tmp_value);
2733 goto exit;
2734 }
2735
2736 0 exit:
2737
2738 0 GlobusSoapMessageDebugExit();
2739 0 return result;
2740 }
2741
2742
2743 globus_result_t
2744 globus_soap_message_deserialize_unsignedShort(
2745 globus_soap_message_handle_t handle,
2746 xsd_unsignedShort * val)
2747 0 {
2748 const xmlChar * tmp_value;
2749 0 globus_result_t result = GLOBUS_SUCCESS;
2750
2751 GlobusFuncName(globus_soap_message_deserialize_unsignedShort);
2752 0 GlobusSoapMessageDebugEnter();
2753
2754 0 result = globus_i_soap_message_deserialize_next_content(handle);
2755 0 if(result != GLOBUS_SUCCESS)
2756 {
2757 0 result = GlobusSoapMessageErrorDeserializeFailed(
2758 result, &xsd_unsignedShort_qname);
2759 0 goto exit;
2760 }
2761
2762 0 tmp_value = xmlTextReaderConstValue(handle->reader);
2763 0 if(!tmp_value)
2764 {
2765 0 result = GlobusSoapMessageErrorDeserializeFailed(
2766 GLOBUS_SUCCESS, &xsd_unsignedShort_qname);
2767 0 goto exit;
2768 }
2769
2770 0 if(sscanf(tmp_value, "%hu", val) < 1)
2771 {
2772 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
2773 &xsd_unsignedShort_qname, tmp_value);
2774 goto exit;
2775 }
2776
2777 0 exit:
2778
2779 0 GlobusSoapMessageDebugExit();
2780 0 return result;
2781 }
2782
2783 globus_result_t
2784 globus_soap_message_deserialize_base64Binary(
2785 globus_soap_message_handle_t handle,
2786 xsd_base64Binary * val)
2787 0 {
2788 const xmlChar * tmp_value;
2789 0 int length = 0;
2790 0 globus_result_t result = GLOBUS_SUCCESS;
2791
2792 GlobusFuncName(globus_soap_message_deserialize_base64Binary);
2793 0 GlobusSoapMessageDebugEnter();
2794
2795 0 result = globus_i_soap_message_deserialize_next_content(handle);
2796 0 if(result != GLOBUS_SUCCESS)
2797 {
2798 0 result = GlobusSoapMessageErrorDeserializeFailed(
2799 result, &xsd_base64Binary_qname);
2800 0 goto exit;
2801 }
2802
2803 0 tmp_value = xmlTextReaderConstValue(handle->reader);
2804 0 if(!tmp_value)
2805 {
2806 0 result = GlobusSoapMessageErrorDeserializeFailed(
2807 GLOBUS_SUCCESS, &xsd_base64Binary_qname);
2808 0 goto exit;
2809 }
2810
2811 0 length = strlen(tmp_value);
2812
2813 0 val->length = (int)ceil((length * 3) / 4) + 1;
2814 0 val->value = globus_malloc(val->length);
2815 0 if(!val->value)
2816 {
2817 0 result = GlobusSoapMessageErrorOutOfMemory;
2818 0 goto exit;
2819 }
2820
2821 0 if(xmlBase64Decode(
2822 tmp_value,
2823 (unsigned long *)&length,
2824 val->value,
2825 (unsigned long *)&val->length) < 0)
2826 {
2827 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
2828 &xsd_base64Binary_qname, tmp_value);
2829 goto exit;
2830 }
2831
2832 0 exit:
2833
2834 0 GlobusSoapMessageDebugExit();
2835 0 return result;
2836 }
2837
2838 globus_result_t
2839 globus_soap_message_deserialize_hexBinary(
2840 globus_soap_message_handle_t handle,
2841 xsd_hexBinary * val)
2842 0 {
2843 0 int res = 0;
2844 0 xmlSchemaValPtr schema_val = NULL;
2845 const xmlChar * tmp_value;
2846 0 globus_result_t result = GLOBUS_SUCCESS;
2847
2848 GlobusFuncName(globus_soap_message_deserialize_hexBinary);
2849 0 GlobusSoapMessageDebugEnter();
2850
2851 0 result = globus_i_soap_message_deserialize_next_content(handle);
2852 0 if(result != GLOBUS_SUCCESS)
2853 {
2854 0 result = GlobusSoapMessageErrorDeserializeFailed(
2855 result, &xsd_hexBinary_qname);
2856 0 goto exit;
2857 }
2858
2859 0 tmp_value = xmlTextReaderConstValue(handle->reader);
2860 0 if(!tmp_value)
2861 {
2862 0 result = GlobusSoapMessageErrorDeserializeFailed(
2863 result, &xsd_hexBinary_qname);
2864 0 goto exit;
2865 }
2866
2867 0 res = xmlSchemaValidatePredefinedType(
2868 xmlSchemaGetBuiltInType(XML_SCHEMAS_HEXBINARY),
2869 tmp_value,
2870 &schema_val);
2871 0 if(res != 0)
2872 {
2873 0 result = GlobusSoapMessageErrorDeserializeContentFailed(
2874 &xsd_hexBinary_qname, tmp_value);
2875 0 goto exit;
2876 }
2877
2878 0 val->value = globus_libc_strdup(schema_val->value.hex.str);
2879 0 val->length = schema_val->value.hex.total;
2880
2881 0 xmlSchemaFreeValue(schema_val);
2882
2883 0 exit:
2884
2885 0 GlobusSoapMessageDebugExit();
2886 0 return result;
2887 }
2888
2889 globus_result_t
2890 globus_soap_message_deserialize_QName(
2891 globus_soap_message_handle_t handle,
2892 xsd_QName * val)
2893 493613 {
2894 xmlChar * prefix;
2895 const xmlChar * tmp_value;
2896 char * token;
2897 493613 globus_result_t result = GLOBUS_SUCCESS;
2898 int start_token;
2899 int end_token;
2900
2901 GlobusFuncName(globus_soap_message_deserialize_QName);
2902 493613 GlobusSoapMessageDebugEnter();
2903
2904 493613 result = globus_i_soap_message_deserialize_next_content(handle);
2905 493613 if(result != GLOBUS_SUCCESS)
2906 {
2907 0 result = GlobusSoapMessageErrorDeserializeFailed(
2908 result, &xsd_QName_qname);
2909 0 goto exit;
2910 }
2911
2912 493613 tmp_value = xmlTextReaderConstValue(handle->reader);
2913 493613 if(!tmp_value)
2914 {
2915 0 result = GlobusSoapMessageErrorDeserializeFailed(
2916 result, &xsd_QName_qname);
2917 0 goto exit;
2918 }
2919 493613 token = globus_l_soap_message_my_strtok(
2920 tmp_value, strlen(tmp_value), &start_token, &end_token, "\n\t ");
2921 493613 if (token == NULL)
2922 {
2923 0 result = GlobusSoapMessageErrorDeserializeFailed(
2924 result, &xsd_QName_qname);
2925 0 goto exit;
2926 }
2927
2928 493613 val->local = xmlSplitQName2(token, &prefix);
2929 987226 if(val->local && prefix)
2930 {
2931 493613 val->Namespace = xmlTextReaderLookupNamespace(handle->reader, prefix);
2932 493613 xmlFree(prefix);
2933 }
2934 0 else if (val->local)
2935 {
2936 0 val->Namespace = NULL;
2937 }
2938 else
2939 {
2940 0 val->local = globus_libc_strdup(tmp_value);
2941 }
2942
2943 493613 free(token);
2944
2945 493613 exit:
2946
2947 493613 GlobusSoapMessageDebugExit();
2948 493613 return result;
2949 }
2950
2951 globus_result_t
2952 globus_soap_message_deserialize_QName_attribute(
2953 globus_soap_message_handle_t handle,
2954 const xsd_QName * attr_name,
2955 xsd_QName * val)
2956 3152 {
2957 3152 xmlChar * str = NULL;
2958 xmlChar * prefix;
2959 const xmlChar * attr_ns;
2960 const xmlChar * local_ns;
2961 3152 globus_result_t result = GLOBUS_SUCCESS;
2962
2963 GlobusFuncName(globus_soap_message_deserialize_QName_attribute);
2964 3152 GlobusSoapMessageDebugEnter();
2965
2966 3152 attr_ns = xmlTextReaderConstString(
2967 handle->reader, attr_name->Namespace);
2968 3152 local_ns = xmlTextReaderConstNamespaceUri(handle->reader);
2969
2970 /* is it the default or a null namespace? */
2971 3152 if((attr_ns != local_ns) && (attr_ns != NULL) && (*attr_ns != '\0'))
2972 {
2973 0 str = xmlTextReaderGetAttributeNs(
2974 handle->reader, attr_name->local, attr_name->Namespace);
2975 }
2976 else
2977 {
2978 3152 str = xmlTextReaderGetAttribute(
2979 handle->reader, attr_name->local);
2980 }
2981
2982 3152 if((str == NULL || (*str == '\0')))
2983 {
2984 2121 result = GlobusSoapMessageErrorAttributeNotFound(
2985 handle->verbose,
2986 attr_name);
2987 2121 goto exit;
2988 }
2989 else
2990 {
2991 1031 val->local = xmlSplitQName2(str, &prefix);
2992 1031 if(prefix)
2993 {
2994 1031 val->Namespace = xmlTextReaderLookupNamespace(
2995 handle->reader, prefix);
2996 1031 xmlFree(prefix);
2997 }
2998 else
2999 {
3000 0 val->Namespace = NULL;
3001 }
3002 }
3003
3004 3152 exit:
3005
3006 3152 if (str != NULL)
3007 {
3008 1031 xmlFree(str);
3009 }
3010
3011 3152 GlobusSoapMessageDebugExit();
3012 3152 return result;
3013 }
3014
3015 globus_result_t
3016 globus_soap_message_deserialize_QName_list(
3017 globus_soap_message_handle_t handle,
3018 xsd_QName_array * inst)
3019 0 {
3020 const xmlChar * tmp_value;
3021 globus_list_t * qnames;
3022 globus_list_t * qnlist;
3023 0 globus_result_t result = GLOBUS_SUCCESS;
3024 GlobusFuncName(globus_soap_message_deserialize_QName_list);
3025 0 GlobusSoapMessageDebugEnter();
3026
3027 0 result = globus_i_soap_message_deserialize_next_content(handle);
3028 0 if(result != GLOBUS_SUCCESS)
3029 {
3030 0 result = GlobusSoapMessageErrorDeserializeFailed(
3031 result, &xsd_QName_qname);
3032 0 goto exit;
3033 }
3034
3035 0 tmp_value = xmlTextReaderConstValue(handle->reader);
3036 0 if(!tmp_value)
3037 {
3038 0 result = GlobusSoapMessageErrorDeserializeFailed(
3039 result, &xsd_QName_qname);
3040 0 goto exit;
3041 }
3042
3043 0 globus_i_soap_message_split_qnames(tmp_value, &qnames);
3044 0 qnlist = qnames;
3045 0 while(!globus_list_empty(qnlist))
3046 {
3047 0 char * str = globus_list_first(qnlist);
3048 0 xmlChar * prefix = NULL;
3049 xsd_QName * val;
3050
3051 0 val = xsd_QName_array_push(inst);
3052
3053 0 val->local = xmlSplitQName2(str, &prefix);
3054 0 val->Namespace = xmlTextReaderLookupNamespace(
3055 handle->reader, prefix);
3056
3057 0 globus_free(str);
3058 0 qnlist = globus_list_rest(qnlist);
3059 }
3060
3061 0 globus_list_destroy_all(qnames, globus_libc_free);
3062
3063 0 exit:
3064
3065 0 GlobusSoapMessageDebugExit();
3066 0 return result;
3067 }
3068
3069 globus_result_t
3070 globus_soap_message_deserialize_QName_attribute_list(
3071 globus_soap_message_handle_t handle,
3072 const xsd_QName * attr_qname,
3073 xsd_QName_array * inst)
3074 0 {
3075 0 const xmlChar * attr_ns = NULL;
3076 0 const xmlChar * local_ns = NULL;
3077 char * tmp_value;
3078 globus_list_t * qnames;
3079 globus_list_t * qnlist;
3080 0 globus_result_t result = GLOBUS_SUCCESS;
3081 GlobusFuncName(globus_soap_message_deserialize_QName_attribute_list);
3082 0 GlobusSoapMessageDebugEnter();
3083
3084 0 attr_ns = xmlTextReaderConstString(
3085 handle->reader, attr_qname->Namespace);
3086 0 local_ns = xmlTextReaderConstNamespaceUri(handle->reader);
3087
3088 0 if(attr_ns != local_ns && (attr_ns != NULL) && (*attr_ns != '\0'))
3089 {
3090 0 tmp_value = xmlTextReaderGetAttributeNs(
3091 handle->reader, attr_qname->local, attr_qname->Namespace);
3092 }
3093 else
3094 {
3095 0 tmp_value = xmlTextReaderGetAttribute(
3096 handle->reader, attr_qname->local);
3097 }
3098
3099 0 if((!tmp_value) || !(*tmp_value))
3100 {
3101 0 result = GlobusSoapMessageErrorDeserializeFailed(
3102 result, &xsd_QName_qname);
3103 0 goto exit;
3104 }
3105
3106 0 globus_i_soap_message_split_qnames(tmp_value, &qnames);
3107 0 qnlist = qnames;
3108 0 while(!globus_list_empty(qnlist))
3109 {
3110 0 char * str = globus_list_first(qnlist);
3111 0 xmlChar * prefix = NULL;
3112 xsd_QName * val;
3113
3114 0 val = xsd_QName_array_push(inst);
3115
3116 0 val->local = xmlSplitQName2(str, &prefix);
3117 0 val->Namespace = xmlTextReaderLookupNamespace(
3118 handle->reader, prefix);
3119
3120 0 globus_free(str);
3121 0 qnlist = globus_list_rest(qnlist);
3122 }
3123
3124 0 globus_list_destroy_all(qnames, globus_libc_free);
3125
3126 0 exit:
3127
3128 0 GlobusSoapMessageDebugExit();
3129 0 return result;
3130 }
3131
3132 globus_result_t
3133 globus_soap_message_deserialize_mark(
3134 globus_soap_message_handle_t handle,
3135 const char * idval)
3136 0 {
3137 0 globus_result_t result = GLOBUS_SUCCESS;
3138 GlobusFuncName(globus_soap_message_deserialize_mark);
3139 0 GlobusSoapMessageDebugEnter();
3140
3141 0 GlobusSoapMessageDebugPrintf(
3142 GLOBUS_SOAP_MESSAGE_DEBUG_DEBUG,
3143 ("SETTING MARK: %s\n", idval));
3144
3145 0 if(handle->xio_handle)
3146 {
3147 0 result = globus_xio_handle_cntl(
3148 handle->xio_handle, globus_i_soap_message_buffer_driver,
3149 GLOBUS_XIO_BUFFER_SET_READ_MARKER_AT_INDEX,
3150 idval,
3151 xmlTextReaderReadPosition(handle->reader));
3152 0 if(result != GLOBUS_SUCCESS)
3153 {
3154 0 result = GlobusSoapMessageErrorWithMarker(
3155 result, "Failed to set read marker: %s", idval);
3156 goto exit;
3157 }
3158 }
3159
3160 0 exit:
3161
3162 0 GlobusSoapMessageDebugExit();
3163 0 return result;