1 /*
2 * Copyright 1999-2006 University of Chicago
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18 #include "globus_ws_addressing.h"
19 #include "globus_ws_addressing_compat.h"
20 #include "globus_extension.h"
21 #include "globus_common.h"
22 #include "globus_handler.h"
23 #include "globus_soap_message_fault.h"
24 #include "globus_xml_buffer.h"
25 #include "globus_soap_message_attrs.h"
26
27 #include "wsa_AttributedURIType.h"
28 #include "wsa_RelationshipType.h"
29 #include "wsa_EndpointReferenceType.h"
30
31 #include "wsacompat_AttributedURI.h"
32 #include "wsacompat_Relationship.h"
33 #include "wsacompat_EndpointReferenceType.h"
34
35 #include "wsa_MessageID.h"
36 #include "wsa_RelatesTo.h"
37 #include "wsa_RelatesToType.h"
38 #include "wsa_To.h"
39 #include "wsa_Action.h"
40 #include "wsa_From.h"
41 #include "wsa_ReplyTo.h"
42 #include "wsa_FaultTo.h"
43 #include "wsa_IsReferenceParameter.h"
44
45 #include "wsacompat_MessageID.h"
46 #include "wsacompat_RelatesTo.h"
47 #include "wsacompat_To.h"
48 #include "wsacompat_Action.h"
49 #include "wsacompat_From.h"
50 #include "wsacompat_ReplyTo.h"
51 #include "wsacompat_FaultTo.h"
52 #include "globus_wsrf_core_tools.h"
53
54 #include "version.h"
55
56 #define WS_ADDRESSING_CLIENT_REQUEST_ALREADY_INVOKED \
57 "WS_ADDRESSING_CLIENT_REQUEST_ALREADY_INVOKED"
58
59 #define WS_ADDRESSING_CLIENT_MESSAGEID_ALREADY_INVOKED \
60 "WS_ADDRESSING_CLIENT_MESSAGEID_ALREADY_INVOKED"
61
62 #define WS_ADDRESSING_CLIENT_RELATESTO_ALREADY_INVOKED \
63 "WS_ADDRESSING_CLIENT_RELATESTO_ALREADY_INVOKED"
64
65 #define WS_ADDRESSING_CLIENT_TO_ALREADY_INVOKED \
66 "WS_ADDRESSING_CLIENT_TO_ALREADY_INVOKED"
67
68 #define WS_ADDRESSING_CLIENT_ACTION_ALREADY_INVOKED \
69 "WS_ADDRESSING_CLIENT_ACTION_ALREADY_INVOKED"
70
71 #define WS_ADDRESSING_CLIENT_FROM_ALREADY_INVOKED \
72 "WS_ADDRESSING_CLIENT_FROM_ALREADY_INVOKED"
73
74 #define WS_ADDRESSING_CLIENT_RESPONSE_ALREADY_INVOKED \
75 "WS_ADDRESSING_CLIENT_RESPONSE_ALREADY_INVOKED"
76
77 #define WS_ADDRESSING_SERVER_RESPONSE_ALREADY_INVOKED \
78 "WS_ADDRESSING_SERVER_RESPONSE_ALREADY_INVOKED"
79
80 #define WS_ADDRESSING_SERVER_MESSAGEID_ALREADY_INVOKED \
81 "WS_ADDRESSING_SERVER_MESSAGEID_ALREADY_INVOKED"
82
83 #define WS_ADDRESSING_SERVER_RELATESTO_ALREADY_INVOKED \
84 "WS_ADDRESSING_SERVER_RELATESTO_ALREADY_INVOKED"
85
86 #define WS_ADDRESSING_SERVER_TO_ALREADY_INVOKED \
87 "WS_ADDRESSING_SERVER_TO_ALREADY_INVOKED"
88
89 #define WS_ADDRESSING_SERVER_ACTION_ALREADY_INVOKED \
90 "WS_ADDRESSING_SERVER_ACTION_ALREADY_INVOKED"
91
92 #define WS_ADDRESSING_SERVER_FROM_ALREADY_INVOKED \
93 "WS_ADDRESSING_SERVER_FROM_ALREADY_INVOKED"
94
95 #define WS_ADDRESSING_SERVER_REQUEST_ALREADY_INVOKED \
96 "WS_ADDRESSING_SERVER_REQUEST_ALREADY_INVOKED"
97
98 #define WS_ADDRESSING_SERVER_REQUEST_COMPAT_MODE \
99 "WS_ADDRESSING_SERVER_REQUEST_COMPAT_MODE"
100
101 #define WS_ADDRESSING_CLIENT_RESPONSE_COMPAT_MODE \
102 "WS_ADDRESSING_CLIENT_RSPONSE__COMPAT_MODE"
103
104 int
105 globus_l_handler_ws_addressing_activate(void);
106
107 int
108 globus_l_handler_ws_addressing_deactivate(void);
109
110
111 GlobusExtensionDefineModule(globus_handler_ws_addressing) =
112 {
113 GLOBUS_HANDLER_WS_ADDRESSING_MODULE,
114 globus_l_handler_ws_addressing_activate,
115 globus_l_handler_ws_addressing_deactivate,
116 NULL,
117 NULL,
118 &local_version
119 };
120
121 #define GLOBUS_L_WS_ADDRESSING_DEBUG_TRACE 2
122 #define GLOBUS_L_WS_ADDRESSING_DEBUG_DEBUG 4
123
124 0 GlobusDebugDefine(GLOBUS_HANDLER_WS_ADDRESSING);
125
126 #define GlobusWSAddressingDebugPrintf(LEVEL, MESSAGE) \
127 GlobusDebugPrintf(GLOBUS_HANDLER_WS_ADDRESSING, LEVEL, MESSAGE)
128
129 #define GlobusWSAddressingDebugEnter() \
130 GlobusWSAddressingDebugPrintf(GLOBUS_L_WS_ADDRESSING_DEBUG_TRACE, \
131 ("[%s] Entering\n", _globus_func_name))
132
133 #define GlobusWSAddressingDebugExit() \
134 GlobusWSAddressingDebugPrintf(GLOBUS_L_WS_ADDRESSING_DEBUG_TRACE, \
135 ("[%s] Exiting\n", _globus_func_name))
136
137 #define GlobusWSAddressingErrorSerializeFailed(ERROR, MESSAGE) \
138 globus_error_put( \
139 globus_error_construct_error( \
140 GlobusExtensionMyModule(globus_handler_ws_addressing), \
141 (ERROR ? globus_error_get(ERROR) : NULL), \
142 0, \
143 __FILE__, \
144 _globus_func_name, \
145 __LINE__, \
146 MESSAGE))
147
148 #define GlobusWSAddressingErrorDeserializeFailed(ERROR, MESSAGE) \
149 globus_error_put( \
150 globus_error_construct_error( \
151 GlobusExtensionMyModule(globus_handler_ws_addressing), \
152 (ERROR ? globus_error_get(ERROR) : NULL), \
153 0, \
154 __FILE__, \
155 _globus_func_name, \
156 __LINE__, \
157 globus_common_create_string MESSAGE))
158
159 #define GlobusWSAddressingErrorRequiredElementNotFound(MESSAGE) \
160 globus_error_put( \
161 globus_error_construct_error( \
162 GlobusExtensionMyModule(globus_handler_ws_addressing), \
163 NULL, \
164 0, \
165 __FILE__, \
166 _globus_func_name, \
167 __LINE__, \
168 "Required element %s not found", MESSAGE))
169
170 #define GlobusWSAddressingErrorMemoryAllocationFailed(LENGTH, MESSAGE) \
171 globus_error_put( \
172 globus_error_construct_error( \
173 GlobusExtensionMyModule(globus_handler_ws_addressing), \
174 NULL, \
175 0, \
176 __FILE__, \
177 _globus_func_name, \
178 __LINE__, \
179 "Memory allocation failed (%d bytes): %s", \
180 LENGTH, MESSAGE))
181
182 #define GlobusWSAddressingErrorFailedDefaultTrigger(ELEMENT) \
183 globus_error_put( \
184 globus_error_construct_error( \
185 GlobusExtensionMyModule(globus_handler_ws_addressing), \
186 NULL, \
187 0, \
188 __FILE__, \
189 _globus_func_name, \
190 __LINE__, \
191 "Failed to handle {%s}%s element", \
192 ELEMENT->Namespace, \
193 ELEMENT->local))
194
195 #define GlobusWSAddressingErrorProtocolVersionMismatchServer(CAUSE) \
196 globus_error_put( \
197 globus_error_construct_error( \
198 GlobusExtensionMyModule(globus_handler_ws_addressing), \
199 (CAUSE), \
200 0, \
201 __FILE__, \
202 _globus_func_name, \
203 __LINE__, \
204 "Addressing header is a draft version of WS Addressing: \"http://schemas.xmlsoap.org/ws/2004/03/addressing\". This could be a GT version mismatch, client is GT 4.2.x and response is from GT 4.0.x server"))
205
206
207 static
208 globus_result_t
209 globus_l_uuid_copy(
210 void ** new_id,
211 const void * id);
212
213 static
214 globus_result_t
215 globus_l_wsa_convert_old_epr(
216 wsa_EndpointReferenceType * new_epr,
217 wsacompat_EndpointReferenceType * old_epr);
218
219 static
220 globus_result_t
221 globus_l_wsa_convert_new_epr(
222 wsacompat_EndpointReferenceType * new_epr,
223 wsa_EndpointReferenceType * old_epr);
224
225 static
226 globus_result_t
227 globus_l_ws_addressing_refparam_ns_set(
228 globus_soap_message_handle_t message_handle,
229 const xsd_QName * element,
230 globus_xsd_element_options_t * options);
231
232 static
233 globus_result_t
234 globus_l_ws_addressing_refparam_ns_add(
235 globus_soap_message_handle_t message_handle,
236 const xsd_QName * element,
237 globus_xsd_element_options_t * options);
238
239 static
240 globus_result_t
241 globus_l_ws_addressing_refparam_ns_remove(
242 globus_soap_message_handle_t message_handle,
243 const xsd_QName * element,
244 globus_xsd_element_options_t * options);
245
246 static
247 globus_result_t
248 globus_l_ws_addressing_refparam_attr(
249 globus_soap_message_handle_t message_handle,
250 const xsd_QName * type);
251
252 static
253 globus_result_t
254 globus_l_ws_addressing_serialize_refparam(
255 globus_soap_message_handle_t message_handle,
256 globus_xml_buffer * buffer);
257
258 static
259 globus_result_t
260 globus_l_ws_addressing_deserialize_refparams(
261 xsd_QName * element,
262 xsd_any_array * array,
263 globus_soap_message_handle_t handle,
264 globus_xsd_element_options_t options);
265
266 globus_result_t
267 globus_handler_ws_addressing_client_request_invoke(
268 globus_soap_message_handle_t message_handle,
269 globus_result_t result)
270 12952 {
271 12952 globus_uuid_t * uuid = NULL;
272 12952 char * uuid_string = NULL;
273 wsa_AttributedURIType MessageID;
274 wsa_AttributedURIType To;
275 wsa_AttributedURIType Action;
276 12952 char * action_uri = NULL;
277 wsa_EndpointReferenceType default_From;
278 12952 wsa_EndpointReferenceType * source_endpoint = NULL;
279 12952 wsa_EndpointReferenceType * reply_endpoint = NULL;
280 12952 wsa_EndpointReferenceType * fault_endpoint = NULL;
281 12952 wsa_EndpointReferenceType * endpoint_reference = NULL;
282 GlobusFuncName(globus_ws_addressing_handler_client_request_invoke);
283 12952 GlobusWSAddressingDebugEnter();
284
285 12952 if(result != GLOBUS_SUCCESS)
286 {
287 0 goto exit;
288 }
289
290 12952 if(globus_soap_message_handle_get_attr(
291 message_handle,
292 WS_ADDRESSING_CLIENT_REQUEST_ALREADY_INVOKED))
293 {
294 0 goto exit;
295 }
296
297 12952 endpoint_reference = (wsa_EndpointReferenceType *)
298 globus_soap_message_handle_get_attr(
299 message_handle, WSADDR_OUTBOUND_EPR_KEY);
300 12952 if(!endpoint_reference)
301 {
302 12952 endpoint_reference = (wsa_EndpointReferenceType *)
303 globus_soap_message_handle_get_attr(
304 message_handle, WSADDR_EPR_KEY);
305 }
306
307 12952 uuid = globus_malloc(sizeof(globus_uuid_t));
308 12952 if(!uuid)
309 {
310 0 result = GlobusWSAddressingErrorMemoryAllocationFailed(
311 sizeof(globus_uuid_t), "uuid");
312 0 goto exit;
313 }
314
315 12952 globus_uuid_create(uuid);
316
317 12952 uuid_string = globus_common_create_string("uuid:%s", uuid->text);
318 12952 MessageID.base_value = uuid_string;
319 12952 MessageID.anyAttributes = NULL;
320
321 12952 result = wsa_AttributedURIType_serialize(
322 (xsd_QName *)&wsa_MessageID_qname,
323 &MessageID,
324 message_handle,
325 0);
326 12952 if(result != GLOBUS_SUCCESS)
327 {
328 0 globus_free(uuid_string);
329 0 globus_free(uuid);
330 0 result = GlobusWSAddressingErrorSerializeFailed(
331 result, "MessageID element");
332 0 goto exit;
333 }
334
335 12952 globus_free(uuid_string);
336
337 12952 globus_soap_message_handle_set_attr(
338 message_handle,
339 WSADDR_OUTBOUND_MESSAGE_ID_KEY,
340 globus_l_uuid_copy,
341 globus_libc_free,
342 (void *) uuid);
343
344 12952 globus_free(uuid);
345
346 12952 To.base_value = (char *) globus_soap_message_handle_get_attr(
347 message_handle, WSADDR_DESTINATION_KEY);
348 12952 if(!To.base_value)
349 {
350 0 result = GlobusWSAddressingErrorSerializeFailed(
351 GLOBUS_SUCCESS, "No destination endpoint");
352 0 goto exit;
353 }
354
355 12952 To.anyAttributes = NULL;
356
357 12952 result = wsa_AttributedURIType_serialize(
358 (xsd_QName *)&wsa_To_qname,
359 &To,
360 message_handle,
361 0);
362 12952 if(result != GLOBUS_SUCCESS)
363 {
364 0 result = GlobusWSAddressingErrorSerializeFailed(
365 result, "To element");
366 0 goto exit;
367 }
368
369 12952 action_uri = (char *) globus_soap_message_handle_get_attr(
370 message_handle, WSADDR_ACTION_REQUEST_KEY);
371 12952 if(!action_uri)
372 {
373 0 result = GlobusWSAddressingErrorSerializeFailed(
374 GLOBUS_SUCCESS, "No SOAPAction defined");
375 0 goto exit;
376 }
377
378 12952 Action.base_value = action_uri;
379 12952 Action.anyAttributes = NULL;
380
381 12952 result = wsa_AttributedURIType_serialize(
382 (xsd_QName *)&wsa_Action_qname,
383 &Action,
384 message_handle,
385 0);
386 12952 if(result != GLOBUS_SUCCESS)
387 {
388 0 result = GlobusWSAddressingErrorSerializeFailed(
389 result, "Action element");
390 0 goto exit;
391 }
392
393 12952 source_endpoint = globus_soap_message_handle_get_attr(
394 message_handle,
395 WSADDR_SOURCE_ENDPOINT_KEY);
396 12952 if(!source_endpoint)
397 {
398 12952 memset(&default_From, 0, sizeof(wsa_EndpointReferenceType));
399 12952 default_From.Address.base_value = WSADDRESSING_ANON_NS;
400 12952 source_endpoint = &default_From;
401 }
402
403 12952 result = wsa_EndpointReferenceType_serialize(
404 (xsd_QName *)&wsa_From_qname,
405 source_endpoint,
406 message_handle,
407 0);
408 12952 if(result != GLOBUS_SUCCESS)
409 {
410 0 result = GlobusWSAddressingErrorSerializeFailed(
411 result, "From element");
412 0 goto exit;
413 }
414
415 12952 reply_endpoint = globus_soap_message_handle_get_attr(
416 message_handle,
417 WSADDR_REPLY_ENDPOINT_KEY);
418 12952 if(reply_endpoint)
419 {
420
421 0 result = wsa_EndpointReferenceType_serialize(
422 (xsd_QName *)&wsa_ReplyTo_qname,
423 reply_endpoint,
424 message_handle,
425 0);
426 0 if(result != GLOBUS_SUCCESS)
427 {
428 0 result = GlobusWSAddressingErrorSerializeFailed(
429 result, "ReplyTo element");
430 0 goto exit;
431 }
432 }
433
434 12952 fault_endpoint = globus_soap_message_handle_get_attr(
435 message_handle,
436 WSADDR_FAULT_ENDPOINT_KEY);
437 12952 if(fault_endpoint)
438 {
439 0 result = wsa_EndpointReferenceType_serialize(
440 (xsd_QName *)&wsa_FaultTo_qname,
441 fault_endpoint,
442 message_handle,
443 0);
444 0 if(result != GLOBUS_SUCCESS)
445 {
446 0 result = GlobusWSAddressingErrorSerializeFailed(
447 result, "FaultTo element");
448 0 goto exit;
449 }
450 }
451
452 12952 if(endpoint_reference && endpoint_reference->ReferenceParameters)
453 {
454 wsa_ReferenceParametersType * props;
455 int i;
456
457 12582 props = endpoint_reference->ReferenceParameters;
458 25164 for(i = 0; i < props->any.length; ++i)
459 {
460 12582 result = globus_soap_message_add_callout(
461 message_handle,
462 props->any.elements[i].element,
463 NULL,
464 NULL,
465 globus_l_ws_addressing_refparam_attr);
466
467 12582 if(result != GLOBUS_SUCCESS)
468 {
469 0 goto exit;
470 }
471
472 12582 result = globus_soap_message_add_ns_callout(
473 message_handle,
474 props->any.elements[i].element,
475 globus_l_ws_addressing_refparam_ns_set,
476 globus_l_ws_addressing_refparam_ns_add,
477 globus_l_ws_addressing_refparam_ns_remove);
478 12582 if(result != GLOBUS_SUCCESS)
479 {
480 0 goto exit;
481 }
482
483 12582 if (props->any.elements[i].any_info ==
484 &globus_xml_buffer_contents_info)
485 {
486 /* Unparsed XML data. Serialize to DOM and then manually
487 * serialize element and attributes.
488 */
489 1851 result = globus_l_ws_addressing_serialize_refparam(
490 message_handle,
491 props->any.elements[0].value);
492 1851 if(result != GLOBUS_SUCCESS)
493 {
494 0 goto exit;
495 }
496 }
497 else
498 {
499 10731 result = props->any.elements[i].any_info->serialize(
500 props->any.elements[i].element,
501 props->any.elements[i].value,
502 message_handle,
503 0);
504 }
505 12582 if(result != GLOBUS_SUCCESS)
506 {
507 0 result = GlobusWSAddressingErrorSerializeFailed(
508 result, "Reference Parameters");
509 0 goto exit;
510 }
511 }
512 }
513
514 12952 globus_soap_message_handle_set_attr(
515 message_handle,
516 WS_ADDRESSING_CLIENT_REQUEST_ALREADY_INVOKED,
517 NULL, NULL, (void *)1);
518
519 12952 exit:
520
521 12952 GlobusWSAddressingDebugExit();
522
523 12952 return result;
524 }
525
526 static
527 globus_result_t
528 globus_l_handler_ws_addressing_client_invoke_MessageID(
529 globus_soap_message_handle_t message_handle,
530 globus_result_t result)
531 12889 {
532 wsa_AttributedURIType value;
533 globus_uuid_t message_uuid;
534 GlobusFuncName(globus_ws_addressing_handler_client_invoke_MessageID);
535 12889 GlobusWSAddressingDebugEnter();
536
537 12889 if(result != GLOBUS_SUCCESS)
538 {
539 0 goto exit;
540 }
541
542 12889 if(globus_soap_message_handle_get_attr(
543 message_handle,
544 WS_ADDRESSING_CLIENT_MESSAGEID_ALREADY_INVOKED))
545 {
546 0 goto exit;
547 }
548
549 12889 wsa_AttributedURIType_init_contents(&value);
550
551 12889 result = wsa_AttributedURIType_deserialize(
552 &wsa_MessageID_qname,
553 &value,
554 message_handle,
555 0);
556 12889 if(result != GLOBUS_SUCCESS)
557 {
558 0 result = GlobusWSAddressingErrorDeserializeFailed(
559 result,
560 ("Failed to deserialize MessageID"));
561 0 goto exit;
562 }
563
564 12889 result = globus_uuid_import(
565 &message_uuid, value.base_value + 5);
566 12889 if(result != GLOBUS_SUCCESS)
567 {
568 0 result = GlobusWSAddressingErrorDeserializeFailed(
569 GLOBUS_SUCCESS,
570 ("Failed to import uuid from string; %s",
571 value.base_value));
572 0 goto MessageID_destroy;
573 }
574
575 12889 globus_soap_message_handle_set_attr(
576 message_handle,
577 WSADDR_MESSAGE_ID_KEY,
578 globus_l_uuid_copy,
579 globus_libc_free,
580 (void *) &message_uuid);
581
582 12889 MessageID_destroy:
583
584 12889 wsa_AttributedURIType_destroy_contents(&value);
585
586 12889 globus_soap_message_handle_set_attr(
587 message_handle,
588 WS_ADDRESSING_CLIENT_MESSAGEID_ALREADY_INVOKED,
589 NULL, NULL, (void *)1);
590
591 12889 exit:
592
593 12889 GlobusWSAddressingDebugExit();
594
595 12889 return result;
596 }
597
598 static
599 globus_result_t
600 globus_l_handler_ws_addressing_client_invoke_compat_MessageID(
601 globus_soap_message_handle_t message_handle,
602 globus_result_t result)
603 0 {
604 wsacompat_AttributedURI value;
605 globus_uuid_t message_uuid;
606 GlobusFuncName(globus_ws_addressing_handler_client_invoke_MessageID);
607 0 GlobusWSAddressingDebugEnter();
608
609 0 if(result != GLOBUS_SUCCESS)
610 {
611 0 goto exit;
612 }
613
614 0 if(globus_soap_message_handle_get_attr(
615 message_handle,
616 WS_ADDRESSING_CLIENT_MESSAGEID_ALREADY_INVOKED))
617 {
618 0 goto exit;
619 }
620
621 0 wsacompat_AttributedURI_init_contents(&value);
622
623 0 result = wsacompat_AttributedURI_deserialize(
624 &wsacompat_MessageID_qname,
625 &value,
626 message_handle,
627 0);
628 0 if(result != GLOBUS_SUCCESS)
629 {
630 0 result = GlobusWSAddressingErrorDeserializeFailed(
631 result,
632 ("Failed to deserialize MessageID"));
633 0 goto exit;
634 }
635
636 0 result = globus_uuid_import(
637 &message_uuid, value.base_value + 5);
638 0 if(result != GLOBUS_SUCCESS)
639 {
640 0 result = GlobusWSAddressingErrorDeserializeFailed(
641 GLOBUS_SUCCESS,
642 ("Failed to import uuid from string; %s",
643 value.base_value));
644 0 goto MessageID_destroy;
645 }
646
647 0 globus_soap_message_handle_set_attr(
648 message_handle,
649 WSADDR_MESSAGE_ID_KEY,
650 globus_l_uuid_copy,
651 globus_libc_free,
652 (void *) &message_uuid);
653
654 0 globus_soap_message_handle_set_attr(
655 message_handle,
656 WS_ADDRESSING_CLIENT_RESPONSE_COMPAT_MODE,
657 NULL,
658 NULL,
659 (void *) 1);
660
661 0 MessageID_destroy:
662
663 0 wsacompat_AttributedURI_destroy_contents(&value);
664
665 0 globus_soap_message_handle_set_attr(
666 message_handle,
667 WS_ADDRESSING_CLIENT_MESSAGEID_ALREADY_INVOKED,
668 NULL, NULL, (void *)1);
669
670 0 exit:
671
672 0 GlobusWSAddressingDebugExit();
673
674 0 return result;
675 }
676
677 static
678 globus_result_t
679 globus_l_handler_ws_addressing_client_invoke_RelatesTo(
680 globus_soap_message_handle_t message_handle,
681 globus_result_t result)
682 12886 {
683 wsa_RelatesToType value;
684 globus_uuid_t * message_uuid;
685 12886 globus_uuid_t * outbound_uuid = NULL;
686 GlobusFuncName(globus_ws_addressing_handler_client_invoke_RelatesTo);
687 12886 GlobusWSAddressingDebugEnter();
688
689 12886 if(result != GLOBUS_SUCCESS)
690 {
691 0 goto exit;
692 }
693
694 12886 if(globus_soap_message_handle_get_attr(
695 message_handle,
696 WS_ADDRESSING_CLIENT_RELATESTO_ALREADY_INVOKED))
697 {
698 0 goto exit;
699 }
700
701 12886 wsa_RelatesToType_init_contents(&value);
702
703 12886 result = wsa_RelatesToType_deserialize(
704 &wsa_RelatesTo_qname,
705 &value,
706 message_handle,
707 0);
708 12886 if(result != GLOBUS_SUCCESS)
709 {
710 0 result = GlobusWSAddressingErrorDeserializeFailed(
711 result,
712 ("Failed to deserialize RelatesTo"));
713 0 goto exit;
714 }
715
716 12886 if(!value.base_value)
717 {
718 0 result = GlobusWSAddressingErrorDeserializeFailed(
719 GLOBUS_SUCCESS,
720 ("Failed to get required UUID value from "
721 "message information header element: RelatesTo"));
722 0 goto exit;
723 }
724
725 12886 message_uuid = globus_malloc(sizeof(globus_uuid_t));
726 12886 if(!message_uuid)
727 {
728 0 result = GlobusWSAddressingErrorMemoryAllocationFailed(
729 sizeof(globus_uuid_t), "message uuid");
730 0 goto exit;
731 }
732
733 12886 result = globus_uuid_import(
734 message_uuid, value.base_value + 5);
735 12886 if(result != GLOBUS_SUCCESS)
736 {
737 0 result = GlobusWSAddressingErrorDeserializeFailed(
738 GLOBUS_SUCCESS,
739 ("Failed to import uuid from string; %s",
740 value));
741 0 goto RelatesTo_destroy;
742 }
743
744 12886 outbound_uuid =
745 (globus_uuid_t *) globus_soap_message_handle_get_attr(
746 message_handle,
747 WSADDR_OUTBOUND_MESSAGE_ID_KEY);
748 12886 if(!outbound_uuid)
749 {
750 0 result = GlobusWSAddressingErrorDeserializeFailed(
751 GLOBUS_SUCCESS,
752 ("Failed to get request message UUID"
753 " from message properties"));
754 0 goto RelatesTo_destroy;
755 }
756
757 12886 if(! GLOBUS_UUID_MATCH((*outbound_uuid), (*message_uuid)))
758 {
759 0 result = GlobusWSAddressingErrorDeserializeFailed(
760 GLOBUS_SUCCESS,
761 ("UUID match failure: request message UUID: %s\n"
762 " response message UUID: %s\n",
763 outbound_uuid->text, message_uuid->text));
764 0 goto RelatesTo_destroy;
765 }
766
767 12886 globus_soap_message_handle_set_attr(
768 message_handle,
769 WSADDR_RELATES_TO_KEY,
770 globus_l_uuid_copy,
771 globus_libc_free,
772 (void *)message_uuid);
773
774 12886 globus_free(message_uuid);
775
776 12886 RelatesTo_destroy:
777
778 12886 wsa_RelatesToType_destroy_contents(&value);
779
780 12886 globus_soap_message_handle_set_attr(
781 message_handle,
782 WS_ADDRESSING_CLIENT_RELATESTO_ALREADY_INVOKED,
783 NULL, NULL, (void *)1);
784
785 12886 exit:
786
787 12886 GlobusWSAddressingDebugExit();
788 12886 return result;
789 }
790
791 static
792 globus_result_t
793 globus_l_handler_ws_addressing_client_invoke_compat_RelatesTo(
794 globus_soap_message_handle_t message_handle,
795 globus_result_t result)
796 0 {
797 wsacompat_Relationship value;
798 globus_uuid_t * message_uuid;
799 0 globus_uuid_t * outbound_uuid = NULL;
800 GlobusFuncName(globus_ws_addressing_handler_client_invoke_compat_RelatesTo);
801 0 GlobusWSAddressingDebugEnter();
802
803 0 if(result != GLOBUS_SUCCESS)
804 {
805 0 goto exit;
806 }
807
808 0 if(globus_soap_message_handle_get_attr(
809 message_handle,
810 WS_ADDRESSING_CLIENT_RELATESTO_ALREADY_INVOKED))
811 {
812 0 goto exit;
813 }
814
815 0 wsacompat_Relationship_init_contents(&value);
816
817 0 result = wsacompat_Relationship_deserialize(
818 &wsacompat_RelatesTo_qname,
819 &value,
820 message_handle,
821 0);
822 0 if(result != GLOBUS_SUCCESS)
823 {
824 0 result = GlobusWSAddressingErrorDeserializeFailed(
825 result,
826 ("Failed to deserialize RelatesTo"));
827 0 goto exit;
828 }
829
830 0 if(!value.base_value)
831 {
832 0 result = GlobusWSAddressingErrorDeserializeFailed(
833 GLOBUS_SUCCESS,
834 ("Failed to get required UUID value from "
835 "message information header element: RelatesTo"));
836 0 goto exit;
837 }
838
839 0 message_uuid = globus_malloc(sizeof(globus_uuid_t));
840 0 if(!message_uuid)
841 {
842 0 result = GlobusWSAddressingErrorMemoryAllocationFailed(
843 sizeof(globus_uuid_t), "message uuid");
844 0 goto exit;
845 }
846
847 0 result = globus_uuid_import(
848 message_uuid, value.base_value + 5);
849 0 if(result != GLOBUS_SUCCESS)
850 {
851 0 result = GlobusWSAddressingErrorDeserializeFailed(
852 GLOBUS_SUCCESS,
853 ("Failed to import uuid from string; %s",
854 value));
855 0 goto RelatesTo_destroy;
856 }
857
858 0 outbound_uuid =
859 (globus_uuid_t *) globus_soap_message_handle_get_attr(
860 message_handle,
861 WSADDR_OUTBOUND_MESSAGE_ID_KEY);
862 0 if(!outbound_uuid)
863 {
864 0 result = GlobusWSAddressingErrorDeserializeFailed(
865 GLOBUS_SUCCESS,
866 ("Failed to get request message UUID"
867 " from message properties"));
868 0 goto RelatesTo_destroy;
869 }
870
871 0 if(! GLOBUS_UUID_MATCH((*outbound_uuid), (*message_uuid)))
872 {
873 0 result = GlobusWSAddressingErrorDeserializeFailed(
874 GLOBUS_SUCCESS,
875 ("UUID match failure: request message UUID: %s\n"
876 " response message UUID: %s\n",
877 outbound_uuid->text, message_uuid->text));
878 0 goto RelatesTo_destroy;
879 }
880
881 0 globus_soap_message_handle_set_attr(
882 message_handle,
883 WSADDR_RELATES_TO_KEY,
884 globus_l_uuid_copy,
885 globus_libc_free,
886 (void *)message_uuid);
887
888 0 globus_free(message_uuid);
889
890 0 RelatesTo_destroy:
891
892 0 wsacompat_Relationship_destroy_contents(&value);
893
894 0 globus_soap_message_handle_set_attr(
895 message_handle,
896 WS_ADDRESSING_CLIENT_RELATESTO_ALREADY_INVOKED,
897 NULL, NULL, (void *)1);
898 0 globus_soap_message_handle_set_attr(
899 message_handle,
900 WS_ADDRESSING_CLIENT_RESPONSE_COMPAT_MODE,
901 NULL,
902 NULL,
903 (void *) 1);
904
905
906 0 exit:
907
908 0 GlobusWSAddressingDebugExit();
909 0 return result;
910 }
911
912 static
913 globus_result_t
914 globus_l_handler_ws_addressing_client_invoke_To(
915 globus_soap_message_handle_t message_handle,
916 globus_result_t result)
917 12887 {
918 wsa_AttributedURIType value;
919 12887 char * source_endpoint = NULL;
920 GlobusFuncName(globus_ws_addressing_handler_client_invoke_To);
921 12887 GlobusWSAddressingDebugEnter();
922
923 12887 if(result != GLOBUS_SUCCESS)
924 {
925 0 goto exit;
926 }
927
928 12887 if(globus_soap_message_handle_get_attr(
929 message_handle,
930 WS_ADDRESSING_CLIENT_TO_ALREADY_INVOKED))
931 {
932 0 goto exit;
933 }
934
935 12887 wsa_AttributedURIType_init_contents(&value);
936
937 12887 result = wsa_AttributedURIType_deserialize(
938 &wsa_To_qname,
939 &value,
940 message_handle,
941 0);
942 12887 if(result != GLOBUS_SUCCESS)
943 {
944 0 result = GlobusWSAddressingErrorDeserializeFailed(
945 result,
946 ("Failed to deserialize Action"));
947 0 goto exit;
948 }
949
950 12887 source_endpoint = globus_soap_message_handle_get_attr(
951 message_handle,
952 WSADDR_SOURCE_ENDPOINT_KEY);
953 12887 if(source_endpoint && strcmp(source_endpoint, value.base_value))
954 {
955 0 result = GlobusWSAddressingErrorDeserializeFailed(
956 GLOBUS_SUCCESS,
957 ("Expected source endpoint: %s in "
958 "To field of reply, received: %s",
959 source_endpoint,
960 value.base_value));
961 0 goto To_destroy;
962 }
963 12887 else if(!source_endpoint && strncmp(WSADDRESSING_ANON_NS,
964 value.base_value,
965 sizeof(WSADDRESSING_ANON_NS)))
966 {
967 0 result = GlobusWSAddressingErrorDeserializeFailed(
968 GLOBUS_SUCCESS,
969 ("Expected anonymous endpoint in "
970 "To field of reply"));
971 0 goto To_destroy;
972 }
973
974 12887 To_destroy:
975
976 12887 wsa_AttributedURIType_destroy_contents(&value);
977
978 12887 globus_soap_message_handle_set_attr(
979 message_handle,
980 WS_ADDRESSING_CLIENT_TO_ALREADY_INVOKED,
981 NULL, NULL, (void *)1);
982
983 12887 exit:
984
985 12887 GlobusWSAddressingDebugExit();
986 12887 return result;
987 }
988
989 static
990 globus_result_t
991 globus_l_handler_ws_addressing_client_invoke_compat_To(
992 globus_soap_message_handle_t message_handle,
993 globus_result_t result)
994 0 {
995 wsacompat_AttributedURI value;
996 0 char * source_endpoint = NULL;
997 GlobusFuncName(globus_ws_addressing_handler_client_invoke_compat_To);
998 0 GlobusWSAddressingDebugEnter();
999
1000 0 if(result != GLOBUS_SUCCESS)
1001 {
1002 0 goto exit;
1003 }
1004
1005 0 if(globus_soap_message_handle_get_attr(
1006 message_handle,
1007 WS_ADDRESSING_CLIENT_TO_ALREADY_INVOKED))
1008 {
1009 0 goto exit;
1010 }
1011
1012 0 wsacompat_AttributedURI_init_contents(&value);
1013
1014 0 result = wsacompat_AttributedURI_deserialize(
1015 &wsacompat_To_qname,
1016 &value,
1017 message_handle,
1018 0);
1019 0 if(result != GLOBUS_SUCCESS)
1020 {
1021 0 result = GlobusWSAddressingErrorDeserializeFailed(
1022 result,
1023 ("Failed to deserialize wsa:To"));
1024 0 goto exit;
1025 }
1026
1027 0 source_endpoint = globus_soap_message_handle_get_attr(
1028 message_handle,
1029 WSADDR_SOURCE_ENDPOINT_KEY);
1030 0 if(source_endpoint && strcmp(source_endpoint, value.base_value))
1031 {
1032 0 result = GlobusWSAddressingErrorDeserializeFailed(
1033 GLOBUS_SUCCESS,
1034 ("Expected source endpoint: %s in "
1035 "To field of reply, received: %s",
1036 source_endpoint,
1037 value.base_value));
1038 0 goto To_destroy;
1039 }
1040 0 else if(!source_endpoint &&
1041 strcmp(WSADDRESSING_COMPAT_ANON_NS, value.base_value))
1042 {
1043 0 result = GlobusWSAddressingErrorDeserializeFailed(
1044 GLOBUS_SUCCESS,
1045 ("Expected anonymous endpoint in "
1046 "To field of reply"));
1047 0 goto To_destroy;
1048 }
1049
1050 0 To_destroy:
1051
1052 0 wsacompat_AttributedURI_destroy_contents(&value);
1053
1054 0 globus_soap_message_handle_set_attr(
1055 message_handle,
1056 WS_ADDRESSING_CLIENT_TO_ALREADY_INVOKED,
1057 NULL, NULL, (void *)1);
1058 0 globus_soap_message_handle_set_attr(
1059 message_handle,
1060 WS_ADDRESSING_CLIENT_RESPONSE_COMPAT_MODE,
1061 NULL,
1062 NULL,
1063 (void *) 1);
1064
1065 0 exit:
1066
1067 0 GlobusWSAddressingDebugExit();
1068 0 return result;
1069 }
1070
1071 static
1072 globus_result_t
1073 globus_l_handler_ws_addressing_client_invoke_Action(
1074 globus_soap_message_handle_t message_handle,
1075 globus_result_t result)
1076 12886 {
1077 wsa_AttributedURIType value;
1078 12886 char * response_action = NULL;
1079 GlobusFuncName(globus_ws_addressing_handler_client_invoke_Action);
1080 12886 GlobusWSAddressingDebugEnter();
1081
1082 12886 if(result != GLOBUS_SUCCESS)
1083 {
1084 0 goto exit;
1085 }
1086
1087 12886 if(globus_soap_message_handle_get_attr(
1088 message_handle,
1089 WS_ADDRESSING_CLIENT_ACTION_ALREADY_INVOKED))
1090 {
1091 0 goto exit;
1092 }
1093
1094 12886 wsa_AttributedURIType_init_contents(&value);
1095
1096 12886 result = wsa_AttributedURIType_deserialize(
1097 &wsa_Action_qname,
1098 &value,
1099 message_handle,
1100 0);
1101 12886 if(result != GLOBUS_SUCCESS)
1102 {
1103 0 result = GlobusWSAddressingErrorDeserializeFailed(
1104 result,
1105 ("Failed to deserialize Action"));
1106 0 goto exit;
1107 }
1108
1109 12886 if(!strncmp(WSADDRESSING_FAULT_NS,
1110 value.base_value,
1111 sizeof(WSADDRESSING_FAULT_NS)))
1112 {
1113 /* found a fault */
1114 251 result = GLOBUS_SUCCESS;
1115 251 goto Action_destroy;
1116 }
1117
1118 12635 response_action = globus_soap_message_handle_get_attr(
1119 message_handle,
1120 WSADDR_ACTION_RESPONSE_KEY);
1121 12635 if(!response_action || strcmp(response_action, value.base_value))
1122 {
1123 0 result = GlobusWSAddressingErrorDeserializeFailed(
1124 GLOBUS_SUCCESS,
1125 ("\nExpected Action element: %s"
1126 "\n But received: %s",
1127 response_action,
1128 (value.base_value ? value.base_value : "(null)")));
1129 0 goto Action_destroy;
1130 }
1131
1132 12635 globus_soap_message_handle_set_attr(
1133 message_handle,
1134 WSADDR_ACTION_RESPONSE_KEY,
1135 globus_soap_message_attr_copy_string,
1136 globus_libc_free,
1137 value.base_value);
1138
1139 12886 Action_destroy:
1140
1141 12886 wsa_AttributedURIType_destroy_contents(&value);
1142
1143 12886 globus_soap_message_handle_set_attr(
1144 message_handle,
1145 WS_ADDRESSING_CLIENT_ACTION_ALREADY_INVOKED,
1146 NULL, NULL, (void *)1);
1147
1148 12886 exit:
1149
1150 12886 GlobusWSAddressingDebugExit();
1151 12886 return result;
1152 }
1153
1154 static
1155 globus_result_t
1156 globus_l_handler_ws_addressing_client_invoke_compat_Action(
1157 globus_soap_message_handle_t message_handle,
1158 globus_result_t result)
1159 0 {
1160 wsacompat_AttributedURI value;
1161 0 char * response_action = NULL;
1162 GlobusFuncName(globus_ws_addressing_handler_client_invoke_compat_Action);
1163 0 GlobusWSAddressingDebugEnter();
1164
1165 0 if(result != GLOBUS_SUCCESS)
1166 {
1167 0 goto exit;
1168 }
1169
1170 0 if(globus_soap_message_handle_get_attr(
1171 message_handle,
1172 WS_ADDRESSING_CLIENT_ACTION_ALREADY_INVOKED))
1173 {
1174 0 goto exit;
1175 }
1176
1177 0 wsacompat_AttributedURI_init_contents(&value);
1178
1179 0 result = wsacompat_AttributedURI_deserialize(
1180 &wsacompat_Action_qname,
1181 &value,
1182 message_handle,
1183 0);
1184 0 if(result != GLOBUS_SUCCESS)
1185 {
1186 0 result = GlobusWSAddressingErrorDeserializeFailed(
1187 result,
1188 ("Failed to deserialize Action"));
1189 0 goto exit;
1190 }
1191
1192 0 if(!strcmp(WSADDRESSING_COMPAT_FAULT_NS, value.base_value))
1193 {
1194 /* found a fault */
1195 0 result = GlobusWSAddressingErrorProtocolVersionMismatchServer(GLOBUS_SUCCESS);
1196 0 goto Action_destroy;
1197 }
1198
1199 0 response_action = globus_soap_message_handle_get_attr(
1200 message_handle,
1201 WSADDR_ACTION_RESPONSE_KEY);
1202 0 if(!response_action || strcmp(response_action, value.base_value))
1203 {
1204 0 result = GlobusWSAddressingErrorDeserializeFailed(
1205 GLOBUS_SUCCESS,
1206 ("\nExpected Action element: %s"
1207 "\n But received: %s",
1208 response_action,
1209 (value.base_value ? value.base_value : "(null)")));
1210 goto Action_destroy;
1211 }
1212
1213 0 Action_destroy:
1214
1215 0 globus_soap_message_handle_set_attr(
1216 message_handle,
1217 WSADDR_ACTION_RESPONSE_KEY,
1218 globus_soap_message_attr_copy_string,
1219 globus_libc_free,
1220 value.base_value);
1221
1222 0 wsacompat_AttributedURI_destroy_contents(&value);
1223
1224 0 globus_soap_message_handle_set_attr(
1225 message_handle,
1226 WS_ADDRESSING_CLIENT_ACTION_ALREADY_INVOKED,
1227 NULL, NULL, (void *)1);
1228 0 globus_soap_message_handle_set_attr(
1229 message_handle,
1230 WS_ADDRESSING_CLIENT_RESPONSE_COMPAT_MODE,
1231 NULL,
1232 NULL,
1233 (void *) 1);
1234
1235 0 exit:
1236
1237 0 GlobusWSAddressingDebugExit();
1238 0 return result;
1239 }
1240
1241 static
1242 globus_result_t
1243 globus_l_handler_ws_addressing_client_invoke_From(
1244 globus_soap_message_handle_t message_handle,
1245 globus_result_t result)
1246 12889 {
1247 char * destination;
1248 wsa_EndpointReferenceType * from_epr;
1249 GlobusFuncName(globus_ws_addressing_handler_client_invoke_From);
1250 12889 GlobusWSAddressingDebugEnter();
1251
1252 12889 if(result != GLOBUS_SUCCESS)
1253 {
1254 0 goto exit;
1255 }
1256
1257 12889 if(globus_soap_message_handle_get_attr(
1258 message_handle,
1259 WS_ADDRESSING_CLIENT_FROM_ALREADY_INVOKED))
1260 {
1261 0 goto exit;
1262 }
1263
1264 12889 wsa_EndpointReferenceType_init(
1265 &from_epr);
1266
1267 12889 result = wsa_EndpointReferenceType_deserialize(
1268 &wsa_From_qname,
1269 from_epr,
1270 message_handle,
1271 0);
1272 12889 if(result != GLOBUS_SUCCESS)
1273 {
1274 3 result = GlobusWSAddressingErrorDeserializeFailed(
1275 result, ("Failed to deserialize From element"));
1276 3 goto exit;
1277 }
1278
1279 12886 destination =
1280 globus_soap_message_handle_get_attr(
1281 message_handle,
1282 WSADDR_DESTINATION_KEY);
1283 12886 if(!destination)
1284 {
1285 0 result = GlobusWSAddressingErrorDeserializeFailed(
1286 GLOBUS_SUCCESS,
1287 ("No destination endpoint"));
1288 0 goto destroy_From;
1289 }
1290
1291 12886 if(xmlStrcmp((xmlChar *) destination, (xmlChar *) from_epr->Address.base_value))
1292 {
1293 0 result = GlobusWSAddressingErrorDeserializeFailed(
1294 GLOBUS_SUCCESS,
1295 ("Received From:Address: %s\nExpected: %s",
1296 from_epr->Address.base_value, destination));
1297 0 goto destroy_From;
1298 }
1299
1300 12886 result = globus_soap_message_handle_set_attr(
1301 message_handle, WSADDR_EPR_KEY,
1302 wsa_EndpointReferenceType_info.copy,
1303 wsa_EndpointReferenceType_info.destroy,
1304 (void *)from_epr);
1305 12886 if(result != GLOBUS_SUCCESS)
1306 {
1307 0 result = GlobusWSAddressingErrorDeserializeFailed(
1308 result, ("Failed to set EndpointReference "
1309 "in message properties"));
1310 0 goto destroy_From;
1311 }
1312
1313 12886 destroy_From:
1314
1315 12886 wsa_EndpointReferenceType_destroy(from_epr);
1316
1317 12886 globus_soap_message_handle_set_attr(
1318 message_handle,
1319 WS_ADDRESSING_CLIENT_FROM_ALREADY_INVOKED,
1320 NULL, NULL, (void *)1);
1321
1322 12889 exit:
1323
1324 12889 GlobusWSAddressingDebugExit();
1325 12889 return result;
1326 }
1327
1328 static
1329 globus_result_t
1330 globus_l_handler_ws_addressing_client_invoke_compat_From(
1331 globus_soap_message_handle_t message_handle,
1332 globus_result_t result)
1333 0 {
1334 char * destination;
1335 wsacompat_EndpointReferenceType compat_from_epr;
1336 wsa_EndpointReferenceType * from_epr;
1337 GlobusFuncName(globus_ws_addressing_handler_client_invoke_compat_From);
1338 0 GlobusWSAddressingDebugEnter();
1339
1340 0 if(result != GLOBUS_SUCCESS)
1341 {
1342 0 goto exit;
1343 }
1344
1345 0 if(globus_soap_message_handle_get_attr(
1346 message_handle,
1347 WS_ADDRESSING_CLIENT_FROM_ALREADY_INVOKED))
1348 {
1349 0 goto exit;
1350 }
1351
1352 0 result = wsacompat_EndpointReferenceType_init_contents(
1353 &compat_from_epr);
1354
1355 0 if (result != GLOBUS_SUCCESS)
1356 {
1357 0 result = GlobusWSAddressingErrorDeserializeFailed(
1358 result, ("Failed to deserialize From element"));
1359 0 goto exit;
1360 }
1361
1362 0 result = wsacompat_EndpointReferenceType_deserialize(
1363 &wsacompat_From_qname,
1364 &compat_from_epr,
1365 message_handle,
1366 0);
1367 0 if(result != GLOBUS_SUCCESS)
1368 {
1369 0 result = GlobusWSAddressingErrorDeserializeFailed(
1370 result, ("Failed to deserialize From element"));
1371 0 goto exit;
1372 }
1373 0 result = wsa_EndpointReferenceType_init(&from_epr);
1374 0 if(result != GLOBUS_SUCCESS)
1375 {
1376 0 result = GlobusWSAddressingErrorDeserializeFailed(
1377 result, ("Failed to deserialize From element"));
1378 0 goto destroy_compat_From;
1379 }
1380
1381 0 result = globus_l_wsa_convert_old_epr(from_epr, &compat_from_epr);
1382 0 if(result != GLOBUS_SUCCESS)
1383 {
1384 0 result = GlobusWSAddressingErrorDeserializeFailed(
1385 result, ("Failed to deserialize From element"));
1386 0 goto destroy_From;
1387 }
1388
1389 0 destination =
1390 globus_soap_message_handle_get_attr(
1391 message_handle,
1392 WSADDR_DESTINATION_KEY);
1393 0 if(!destination)
1394 {
1395 0 result = GlobusWSAddressingErrorDeserializeFailed(
1396 GLOBUS_SUCCESS,
1397 ("No destination endpoint"));
1398 0 goto destroy_From;
1399 }
1400
1401 0 if(xmlStrcmp((xmlChar *) destination, (xmlChar *) from_epr->Address.base_value))
1402 {
1403 0 result = GlobusWSAddressingErrorDeserializeFailed(
1404 GLOBUS_SUCCESS,
1405 ("Received From:Address: %s\nExpected: %s",
1406 from_epr->Address.base_value, destination));
1407 0 goto destroy_From;
1408 }
1409
1410 0 result = globus_soap_message_handle_set_attr(
1411 message_handle, WSADDR_EPR_KEY,
1412 wsa_EndpointReferenceType_info.copy,
1413 wsa_EndpointReferenceType_info.destroy,
1414 (void *)from_epr);
1415 0 if(result != GLOBUS_SUCCESS)
1416 {
1417 0 result = GlobusWSAddressingErrorDeserializeFailed(
1418 result, ("Failed to set EndpointReference "
1419 "in message properties"));
1420 0 goto destroy_From;
1421 }
1422
1423 0 destroy_From:
1424
1425 0 wsa_EndpointReferenceType_destroy(from_epr);
1426
1427 0 destroy_compat_From:
1428 0 wsacompat_EndpointReferenceType_destroy_contents(&compat_from_epr);
1429
1430 0 globus_soap_message_handle_set_attr(
1431 message_handle,
1432 WS_ADDRESSING_CLIENT_FROM_ALREADY_INVOKED,
1433 NULL, NULL, (void *)1);
1434 0 globus_soap_message_handle_set_attr(
1435 message_handle,
1436 WS_ADDRESSING_CLIENT_RESPONSE_COMPAT_MODE,
1437 NULL,
1438 NULL,
1439 (void *) 1);
1440
1441 0 exit:
1442
1443 0 GlobusWSAddressingDebugExit();
1444 0 return result;
1445 }
1446
1447 static
1448 globus_result_t
1449 globus_handler_ws_addressing_client_response_invoke(
1450 globus_soap_message_handle_t message_handle,
1451 globus_result_t result)
1452 12635 {
1453 GlobusFuncName(globus_ws_addressing_handler_client_response_invoke);
1454 12635 GlobusWSAddressingDebugEnter();
1455
1456 12635 if(globus_soap_message_handle_get_attr(
1457 message_handle,
1458 WS_ADDRESSING_CLIENT_RESPONSE_ALREADY_INVOKED))
1459 {
1460 0 goto exit;
1461 }
1462
1463 12635 if (globus_soap_message_handle_get_attr(
1464 message_handle,
1465 WS_ADDRESSING_CLIENT_RESPONSE_COMPAT_MODE))
1466 {
1467 char * action;
1468
1469 0 action = globus_soap_message_handle_get_attr(
1470 message_handle,
1471 WSADDR_ACTION_RESPONSE_KEY);
1472
1473 0 if (! strcmp(action, WSADDRESSING_COMPAT_FAULT_NS))
1474 {
1475 0 globus_object_t * err = globus_error_get(result);
1476
1477 /*
1478 * Fault response from an old server, recast this as a protocol
1479 * mismatch fault
1480 */
1481 0 result = GlobusWSAddressingErrorProtocolVersionMismatchServer(err);
1482
1483 0 goto exit;
1484 }
1485 }
1486
1487
1488 12635 if(!globus_soap_message_handle_get_attr(
1489 message_handle,
1490 WSADDR_ACTION_RESPONSE_KEY))
1491 {
1492 0 result = GlobusWSAddressingErrorRequiredElementNotFound(
1493 "{"WSADDRESSING_NS"}Action");
1494 0 goto exit;
1495 }
1496
1497 12635 if(!globus_soap_message_handle_get_attr(
1498 message_handle,
1499 WSADDR_DESTINATION_KEY))
1500 {
1501 0 result = GlobusWSAddressingErrorRequiredElementNotFound(
1502 "{"WSADDRESSING_NS"}To");
1503 0 goto exit;
1504 }
1505
1506 12635 if(!globus_soap_message_handle_get_attr(
1507 message_handle,
1508 WSADDR_RELATES_TO_KEY))
1509 {
1510 0 result = GlobusWSAddressingErrorRequiredElementNotFound(
1511 "{"WSADDRESSING_NS"}RelatesTo");
1512 0 goto exit;
1513 }
1514
1515 12635 globus_soap_message_handle_set_attr(
1516 message_handle,
1517 WS_ADDRESSING_CLIENT_RESPONSE_ALREADY_INVOKED,
1518 NULL, NULL, (void *)1);
1519
1520 12635 exit:
1521
1522 12635 GlobusWSAddressingDebugExit();
1523 12635 return result;
1524 }
1525
1526
1527 globus_result_t
1528 globus_handler_ws_addressing_server_response_invoke(
1529 globus_soap_message_handle_t message_handle,
1530 globus_result_t result)
1531 10903 {
1532 globus_uuid_t uuid;
1533 10903 char * uuid_string = NULL;
1534 wsa_AttributedURIType MessageID;
1535 wsa_AttributedURIType To;
1536 wsa_AttributedURIType Action;
1537 wsa_RelatesToType RelatesTo;
1538 10903 char * soap_action = NULL;
1539 10903 wsa_EndpointReferenceType * endpoint_reference = NULL;
1540 10903 wsa_EndpointReferenceType * source_endpoint = NULL;
1541 wsa_EndpointReferenceType default_From;
1542 globus_bool_t compat_mode;
1543 GlobusFuncName(globus_handler_ws_addressing_server_response_invoke);
1544 10903 GlobusWSAddressingDebugEnter();
1545
1546 10903 if(result != GLOBUS_SUCCESS)
1547 {
1548 0 goto exit;
1549 }
1550
1551 10903 compat_mode = (globus_bool_t) globus_soap_message_handle_get_attr(
1552 message_handle,
1553 WS_ADDRESSING_SERVER_REQUEST_COMPAT_MODE);
1554
1555 10903 if(globus_soap_message_handle_get_attr(
1556 message_handle,
1557 WS_ADDRESSING_SERVER_RESPONSE_ALREADY_INVOKED))
1558 {
1559 0 goto exit;
1560 }
1561
1562 10903 endpoint_reference = globus_soap_message_handle_get_attr(
1563 message_handle, WSADDR_OUTBOUND_EPR_KEY);
1564 10903 if(!endpoint_reference)
1565 {
1566 10903 endpoint_reference = (wsa_EndpointReferenceType *)
1567 globus_soap_message_handle_get_attr(
1568 message_handle, WSADDR_EPR_KEY);
1569 }
1570
1571 10903 globus_uuid_create(&uuid);
1572 10903 uuid_string = globus_common_create_string("uuid:%s", uuid.text);
1573
1574 10903 if (compat_mode)
1575 {
1576 wsacompat_AttributedURI compat_MessageID;
1577
1578 0 compat_MessageID.base_value = uuid_string;
1579 0 compat_MessageID.anyAttributes = NULL;
1580
1581 0 result = wsacompat_AttributedURI_serialize(
1582 &wsacompat_MessageID_qname,
1583 &compat_MessageID,
1584 message_handle,
1585 0);
1586 }
1587 else
1588 {
1589 10903 MessageID.base_value = uuid_string;
1590 10903 MessageID.anyAttributes = NULL;
1591
1592 10903 result = wsa_AttributedURIType_serialize(
1593 (xsd_QName *)&wsa_MessageID_qname,
1594 &MessageID,
1595 message_handle,
1596 0);
1597 }
1598 10903 free(uuid_string);
1599
1600 10903 if(result != GLOBUS_SUCCESS)
1601 {
1602 0 result = GlobusWSAddressingErrorSerializeFailed(
1603 result, "MessageID element");
1604 0 goto exit;
1605 }
1606
1607 10903 if (compat_mode)
1608 {
1609 wsacompat_AttributedURI compat_To;
1610
1611 0 compat_To.anyAttributes = NULL;
1612 0 compat_To.base_value = globus_soap_message_handle_get_attr(
1613 message_handle, WSADDR_REQUEST_ENDPOINT_KEY);
1614 0 result = wsacompat_AttributedURI_serialize(
1615 &wsacompat_To_qname,
1616 &compat_To,
1617 message_handle,
1618 0);
1619 0 if(result != GLOBUS_SUCCESS)
1620 {
1621 0 result = GlobusWSAddressingErrorSerializeFailed(
1622 result, "To element");
1623 0 goto exit;
1624 }
1625 }
1626 else
1627 {
1628 10903 To.anyAttributes = NULL;
1629 10903 To.base_value = globus_soap_message_handle_get_attr(
1630 message_handle, WSADDR_REQUEST_ENDPOINT_KEY);
1631 10903 result = wsa_AttributedURIType_serialize(
1632 &wsa_To_qname,
1633 &To,
1634 message_handle,
1635 0);
1636 10903 if(result != GLOBUS_SUCCESS)
1637 {
1638 0 result = GlobusWSAddressingErrorSerializeFailed(
1639 result, "To element");
1640 0 goto exit;
1641 }
1642 }
1643
1644 10903 source_endpoint = globus_soap_message_handle_get_attr(
1645 message_handle, WSADDR_SOURCE_ENDPOINT_KEY);
1646 10903 if(! source_endpoint)
1647 {
1648 10903 result = wsa_EndpointReferenceType_init_contents(&default_From);
1649
1650 10903 default_From.Address.base_value =
1651 globus_soap_message_handle_get_attr(
1652 message_handle,
1653 GLOBUS_SOAP_MESSAGE_SERVICE_ENDPOINT_KEY);
1654 10903 if (endpoint_reference && endpoint_reference->ReferenceParameters)
1655 {
1656 10575 default_From.ReferenceParameters =
1657 endpoint_reference->ReferenceParameters;
1658 }
1659 10903 source_endpoint = &default_From;
1660 }
1661
1662 10903 if (compat_mode)
1663 {
1664 wsacompat_EndpointReferenceType compat_source_endpoint;
1665
1666 0 result = wsacompat_EndpointReferenceType_init_contents(
1667 &compat_source_endpoint);
1668 0 if(result != GLOBUS_SUCCESS)
1669 {
1670 0 result = GlobusWSAddressingErrorSerializeFailed(
1671 GLOBUS_FAILURE, "From element");
1672 0 goto exit;
1673 }
1674
1675 0 result = globus_l_wsa_convert_new_epr(
1676 &compat_source_endpoint,
1677 source_endpoint);
1678 0 if(result != GLOBUS_SUCCESS)
1679 {
1680 0 result = GlobusWSAddressingErrorSerializeFailed(
1681 GLOBUS_FAILURE, "From element");
1682 0 goto exit;
1683 }
1684
1685 0 result = wsacompat_EndpointReferenceType_serialize(
1686 &wsacompat_From_qname,
1687 &compat_source_endpoint,
1688 message_handle,
1689 0);
1690 0 if(result != GLOBUS_SUCCESS)
1691 {
1692 0 result = GlobusWSAddressingErrorSerializeFailed(
1693 GLOBUS_FAILURE, "From element");
1694 0 goto exit;
1695 }
1696 0 wsacompat_EndpointReferenceType_destroy_contents(
1697 &compat_source_endpoint);
1698 }
1699 else
1700 {
1701 10903 result = wsa_EndpointReferenceType_serialize(
1702 (xsd_QName *)&wsa_From_qname,
1703 source_endpoint,
1704 message_handle,
1705 0);
1706 10903 if(result != GLOBUS_SUCCESS)
1707 {
1708 0 result = GlobusWSAddressingErrorSerializeFailed(
1709 GLOBUS_FAILURE, "{"WSADDRESSING_NS"}From element");
1710 0 goto exit;
1711 }
1712 }
1713
1714 10903 soap_action = globus_soap_message_handle_get_attr(
1715 message_handle, WSADDR_ACTION_RESPONSE_KEY);
1716 10903 if(!soap_action)
1717 {
1718 0 result = GlobusWSAddressingErrorSerializeFailed(
1719 GLOBUS_FAILURE,
1720 "No "WSADDRESSING_NS
1721 "#ResponseAction property defined");
1722 0 goto exit;
1723 }
1724
1725 10903 if (compat_mode)
1726 {
1727 wsacompat_AttributedURI compat_Action;
1728
1729 0 compat_Action.base_value = soap_action;
1730 0 compat_Action.anyAttributes = NULL;
1731
1732 0 result = wsacompat_AttributedURI_serialize(
1733 &wsacompat_Action_qname,
1734 &compat_Action,
1735 message_handle,
1736 0);
1737 }
1738 else
1739 {
1740 10903 Action.base_value = soap_action;
1741 10903 Action.anyAttributes = NULL;
1742
1743 10903 result = wsa_AttributedURIType_serialize(
1744 (xsd_QName *)&wsa_Action_qname,
1745 &Action,
1746 message_handle,
1747 0);
1748 }
1749 10903 if(result != GLOBUS_SUCCESS)
1750 {
1751 0 result = GlobusWSAddressingErrorSerializeFailed(
1752 result, "Action element");
1753 0 goto exit;
1754 }
1755
1756 10903 uuid_string = globus_soap_message_handle_get_attr(
1757 message_handle,
1758 WSADDR_INBOUND_MESSAGE_ID_KEY);
1759 10903 if(!uuid_string)
1760 {
1761 3 result = GlobusWSAddressingErrorSerializeFailed(
1762 result, "RelatesTo element");
1763 3 goto exit;
1764 }
1765
1766 10900 if (compat_mode)
1767 {
1768 wsacompat_Relationship compat_RelatesTo;
1769
1770 0 result = wsacompat_Relationship_init_contents(&compat_RelatesTo);
1771 0 if (result != GLOBUS_SUCCESS)
1772 {
1773 0 result = GlobusWSAddressingErrorSerializeFailed(
1774 result, "RelatesTo element");
1775 0 free(uuid_string);
1776 0 goto exit;
1777 }
1778 0 compat_RelatesTo.base_value = uuid_string;
1779
1780 0 result = wsacompat_Relationship_serialize(
1781 &wsacompat_RelatesTo_qname,
1782 &compat_RelatesTo,
1783 message_handle,
1784 0);
1785 }
1786 else
1787 {
1788 10900 result = wsa_RelatesToType_init_contents(&RelatesTo);
1789 10900 if (result != GLOBUS_SUCCESS)
1790 {
1791 0 result = GlobusWSAddressingErrorSerializeFailed(
1792 result, "RelatesTo element");
1793 0 free(uuid_string);
1794 0 goto exit;
1795 }
1796 10900 RelatesTo.base_value = uuid_string;
1797
1798 10900 result = wsa_RelatesToType_serialize(
1799 (xsd_QName *)&wsa_RelatesTo_qname,
1800 &RelatesTo,
1801 message_handle,
1802 0);
1803 }
1804 10900 if(result != GLOBUS_SUCCESS)
1805 {
1806 0 result = GlobusWSAddressingErrorSerializeFailed(
1807 result, "RelatesTo element");
1808 0 goto exit;
1809 }
1810
1811 10900 globus_soap_message_handle_set_attr(
1812 message_handle,
1813 WS_ADDRESSING_SERVER_RESPONSE_ALREADY_INVOKED,
1814 NULL, NULL, (void *)1);
1815
1816 10903 exit:
1817
1818 10903 GlobusWSAddressingDebugExit();
1819 10903 return result;
1820 }
1821
1822
1823
1824 static
1825 globus_result_t
1826 globus_l_handler_ws_addressing_server_invoke_MessageID(
1827 globus_soap_message_handle_t message_handle,
1828 globus_result_t result)
1829 10980 {
1830 wsa_AttributedURIType messID;
1831 GlobusFuncName(globus_handler_ws_addressing_server_invoke_MessageID);
1832 10980 GlobusWSAddressingDebugEnter();
1833
1834 10980 if(result != GLOBUS_SUCCESS)
1835 {
1836 0 goto exit;
1837 }
1838
1839 10980 if(globus_soap_message_handle_get_attr(
1840 message_handle,
1841 WS_ADDRESSING_SERVER_MESSAGEID_ALREADY_INVOKED))
1842 {
1843 0 goto exit;
1844 }
1845
1846
1847 10980 wsa_AttributedURIType_init_contents(&messID);
1848
1849 10980 result = wsa_AttributedURIType_deserialize(
1850 &wsa_MessageID_qname,
1851 &messID,
1852 message_handle,
1853 0);
1854 10980 if(result != GLOBUS_SUCCESS)
1855 {
1856 0 result = GlobusWSAddressingErrorDeserializeFailed(
1857 result, ("Failed to deserialize MessageID element"));
1858 0 goto exit;
1859 }
1860
1861 10980 globus_soap_message_handle_set_attr(
1862 message_handle,
1863 WSADDR_INBOUND_MESSAGE_ID_KEY,
1864 globus_soap_message_attr_copy_string,
1865 globus_libc_free,
1866 messID.base_value);
1867
1868 10980 wsa_AttributedURIType_destroy_contents(&messID);
1869
1870 10980 globus_soap_message_remove_required_header_element(
1871 message_handle, &wsa_MessageID_qname);
1872
1873 10980 globus_soap_message_handle_set_attr(
1874 message_handle,
1875 WS_ADDRESSING_SERVER_MESSAGEID_ALREADY_INVOKED,
1876 NULL, NULL, (void *)1);
1877
1878 10980 exit:
1879
1880 10980 GlobusWSAddressingDebugExit();
1881 10980 return result;
1882 }
1883
1884 static
1885 globus_result_t
1886 globus_l_handler_ws_addressing_server_invoke_compat_MessageID(
1887 globus_soap_message_handle_t message_handle,
1888 globus_result_t result)
1889 0 {
1890 wsacompat_AttributedURI messID;
1891 GlobusFuncName(globus_handler_ws_addressing_server_invoke_compat_MessageID);
1892 0 GlobusWSAddressingDebugEnter();
1893
1894 0 if(result != GLOBUS_SUCCESS)
1895 {
1896 0 goto exit;
1897 }
1898
1899 0 if(globus_soap_message_handle_get_attr(
1900 message_handle,
1901 WS_ADDRESSING_SERVER_MESSAGEID_ALREADY_INVOKED))
1902 {
1903 0 goto exit;
1904 }
1905
1906
1907 0 wsacompat_AttributedURI_init_contents(&messID);
1908
1909 0 result = wsacompat_AttributedURI_deserialize(
1910 &wsacompat_MessageID_qname,
1911 &messID,
1912 message_handle,
1913 0);
1914 0 if(result != GLOBUS_SUCCESS)
1915 {
1916 0 result = GlobusWSAddressingErrorDeserializeFailed(
1917 result, ("Failed to deserialize MessageID element"));
1918 0 goto exit;
1919 }
1920
1921 0 globus_soap_message_handle_set_attr(
1922 message_handle,
1923 WSADDR_INBOUND_MESSAGE_ID_KEY,
1924 globus_soap_message_attr_copy_string,
1925 globus_libc_free,
1926 messID.base_value);
1927
1928 0 wsacompat_AttributedURI_destroy_contents(&messID);
1929
1930 0 globus_soap_message_remove_required_header_element(
1931 message_handle, &wsacompat_MessageID_qname);
1932
1933 0 globus_soap_message_handle_set_attr(
1934 message_handle,
1935 WS_ADDRESSING_SERVER_MESSAGEID_ALREADY_INVOKED,
1936 NULL, NULL, (void *)1);
1937
1938 0 exit:
1939
1940 0 GlobusWSAddressingDebugExit();
1941 0 return result;
1942 }
1943
1944
1945 static
1946 globus_result_t
1947 globus_l_handler_ws_addressing_server_invoke_From(
1948 globus_soap_message_handle_t message_handle,
1949 globus_result_t result)
1950 10980 {
1951 wsa_EndpointReferenceType from_epr;
1952 GlobusFuncName(globus_handler_ws_addressing_server_invoke_From);
1953 10980 GlobusWSAddressingDebugEnter();
1954
1955 10980 if(result != GLOBUS_SUCCESS)
1956 {
1957 0 goto exit;
1958 }
1959
1960 10980 if(globus_soap_message_handle_get_attr(
1961 message_handle,
1962 WS_ADDRESSING_SERVER_FROM_ALREADY_INVOKED))
1963 {
1964 0 goto exit;
1965 }
1966
1967 10980 wsa_EndpointReferenceType_init_contents(&from_epr);
1968
1969 10980 result = wsa_EndpointReferenceType_deserialize(
1970 &wsa_From_qname,
1971 &from_epr,
1972 message_handle,
1973 0);
1974 10980 if(result != GLOBUS_SUCCESS)
1975 {
1976 0 result = GlobusWSAddressingErrorDeserializeFailed(
1977 result, ("Failed to deserialize From element"));
1978 0 goto exit;
1979 }
1980
1981 10980 globus_soap_message_handle_set_attr(
1982 message_handle,
1983 WSADDR_REQUEST_ENDPOINT_KEY,
1984 globus_soap_message_attr_copy_string,
1985 globus_libc_free,
1986 from_epr.Address.base_value);
1987
1988 10980 wsa_EndpointReferenceType_destroy_contents(
1989 &from_epr);
1990
1991 10980 globus_soap_message_remove_required_header_element(
1992 message_handle, &wsa_From_qname);
1993
1994 10980 globus_soap_message_handle_set_attr(
1995 message_handle,
1996 WS_ADDRESSING_SERVER_FROM_ALREADY_INVOKED,
1997 NULL, NULL, (void *)1);
1998
1999 10980 exit:
2000
2001 10980 GlobusWSAddressingDebugExit();
2002 10980 return result;
2003 }
2004
2005 static
2006 globus_result_t
2007 globus_l_handler_ws_addressing_server_invoke_compat_From(
2008 globus_soap_message_handle_t message_handle,
2009 globus_result_t result)
2010 0 {
2011 wsacompat_EndpointReferenceType compat_from_epr;
2012 GlobusFuncName(globus_handler_ws_addressing_server_invoke_compat_From);
2013 0 GlobusWSAddressingDebugEnter();
2014
2015 0 if(result != GLOBUS_SUCCESS)
2016 {
2017 0 goto exit;
2018 }
2019
2020 0 if(globus_soap_message_handle_get_attr(
2021 message_handle,
2022 WS_ADDRESSING_SERVER_FROM_ALREADY_INVOKED))
2023 {
2024 0 goto exit;
2025 }
2026
2027 0 result = wsacompat_EndpointReferenceType_init_contents(&compat_from_epr);
2028 0 if(result != GLOBUS_SUCCESS)
2029 {
2030 0 result = GlobusWSAddressingErrorDeserializeFailed(
2031 result, ("Failed to deserialize From element"));
2032 0 goto exit;
2033 }
2034
2035 0 result = wsacompat_EndpointReferenceType_deserialize(
2036 &wsacompat_From_qname,
2037 &compat_from_epr,
2038 message_handle,
2039 0);
2040 0 if(result != GLOBUS_SUCCESS)
2041 {
2042 0 result = GlobusWSAddressingErrorDeserializeFailed(
2043 result, ("Failed to deserialize From element"));
2044 0 goto exit;
2045 }
2046
2047 0 if(result != GLOBUS_SUCCESS)
2048 {
2049 0 result = GlobusWSAddressingErrorDeserializeFailed(
2050 result, ("Failed to deserialize From element"));
2051 0 goto exit;
2052 }
2053
2054 0 globus_soap_message_handle_set_attr(
2055 message_handle,
2056 WSADDR_REQUEST_ENDPOINT_KEY,
2057 globus_soap_message_attr_copy_string,
2058 globus_libc_free,
2059 compat_from_epr.Address.base_value);
2060
2061 0 wsacompat_EndpointReferenceType_destroy_contents(
2062 &compat_from_epr);
2063
2064 0 globus_soap_message_remove_required_header_element(
2065 message_handle, &wsacompat_From_qname);
2066
2067 0 globus_soap_message_handle_set_attr(
2068 message_handle,
2069 WS_ADDRESSING_SERVER_FROM_ALREADY_INVOKED,
2070 NULL, NULL, (void *)1);
2071
2072 0 exit:
2073
2074 0 GlobusWSAddressingDebugExit();
2075 0 return result;
2076 }
2077
2078 static
2079 globus_result_t
2080 globus_l_handler_ws_addressing_server_invoke_To(
2081 globus_soap_message_handle_t message_handle,
2082 globus_result_t result)
2083 10980 {
2084 wsa_EndpointReferenceType * dest_epr;
2085 wsa_AttributedURIType To;
2086 GlobusFuncName(globus_handler_ws_addressing_server_invoke_To);
2087 10980 GlobusWSAddressingDebugEnter();
2088
2089 10980 if(result != GLOBUS_SUCCESS)
2090 {
2091 0 goto exit;
2092 }
2093
2094 10980 if(globus_soap_message_handle_get_attr(
2095 message_handle,
2096 WS_ADDRESSING_SERVER_TO_ALREADY_INVOKED))
2097 {
2098 0 goto exit;
2099 }
2100
2101 10980 wsa_AttributedURIType_init_contents(&To);
2102
2103 10980 result = wsa_AttributedURIType_deserialize(
2104 &wsa_To_qname,
2105 &To,
2106 message_handle,
2107 0);
2108 10980 if(result != GLOBUS_SUCCESS)
2109 {
2110 0 result = GlobusWSAddressingErrorDeserializeFailed(
2111 result, ("Failed to deserialize To element"));
2112 0 goto exit;
2113 }
2114
2115 10980 globus_soap_message_handle_set_attr(
2116 message_handle,
2117 GLOBUS_SOAP_MESSAGE_SERVICE_ENDPOINT_KEY,
2118 globus_soap_message_attr_copy_string,
2119 globus_libc_free,
2120 To.base_value);
2121
2122 10980 wsa_EndpointReferenceType_init(&dest_epr);
2123
2124 10980 dest_epr->Address.base_value = globus_libc_strdup(To.base_value);
2125
2126 10980 wsa_AttributedURIType_destroy_contents(&To);
2127
2128 10980 globus_soap_message_handle_set_attr(
2129 message_handle,
2130 WSADDR_EPR_KEY,
2131 wsa_EndpointReferenceType_info.copy,
2132 wsa_EndpointReferenceType_info.destroy,
2133 (void *) dest_epr);
2134
2135 10980 wsa_EndpointReferenceType_destroy(dest_epr);
2136
2137 10980 globus_soap_message_remove_required_header_element(
2138 message_handle, &wsa_To_qname);
2139
2140 10980 globus_soap_message_handle_set_attr(
2141 message_handle,
2142 WS_ADDRESSING_SERVER_TO_ALREADY_INVOKED,
2143 NULL, NULL, (void *)1);
2144
2145 10980 exit:
2146
2147 10980 GlobusWSAddressingDebugExit();
2148 10980 return result;
2149 }
2150
2151 static
2152 globus_result_t
2153 globus_l_handler_ws_addressing_server_invoke_compat_To(
2154 globus_soap_message_handle_t message_handle,
2155 globus_result_t result)
2156 0 {
2157 wsa_EndpointReferenceType * dest_epr;
2158 wsa_AttributedURIType To;
2159 wsacompat_AttributedURI compat_To;
2160 GlobusFuncName(globus_handler_ws_addressing_server_invoke_compat_To);
2161 0 GlobusWSAddressingDebugEnter();
2162
2163 0 if(result != GLOBUS_SUCCESS)
2164 {
2165 0 goto exit;
2166 }
2167
2168 0 if(globus_soap_message_handle_get_attr(
2169 message_handle,
2170 WS_ADDRESSING_SERVER_TO_ALREADY_INVOKED))
2171 {
2172 0 goto exit;
2173 }
2174
2175 0 wsacompat_AttributedURI_init_contents(&compat_To);
2176
2177 0 result = wsacompat_AttributedURI_deserialize(
2178 &wsacompat_To_qname,
2179 &compat_To,
2180 message_handle,
2181 0);
2182 0 if(result != GLOBUS_SUCCESS)
2183 {
2184 0 result = GlobusWSAddressingErrorDeserializeFailed(
2185 result, ("Failed to deserialize To element"));
2186 0 goto exit;
2187 }
2188
2189 0 result = wsa_AttributedURIType_init_contents(&To);
2190 0 if(result != GLOBUS_SUCCESS)
2191 {
2192 0 result = GlobusWSAddressingErrorDeserializeFailed(
2193 result, ("Failed to deserialize To element"));
2194 0 goto exit;
2195 }
2196
2197 0 To.base_value = compat_To.base_value;
2198 0 To.anyAttributes = compat_To.anyAttributes;
2199
2200 0 globus_soap_message_handle_set_attr(
2201 message_handle,
2202 GLOBUS_SOAP_MESSAGE_SERVICE_ENDPOINT_KEY,
2203 globus_soap_message_attr_copy_string,
2204 globus_libc_free,
2205 To.base_value);
2206
2207 0 wsa_EndpointReferenceType_init(&dest_epr);
2208
2209 0 dest_epr->Address.base_value = globus_libc_strdup(To.base_value);
2210 0 wsacompat_AttributedURI_destroy_contents(&compat_To);
2211
2212 0 globus_soap_message_handle_set_attr(
2213 message_handle,
2214 WSADDR_EPR_KEY,
2215 wsa_EndpointReferenceType_info.copy,
2216 wsa_EndpointReferenceType_info.destroy,
2217 (void *) dest_epr);
2218
2219 0 wsa_EndpointReferenceType_destroy(dest_epr);
2220
2221 0 globus_soap_message_remove_required_header_element(
2222 message_handle, &wsacompat_To_qname);
2223
2224 0 globus_soap_message_handle_set_attr(
2225 message_handle,
2226 WS_ADDRESSING_SERVER_TO_ALREADY_INVOKED,
2227 NULL, NULL, (void *)1);
2228
2229 0 globus_soap_message_handle_set_attr(
2230 message_handle,
2231 WS_ADDRESSING_SERVER_REQUEST_COMPAT_MODE,
2232 NULL, NULL, (void *)1);
2233
2234 0 exit:
2235
2236 0 GlobusWSAddressingDebugExit();
2237 0 return result;
2238 }
2239
2240 static
2241 globus_result_t
2242 globus_l_handler_ws_addressing_server_invoke_Action(
2243 globus_soap_message_handle_t message_handle,
2244 globus_result_t result)
2245 10980 {
2246 wsa_AttributedURIType Action;
2247 GlobusFuncName(globus_handler_ws_addressing_server_invoke_Action);
2248 10980 GlobusWSAddressingDebugEnter();
2249
2250 10980 if(result != GLOBUS_SUCCESS)
2251 {
2252 0 goto exit;
2253 }
2254
2255 10980 if(globus_soap_message_handle_get_attr(
2256 message_handle,
2257 WS_ADDRESSING_SERVER_ACTION_ALREADY_INVOKED))
2258 {
2259 0 goto exit;
2260 }
2261
2262 10980 wsa_AttributedURIType_init_contents(&Action);
2263
2264 10980 result = wsa_AttributedURIType_deserialize(
2265 &wsa_Action_qname,
2266 &Action,
2267 message_handle,
2268 0);
2269 10980 if(result != GLOBUS_SUCCESS)
2270 {
2271 0 result = GlobusWSAddressingErrorDeserializeFailed(
2272 result, ("Failed to deserialize Action element"));
2273 0 goto exit;
2274 }
2275
2276 10980 globus_soap_message_handle_set_attr(
2277 message_handle,
2278 WSADDR_ACTION_REQUEST_KEY,
2279 globus_soap_message_attr_copy_string,
2280 globus_libc_free,
2281 Action.base_value);
2282
2283 10980 globus_soap_message_remove_required_header_element(
2284 message_handle, &wsa_Action_qname);
2285
2286 10980 globus_soap_message_handle_set_attr(
2287 message_handle,
2288 WS_ADDRESSING_SERVER_ACTION_ALREADY_INVOKED,
2289 NULL, NULL, (void *)1);
2290 10980 wsa_AttributedURIType_destroy_contents(&Action);
2291
2292 10980 exit:
2293
2294 10980 GlobusWSAddressingDebugExit();
2295 10980 return result;
2296 }
2297
2298 static
2299 globus_result_t
2300 globus_l_handler_ws_addressing_server_invoke_compat_Action(
2301 globus_soap_message_handle_t message_handle,
2302 globus_result_t result)
2303 0 {
2304 wsacompat_AttributedURI Action;
2305 GlobusFuncName(globus_handler_ws_addressing_server_invoke_compat_Action);
2306 0 GlobusWSAddressingDebugEnter();
2307
2308 0 if(result != GLOBUS_SUCCESS)
2309 {
2310 0 goto exit;
2311 }
2312
2313 0 if(globus_soap_message_handle_get_attr(
2314 message_handle,
2315 WS_ADDRESSING_SERVER_ACTION_ALREADY_INVOKED))
2316 {
2317 0 goto exit;
2318 }
2319
2320 0 wsacompat_AttributedURI_init_contents(&Action);
2321
2322 0 result = wsacompat_AttributedURI_deserialize(
2323 &wsacompat_Action_qname,
2324 &Action,
2325 message_handle,
2326 0);
2327 0 if(result != GLOBUS_SUCCESS)
2328 {
2329 0 result = GlobusWSAddressingErrorDeserializeFailed(
2330 result, ("Failed to deserialize Action element"));
2331 0 goto exit;
2332 }
2333
2334 0 globus_soap_message_handle_set_attr(
2335 message_handle,
2336 WSADDR_ACTION_REQUEST_KEY,
2337 globus_soap_message_attr_copy_string,
2338 globus_libc_free,
2339 Action.base_value);
2340
2341 0 globus_soap_message_remove_required_header_element(
2342 message_handle, &wsacompat_Action_qname);
2343
2344 0 globus_soap_message_handle_set_attr(
2345 message_handle,
2346 WS_ADDRESSING_SERVER_ACTION_ALREADY_INVOKED,
2347 NULL, NULL, (void *)1);
2348 0 wsacompat_AttributedURI_destroy_contents(&Action);
2349
2350 0 exit:
2351
2352 0 GlobusWSAddressingDebugExit();
2353 0 return result;
2354 }
2355
2356
2357 static
2358 globus_result_t
2359 globus_handler_ws_addressing_server_request_default_trigger(
2360 globus_soap_message_handle_t message_handle,
2361 globus_result_t result)
2362 10655 {
2363 wsa_EndpointReferenceType * dest_epr;
2364 GlobusFuncName(
2365 globus_handler_ws_addressing_server_request_default_trigger);
2366 10655 GlobusWSAddressingDebugEnter();
2367
2368 10655 if(result != GLOBUS_SUCCESS)
2369 {
2370 0 goto exit;
2371 }
2372
2373 10655 dest_epr = globus_soap_message_handle_get_attr(
2374 message_handle,
2375 WSADDR_OUTBOUND_EPR_KEY);
2376 10655 if(!dest_epr)
2377 {
2378 10655 dest_epr = globus_soap_message_handle_get_attr(
2379 message_handle,
2380 WSADDR_EPR_KEY);
2381 }
2382
2383 10655 if(dest_epr)
2384 {
2385 10655 wsa_ReferenceParametersType_init(&dest_epr->ReferenceParameters);
2386
2387 10655 result = globus_l_ws_addressing_deserialize_refparams(
2388 NULL,
2389 &dest_epr->ReferenceParameters->any,
2390 message_handle,
2391 0);
2392
2393 10655 if(result != GLOBUS_SUCCESS)
2394 {
2395 0 result = GlobusWSAddressingErrorDeserializeFailed(
2396 result,
2397 ("Failed to deserialize ReferenceParameters elements"));
2398 0 goto exit;
2399 }
2400 }
2401 else
2402 {
2403 xsd_QName header_elem;
2404 0 result = globus_soap_message_deserialize_element_unknown(
2405 message_handle, &header_elem);
2406 0 if(result != GLOBUS_SUCCESS)
2407 {
2408 0 result = GlobusWSAddressingErrorDeserializeFailed(
2409 result,
2410 ("Failed skipping unknown header element"));
2411 0 goto exit;
2412 }
2413
2414 0 result = globus_soap_message_deserialize_skip(
2415 message_handle);
2416 0 if(result != GLOBUS_SUCCESS)
2417 {
2418 0 result = GlobusWSAddressingErrorDeserializeFailed(
2419 result,
2420 ("Failed skipping unknown header element"));
2421 0 goto exit;
2422 }
2423
2424 0 result = globus_soap_message_deserialize_element_end(
2425 message_handle,
2426 &header_elem);
2427 0 if(result != GLOBUS_SUCCESS)
2428 {
2429 0 result = GlobusWSAddressingErrorDeserializeFailed(
2430 result,
2431 ("Failed skipping unknown header element"));
2432 0 goto exit;
2433 }
2434 }
2435
2436 10655 exit:
2437
2438 10655 GlobusWSAddressingDebugExit();
2439 10655 return result;
2440 }
2441
2442 static
2443 globus_result_t
2444 globus_handler_ws_addressing_server_request_invoke(
2445 globus_soap_message_handle_t message_handle,
2446 globus_result_t result)
2447 10977 {
2448 10977 int To_handled = 0;
2449 10977 int Action_handled = 0;
2450 GlobusFuncName(globus_handler_ws_addressing_server_request_invoke);
2451 10977 GlobusWSAddressingDebugEnter();
2452
2453 10977 if(globus_soap_message_handle_get_attr(
2454 message_handle,
2455 WS_ADDRESSING_SERVER_REQUEST_ALREADY_INVOKED))
2456 {
2457 0 goto exit;
2458 }
2459
2460 10977 if(globus_soap_message_handle_get_attr(
2461 message_handle,
2462 GLOBUS_SOAP_MESSAGE_SERVICE_ENDPOINT_KEY))
2463 {
2464 10977 To_handled = 1;
2465 }
2466
2467 10977 if(globus_soap_message_handle_get_attr(
2468 message_handle,
2469 WSADDR_ACTION_REQUEST_KEY))
2470 {
2471 10977 Action_handled = 1;
2472 }
2473
2474 10977 if(!To_handled || !Action_handled)
2475 {
2476 xsd_QName * missing_header_qname;
2477 xsd_any * missing_header;
2478 globus_soap_message_fault_t soap_fault;
2479
2480 0 globus_soap_message_fault_init(&soap_fault);
2481
2482 0 xsd_QName_init(&missing_header_qname);
2483 0 if(!To_handled)
2484 {
2485 0 missing_header_qname->local =
2486 globus_libc_strdup(wsa_To_qname.local);
2487 0 missing_header_qname->Namespace =
2488 globus_libc_strdup(wsa_To_qname.Namespace);
2489 }
2490 else
2491 {
2492 0 missing_header_qname->local =
2493 globus_libc_strdup(wsa_Action_qname.local);
2494 0 missing_header_qname->Namespace =
2495 globus_libc_strdup(wsa_Action_qname.Namespace);
2496 }
2497
2498 0 xsd_any_init((void *)&missing_header);
2499 0 missing_header->any_info = &xsd_QName_contents_info;
2500 0 missing_header->value = (void *)missing_header_qname;
2501
2502 0 soap_fault->faultcode =
2503 globus_libc_strdup("MessageInformationHeaderRequired");
2504 0 soap_fault->faultstring = globus_libc_strdup(
2505 "A required message information header: To, MessageID, "
2506 "or Action is not present.");
2507 0 soap_fault->detail = missing_header;
2508
2509 0 result = GlobusSoapMessageErrorFault(soap_fault);
2510 0 goto exit;
2511 }
2512
2513 10977 globus_soap_message_handle_set_attr(
2514 message_handle,
2515 WS_ADDRESSING_SERVER_REQUEST_ALREADY_INVOKED,
2516 NULL, NULL, (void *)1);
2517
2518 10977 exit:
2519
2520 10977 GlobusWSAddressingDebugExit();
2521 10977 return result;
2522 }
2523
2524 #define GLOBUS_L_HANDLER_WSADD_DEFINE_CLIENT_TRIGGER(__ELEMENT__) \
2525 static globus_handler_trigger_t \
2526 globus_l_handler_ws_addressing_client_trigger_##__ELEMENT__ = \
2527 { \
2528 &wsa_##__ELEMENT__##_qname, \
2529 globus_l_handler_ws_addressing_client_invoke_##__ELEMENT__ \
2530 }; \
2531 static globus_handler_trigger_t \
2532 globus_l_handler_ws_addressing_client_trigger_compat_##__ELEMENT__ =\
2533 { \
2534 &wsacompat_##__ELEMENT__##_qname, \
2535 globus_l_handler_ws_addressing_client_invoke_compat_##__ELEMENT__\
2536 }
2537
2538 GLOBUS_L_HANDLER_WSADD_DEFINE_CLIENT_TRIGGER(MessageID);
2539 GLOBUS_L_HANDLER_WSADD_DEFINE_CLIENT_TRIGGER(RelatesTo);
2540 GLOBUS_L_HANDLER_WSADD_DEFINE_CLIENT_TRIGGER(To);
2541 GLOBUS_L_HANDLER_WSADD_DEFINE_CLIENT_TRIGGER(Action);
2542 GLOBUS_L_HANDLER_WSADD_DEFINE_CLIENT_TRIGGER(From);
2543
2544 #define GLOBUS_L_HANDLER_WSADD_DEFINE_SERVER_TRIGGER(__ELEMENT__) \
2545 static globus_handler_trigger_t \
2546 globus_l_handler_ws_addressing_server_trigger_##__ELEMENT__ = \
2547 { \
2548 &wsa_##__ELEMENT__##_qname, \
2549 globus_l_handler_ws_addressing_server_invoke_##__ELEMENT__ \
2550 }; \
2551 static globus_handler_trigger_t \
2552 globus_l_handler_ws_addressing_server_trigger_compat_##__ELEMENT__ =\
2553 { \
2554 &wsacompat_##__ELEMENT__##_qname, \
2555 globus_l_handler_ws_addressing_server_invoke_compat_##__ELEMENT__\
2556 }
2557
2558 GLOBUS_L_HANDLER_WSADD_DEFINE_SERVER_TRIGGER(MessageID);
2559 GLOBUS_L_HANDLER_WSADD_DEFINE_SERVER_TRIGGER(To);
2560 GLOBUS_L_HANDLER_WSADD_DEFINE_SERVER_TRIGGER(Action);
2561 GLOBUS_L_HANDLER_WSADD_DEFINE_SERVER_TRIGGER(From);
2562
2563 globus_handler_descriptor_t globus_l_handler_ws_addressing_client_descriptor =
2564 {
2565 NULL,
2566 globus_handler_ws_addressing_client_request_invoke,
2567 NULL,
2568 NULL,
2569 globus_handler_ws_addressing_client_response_invoke,
2570 NULL,
2571 NULL,
2572 NULL
2573 };
2574
2575 globus_handler_descriptor_t globus_l_handler_ws_addressing_server_descriptor =
2576 {
2577 NULL,
2578 globus_handler_ws_addressing_server_request_invoke,
2579 NULL,
2580 NULL,
2581 globus_handler_ws_addressing_server_response_invoke,
2582 NULL,
2583 NULL,
2584 globus_handler_ws_addressing_server_request_default_trigger
2585 };
2586
2587 int
2588 globus_l_handler_ws_addressing_activate(void)
2589 718 {
2590 718 int res = 0;
2591 GlobusFuncName(globus_l_handler_ws_addressing_activate);
2592
2593 718 GlobusDebugInit(GLOBUS_HANDLER_WS_ADDRESSING, TRACE DEBUG);
2594 718 GlobusWSAddressingDebugEnter();
2595
2596 718 globus_l_handler_ws_addressing_client_descriptor.trigger_list = NULL;
2597
2598 718 globus_list_insert(
2599 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2600 &globus_l_handler_ws_addressing_client_trigger_MessageID);
2601 718 globus_list_insert(
2602 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2603 &globus_l_handler_ws_addressing_client_trigger_RelatesTo);
2604 718 globus_list_insert(
2605 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2606 &globus_l_handler_ws_addressing_client_trigger_To);
2607 718 globus_list_insert(
2608 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2609 &globus_l_handler_ws_addressing_client_trigger_Action);
2610 718 globus_list_insert(
2611 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2612 &globus_l_handler_ws_addressing_client_trigger_From);
2613
2614 718 globus_list_insert(
2615 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2616 &globus_l_handler_ws_addressing_client_trigger_compat_MessageID);
2617 718 globus_list_insert(
2618 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2619 &globus_l_handler_ws_addressing_client_trigger_compat_RelatesTo);
2620 718 globus_list_insert(
2621 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2622 &globus_l_handler_ws_addressing_client_trigger_compat_To);
2623 718 globus_list_insert(
2624 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2625 &globus_l_handler_ws_addressing_client_trigger_compat_Action);
2626 718 globus_list_insert(
2627 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2628 &globus_l_handler_ws_addressing_client_trigger_compat_From);
2629
2630 718 res = globus_extension_registry_add(
2631 GLOBUS_HANDLER_REGISTRY,
2632 GLOBUS_HANDLER_WS_ADDRESSING_CLIENT,
2633 GlobusExtensionMyModule(globus_handler_ws_addressing),
2634 &globus_l_handler_ws_addressing_client_descriptor);
2635 718 if(res != GLOBUS_SUCCESS)
2636 {
2637 0 goto exit;
2638 }
2639
2640 718 globus_l_handler_ws_addressing_server_descriptor.trigger_list = NULL;
2641 718 globus_list_insert(
2642 &globus_l_handler_ws_addressing_server_descriptor.trigger_list,
2643 &globus_l_handler_ws_addressing_server_trigger_MessageID);
2644 718 globus_list_insert(
2645 &globus_l_handler_ws_addressing_server_descriptor.trigger_list,
2646 &globus_l_handler_ws_addressing_server_trigger_To);
2647 718 globus_list_insert(
2648 &globus_l_handler_ws_addressing_server_descriptor.trigger_list,
2649 &globus_l_handler_ws_addressing_server_trigger_Action);
2650 718 globus_list_insert(
2651 &globus_l_handler_ws_addressing_server_descriptor.trigger_list,
2652 &globus_l_handler_ws_addressing_server_trigger_From);
2653
2654 718 globus_list_insert(
2655 &globus_l_handler_ws_addressing_server_descriptor.trigger_list,
2656 &globus_l_handler_ws_addressing_server_trigger_compat_MessageID);
2657 718 globus_list_insert(
2658 &globus_l_handler_ws_addressing_server_descriptor.trigger_list,
2659 &globus_l_handler_ws_addressing_server_trigger_compat_To);
2660 718 globus_list_insert(
2661 &globus_l_handler_ws_addressing_server_descriptor.trigger_list,
2662 &globus_l_handler_ws_addressing_server_trigger_compat_Action);
2663 718 globus_list_insert(
2664 &globus_l_handler_ws_addressing_server_descriptor.trigger_list,
2665 &globus_l_handler_ws_addressing_server_trigger_compat_From);
2666 718 res = globus_extension_registry_add(
2667 GLOBUS_HANDLER_REGISTRY,
2668 GLOBUS_HANDLER_WS_ADDRESSING_SERVER,
2669 GlobusExtensionMyModule(globus_handler_ws_addressing),
2670 &globus_l_handler_ws_addressing_server_descriptor);
2671
2672 718 exit:
2673
2674 718 GlobusWSAddressingDebugExit();
2675 718 return res;
2676 }
2677
2678 int
2679 globus_l_handler_ws_addressing_deactivate(void)
2680 6 {
2681 GlobusFuncName(globus_l_handler_ws_addressing_deactivate);
2682 6 GlobusWSAddressingDebugEnter();
2683
2684 6 globus_extension_registry_remove(
2685 GLOBUS_HANDLER_REGISTRY,
2686 GLOBUS_HANDLER_WS_ADDRESSING_CLIENT);
2687
2688 6 globus_extension_registry_remove(
2689 GLOBUS_HANDLER_REGISTRY,
2690 GLOBUS_HANDLER_WS_ADDRESSING_SERVER);
2691
2692 6 globus_list_free(
2693 globus_l_handler_ws_addressing_client_descriptor.trigger_list);
2694
2695 6 globus_list_free(
2696 globus_l_handler_ws_addressing_server_descriptor.trigger_list);
2697
2698 6 globus_l_handler_ws_addressing_client_descriptor.trigger_list = NULL;
2699 6 globus_l_handler_ws_addressing_server_descriptor.trigger_list = NULL;
2700
2701 6 GlobusWSAddressingDebugExit();
2702 6 return 0;
2703 }
2704
2705 static
2706 globus_result_t
2707 globus_l_uuid_copy(
2708 void ** new_id,
2709 const void * id)
2710 38727 {
2711 38727 const globus_uuid_t * uuid = id;
2712 globus_uuid_t * new_uuid;
2713
2714 38727 new_uuid = globus_malloc(sizeof(globus_uuid_t));
2715 38727 globus_uuid_import(new_uuid, uuid->text);
2716
2717 38727 *new_id = new_uuid;
2718 38727 return GLOBUS_SUCCESS;
2719 }
2720
2721 static
2722 globus_result_t
2723 globus_l_wsa_convert_old_epr(
2724 wsa_EndpointReferenceType * new_epr,
2725 wsacompat_EndpointReferenceType * old_epr)
2726 0 {
2727 globus_result_t result;
2728
2729 0 result = xsd_anyURI_copy_contents(
2730 &new_epr->Address.base_value,
2731 &old_epr->Address.base_value);
2732 0 if(result != GLOBUS_SUCCESS)
2733 {
2734 0 goto out;
2735 }
2736 0 result = xsd_anyAttributes_copy(
2737 &new_epr->Address.anyAttributes,
2738 old_epr->Address.anyAttributes);
2739 0 if(result != GLOBUS_SUCCESS)
2740 {
2741 0 goto out;
2742 }
2743
2744 0 if (old_epr->ReferenceProperties != NULL)
2745 {
2746 0 result = wsa_ReferenceParametersType_init(
2747 &new_epr->ReferenceParameters);
2748 0 if (result != GLOBUS_SUCCESS)
2749 {
2750 0 goto out;
2751 }
2752
2753 0 result = xsd_any_array_copy_contents(
2754 &new_epr->ReferenceParameters->any,
2755 &old_epr->ReferenceProperties->any);
2756 if (result != GLOBUS_SUCCESS)
2757 {
2758 0 goto out;
2759 }
2760 }
2761
2762 /* TODO: Deal with other elements in the old EPR */
2763
2764 0 out:
2765 0 return result;
2766 }
2767 /* globus_l_wsa_convert_old_epr() */
2768
2769 static
2770 globus_result_t
2771 globus_l_wsa_convert_new_epr(
2772 wsacompat_EndpointReferenceType * new_epr,
2773 wsa_EndpointReferenceType * old_epr)
2774 0 {
2775 globus_result_t result;
2776
2777 0 result = xsd_anyURI_copy_contents(
2778 &new_epr->Address.base_value,
2779 &old_epr->Address.base_value);
2780 0 if(result != GLOBUS_SUCCESS)
2781 {
2782 0 goto out;
2783 }
2784
2785 0 if (old_epr->Address.anyAttributes)
2786 {
2787 0 result = xsd_anyAttributes_copy(
2788 &new_epr->Address.anyAttributes,
2789 old_epr->Address.anyAttributes);
2790 0 if(result != GLOBUS_SUCCESS)
2791 {
2792 0 goto out;
2793 }
2794 }
2795
2796 0 if (old_epr->ReferenceParameters)
2797 {
2798 0 result = wsacompat_ReferencePropertiesType_init(
2799 &new_epr->ReferenceProperties);
2800 0 if (result != GLOBUS_SUCCESS)
2801 {
2802 0 goto out;
2803 }
2804
2805 0 result = xsd_any_array_copy_contents(
2806 &new_epr->ReferenceProperties->any,
2807 &old_epr->ReferenceParameters->any);
2808 if (result != GLOBUS_SUCCESS)
2809 {
2810 0 goto out;
2811 }
2812 }
2813
2814 /* TODO: Deal with other elements in the old EPR */
2815
2816 0 out:
2817 0 return result;
2818 }
2819 /* globus_l_wsa_convert_new_epr() */
2820
2821 static
2822 globus_result_t
2823 globus_l_ws_addressing_refparam_ns_set(
2824 globus_soap_message_handle_t message_handle,
2825 const xsd_QName * element,
2826 globus_xsd_element_options_t * options)
2827 12582 {
2828 12582 return globus_soap_message_element_ns_set(
2829 message_handle,
2830 element,
2831 WSADDRESSING_NS,
2832 options);
2833 }
2834 /* globus_l_ws_addressing_refparam_ns_set() */
2835
2836 static
2837 globus_result_t
2838 globus_l_ws_addressing_refparam_ns_add(
2839 globus_soap_message_handle_t message_handle,
2840 const xsd_QName * element,
2841 globus_xsd_element_options_t * options)
2842 12582 {
2843 12582 return globus_soap_message_element_ns_add(
2844 message_handle,
2845 element,
2846 WSADDRESSING_NS,
2847 options);
2848 }
2849
2850 static
2851 globus_result_t
2852 globus_l_ws_addressing_refparam_ns_remove(
2853 globus_soap_message_handle_t message_handle,
2854 const xsd_QName * element,
2855 globus_xsd_element_options_t * options)
2856 12582 {
2857 12582 globus_soap_message_element_ns_remove(
2858 message_handle,
2859 WSADDRESSING_NS,
2860 options);
2861 12582 return GLOBUS_SUCCESS;
2862 }
2863 /* globus_l_ws_addressing_refparam_ns_remove() */
2864
2865 static
2866 globus_result_t
2867 globus_l_ws_addressing_refparam_attr(
2868 globus_soap_message_handle_t message_handle,
2869 const xsd_QName * type)
2870 12582 {
2871 12582 xsd_boolean trueval = 1;
2872
2873 12582 return globus_soap_message_serialize_boolean_attribute(
2874 message_handle, &wsa_IsReferenceParameter_qname, &trueval);
2875 }
2876 /* globus_l_ws_addressing_refparam_attr() */
2877
2878 static
2879 globus_result_t
2880 globus_l_ws_addressing_serialize_refparam(
2881 globus_soap_message_handle_t message_handle,
2882 globus_xml_buffer * buffer)
2883 1851 {
2884 globus_soap_message_handle_t dom_handle;
2885 xmlDocPtr doc;
2886 xmlNodePtr root;
2887 xsd_anyAttributes_t any_attrs;
2888 xsd_QName element;
2889 1851 xsd_QName any_qname = { "##any", "any" };
2890 globus_xml_buffer new_buffer;
2891 globus_result_t result;
2892 1851 globus_xsd_element_options_t options = 0;
2893
2894 1851 result = globus_soap_message_handle_init_to_dom(&dom_handle, &doc);
2895 1851 if (result != GLOBUS_SUCCESS)
2896 {
2897 0 goto out;
2898 }
2899
2900 1851 result = globus_xml_buffer_serialize_contents(
2901 NULL,
2902 buffer,
2903 dom_handle,
2904 0);
2905 1851 globus_soap_message_handle_destroy(dom_handle);
2906
2907 1851 if (result != GLOBUS_SUCCESS)
2908 {
2909 0 goto destroy_doc_out;
2910 }
2911
2912
2913 1851 root = xmlDocGetRootElement(doc);
2914
2915 1851 result = globus_soap_message_handle_init_from_dom(&dom_handle, doc);
2916 1851 if (result != GLOBUS_SUCCESS)
2917 {
2918 0 goto destroy_doc_out;
2919 }
2920
2921 1851 result = globus_soap_message_deserialize_element_unknown(
2922 dom_handle,
2923 &element);
2924
2925 1851 if (result != GLOBUS_SUCCESS)
2926 {
2927 0 goto destroy_handle_out;
2928 }
2929
2930 1851 result = xsd_anyAttributes_init(&any_attrs);
2931 1851 if (result != GLOBUS_SUCCESS)
2932 {
2933 0 goto destroy_handle_out;
2934 }
2935
2936 1851 result = xsd_anyAttributes_deserialize(
2937 dom_handle,
2938 any_attrs,
2939 &any_qname);
2940
2941 1851 if (result != GLOBUS_SUCCESS)
2942 {
2943 0 goto destroy_handle_out;
2944 }
2945
2946 1851 result = globus_xml_buffer_deserialize_contents(
2947 NULL,
2948 &new_buffer,
2949 dom_handle,
2950 0);
2951 1851 if (result != GLOBUS_SUCCESS)
2952 {
2953 0 goto destroy_handle_out;
2954 }
2955
2956 1851 result = globus_soap_message_element_ns_set(
2957 message_handle,
2958 &element,
2959 element.Namespace,
2960 &options);
2961
2962 1851 result = xsd_anyAttributes_namespace_set(
2963 message_handle,
2964 &element,
2965 any_attrs,
2966 &options);
2967
2968 1851 result = globus_soap_message_attribute_ns_set(
2969 message_handle,
2970 &element,
2971 WSADDRESSING_NS,
2972 &options);
2973
2974 1851 result = globus_soap_message_serialize_element(
2975 message_handle,
2976 &element,
2977 options,
2978 NULL);
2979
2980 1851 result = globus_soap_message_element_ns_add(
2981 message_handle,
2982 &element,
2983 element.Namespace,
2984 &options);
2985
2986 1851 result = xsd_anyAttributes_namespace_add(
2987 message_handle,
2988 &element,
2989 any_attrs,
2990 &options);
2991
2992 1851 result = globus_soap_message_attribute_ns_add(
2993 message_handle,
2994 &element,
2995 WSADDRESSING_NS,
2996 &options);
2997
2998 1851 result = xsd_anyAttributes_serialize(
2999 message_handle,
3000 any_attrs);
3001 1851 result = globus_soap_message_serialize_element_begin_close(
3002 message_handle, &element);
3003
3004 1851 result = globus_xml_buffer_serialize_contents(
3005 NULL,
3006 &new_buffer,
3007 message_handle,
3008 GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
3009
3010 1851 result = globus_soap_message_serialize_element_end(
3011 message_handle,
3012 &element,
3013 options,
3014 NULL);
3015
3016 1851 globus_soap_message_element_ns_remove(
3017 message_handle,
3018 element.Namespace,
3019 &options);
3020
3021 1851 xsd_anyAttributes_namespace_remove(
3022 message_handle, any_attrs, &options);
3023
3024 1851 globus_soap_message_element_ns_remove(
3025 message_handle,
3026 WSADDRESSING_NS,
3027 &options);
3028
3029
3030 1851 destroy_handle_out:
3031 1851 globus_soap_message_handle_destroy(dom_handle);
3032 1851 doc = NULL;
3033 1851 destroy_doc_out:
3034 1851 if (doc)
3035 {
3036 0 xmlFreeDoc(doc);
3037 }
3038 1851 out:
3039 1851 return result;
3040 }
3041 /* globus_l_ws_addressing_serialize_refparam() */
3042
3043 static
3044 globus_result_t
3045 globus_l_ws_addressing_deserialize_refparams(
3046 xsd_QName * element,
3047 xsd_any_array * array,
3048 globus_soap_message_handle_t handle,
3049 globus_xsd_element_options_t options)
3050 10655 {
3051 globus_result_t result;
3052 int i;
3053
3054 10655 result = xsd_any_array_deserialize(NULL, array, handle, 0);
3055 10655 if (result != GLOBUS_SUCCESS)
3056 {
3057 0 goto out;
3058 }
3059
3060 21310 for (i = 0; i < array->length; i++)
3061 {
3062 10655 result = globus_wsrf_core_remove_attribute(
3063 &array->elements[0],
3064 &wsa_IsReferenceParameter_qname);
3065 10655 if (result != GLOBUS_SUCCESS)
3066 {
3067 0 xsd_any_array_destroy_contents(array);
3068 }
3069 }
3070
3071 10655 out:
3072 10655 return result;
3073 }