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 11531 {
271 11531 globus_uuid_t * uuid = NULL;
272 11531 char * uuid_string = NULL;
273 wsa_AttributedURIType MessageID;
274 wsa_AttributedURIType To;
275 wsa_AttributedURIType Action;
276 11531 char * action_uri = NULL;
277 wsa_EndpointReferenceType default_From;
278 11531 wsa_EndpointReferenceType * source_endpoint = NULL;
279 11531 wsa_EndpointReferenceType * reply_endpoint = NULL;
280 11531 wsa_EndpointReferenceType * fault_endpoint = NULL;
281 11531 wsa_EndpointReferenceType * endpoint_reference = NULL;
282 GlobusFuncName(globus_ws_addressing_handler_client_request_invoke);
283 11531 GlobusWSAddressingDebugEnter();
284
285 11531 if(result != GLOBUS_SUCCESS)
286 {
287 0 goto exit;
288 }
289
290 11531 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 11531 endpoint_reference = (wsa_EndpointReferenceType *)
298 globus_soap_message_handle_get_attr(
299 message_handle, WSADDR_OUTBOUND_EPR_KEY);
300 11531 if(!endpoint_reference)
301 {
302 11531 endpoint_reference = (wsa_EndpointReferenceType *)
303 globus_soap_message_handle_get_attr(
304 message_handle, WSADDR_EPR_KEY);
305 }
306
307 11531 uuid = globus_malloc(sizeof(globus_uuid_t));
308 11531 if(!uuid)
309 {
310 0 result = GlobusWSAddressingErrorMemoryAllocationFailed(
311 sizeof(globus_uuid_t), "uuid");
312 0 goto exit;
313 }
314
315 11531 globus_uuid_create(uuid);
316
317 11531 uuid_string = globus_common_create_string("uuid:%s", uuid->text);
318 11531 MessageID.base_value = uuid_string;
319 11531 MessageID.anyAttributes = NULL;
320
321 11531 result = wsa_AttributedURIType_serialize(
322 (xsd_QName *)&wsa_MessageID_qname,
323 &MessageID,
324 message_handle,
325 0);
326 11531 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 11531 globus_free(uuid_string);
336
337 11531 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 11531 globus_free(uuid);
345
346 11531 To.base_value = (char *) globus_soap_message_handle_get_attr(
347 message_handle, WSADDR_DESTINATION_KEY);
348 11531 if(!To.base_value)
349 {
350 0 result = GlobusWSAddressingErrorSerializeFailed(
351 GLOBUS_SUCCESS, "No destination endpoint");
352 0 goto exit;
353 }
354
355 11531 To.anyAttributes = NULL;
356
357 11531 result = wsa_AttributedURIType_serialize(
358 (xsd_QName *)&wsa_To_qname,
359 &To,
360 message_handle,
361 0);
362 11531 if(result != GLOBUS_SUCCESS)
363 {
364 0 result = GlobusWSAddressingErrorSerializeFailed(
365 result, "To element");
366 0 goto exit;
367 }
368
369 11531 action_uri = (char *) globus_soap_message_handle_get_attr(
370 message_handle, WSADDR_ACTION_REQUEST_KEY);
371 11531 if(!action_uri)
372 {
373 0 result = GlobusWSAddressingErrorSerializeFailed(
374 GLOBUS_SUCCESS, "No SOAPAction defined");
375 0 goto exit;
376 }
377
378 11531 Action.base_value = action_uri;
379 11531 Action.anyAttributes = NULL;
380
381 11531 result = wsa_AttributedURIType_serialize(
382 (xsd_QName *)&wsa_Action_qname,
383 &Action,
384 message_handle,
385 0);
386 11531 if(result != GLOBUS_SUCCESS)
387 {
388 0 result = GlobusWSAddressingErrorSerializeFailed(
389 result, "Action element");
390 0 goto exit;
391 }
392
393 11531 source_endpoint = globus_soap_message_handle_get_attr(
394 message_handle,
395 WSADDR_SOURCE_ENDPOINT_KEY);
396 11531 if(!source_endpoint)
397 {
398 11531 memset(&default_From, 0, sizeof(wsa_EndpointReferenceType));
399 11531 default_From.Address.base_value = WSADDRESSING_ANON_NS;
400 11531 source_endpoint = &default_From;
401 }
402
403 11531 result = wsa_EndpointReferenceType_serialize(
404 (xsd_QName *)&wsa_From_qname,
405 source_endpoint,
406 message_handle,
407 0);
408 11531 if(result != GLOBUS_SUCCESS)
409 {
410 0 result = GlobusWSAddressingErrorSerializeFailed(
411 result, "From element");
412 0 goto exit;
413 }
414
415 11531 reply_endpoint = globus_soap_message_handle_get_attr(
416 message_handle,
417 WSADDR_REPLY_ENDPOINT_KEY);
418 11531 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 11531 fault_endpoint = globus_soap_message_handle_get_attr(
435 message_handle,
436 WSADDR_FAULT_ENDPOINT_KEY);
437 11531 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 11531 if(endpoint_reference && endpoint_reference->ReferenceParameters)
453 {
454 wsa_ReferenceParametersType * props;
455 int i;
456
457 11190 props = endpoint_reference->ReferenceParameters;
458 22380 for(i = 0; i < props->any.length; ++i)
459 {
460 11190 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 11190 if(result != GLOBUS_SUCCESS)
468 {
469 0 goto exit;
470 }
471
472 11190 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 11190 if(result != GLOBUS_SUCCESS)
479 {
480 0 goto exit;
481 }
482
483 11190 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 1829 result = globus_l_ws_addressing_serialize_refparam(
490 message_handle,
491 props->any.elements[0].value);
492 1829 if(result != GLOBUS_SUCCESS)
493 {
494 0 goto exit;
495 }
496 }
497 else
498 {
499 9361 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 11190 if(result != GLOBUS_SUCCESS)
506 {
507 0 result = GlobusWSAddressingErrorSerializeFailed(
508 result, "Reference Parameters");
509 0 goto exit;
510 }
511 }
512 }
513
514 11531 globus_soap_message_handle_set_attr(
515 message_handle,
516 WS_ADDRESSING_CLIENT_REQUEST_ALREADY_INVOKED,
517 NULL, NULL, (void *)1);
518
519 11531 exit:
520
521 11531 GlobusWSAddressingDebugExit();
522
523 11531 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 11446 {
532 wsa_AttributedURIType value;
533 globus_uuid_t message_uuid;
534 GlobusFuncName(globus_ws_addressing_handler_client_invoke_MessageID);
535 11446 GlobusWSAddressingDebugEnter();
536
537 11446 if(result != GLOBUS_SUCCESS)
538 {
539 0 goto exit;
540 }
541
542 11446 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 11446 wsa_AttributedURIType_init_contents(&value);
550
551 11446 result = wsa_AttributedURIType_deserialize(
552 &wsa_MessageID_qname,
553 &value,
554 message_handle,
555 0);
556 11446 if(result != GLOBUS_SUCCESS)
557 {
558 0 result = GlobusWSAddressingErrorDeserializeFailed(
559 result,
560 ("Failed to deserialize MessageID"));
561 0 goto exit;
562 }
563
564 11446 result = globus_uuid_import(
565 &message_uuid, value.base_value + 5);
566 11446 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 11446 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 11446 MessageID_destroy:
583
584 11446 wsa_AttributedURIType_destroy_contents(&value);
585
586 11446 globus_soap_message_handle_set_attr(
587 message_handle,
588 WS_ADDRESSING_CLIENT_MESSAGEID_ALREADY_INVOKED,
589 NULL, NULL, (void *)1);
590
591 11446 exit:
592
593 11446 GlobusWSAddressingDebugExit();
594
595 11446 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 11444 {
683 wsa_RelatesToType value;
684 globus_uuid_t * message_uuid;
685 11444 globus_uuid_t * outbound_uuid = NULL;
686 GlobusFuncName(globus_ws_addressing_handler_client_invoke_RelatesTo);
687 11444 GlobusWSAddressingDebugEnter();
688
689 11444 if(result != GLOBUS_SUCCESS)
690 {
691 0 goto exit;
692 }
693
694 11444 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 11444 wsa_RelatesToType_init_contents(&value);
702
703 11444 result = wsa_RelatesToType_deserialize(
704 &wsa_RelatesTo_qname,
705 &value,
706 message_handle,
707 0);
708 11444 if(result != GLOBUS_SUCCESS)
709 {
710 0 result = GlobusWSAddressingErrorDeserializeFailed(
711 result,
712 ("Failed to deserialize RelatesTo"));
713 0 goto exit;
714 }
715
716 11444 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 11444 message_uuid = globus_malloc(sizeof(globus_uuid_t));
726 11444 if(!message_uuid)
727 {
728 0 result = GlobusWSAddressingErrorMemoryAllocationFailed(
729 sizeof(globus_uuid_t), "message uuid");
730 0 goto exit;
731 }
732
733 11444 result = globus_uuid_import(
734 message_uuid, value.base_value + 5);
735 11444 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 11444 outbound_uuid =
745 (globus_uuid_t *) globus_soap_message_handle_get_attr(
746 message_handle,
747 WSADDR_OUTBOUND_MESSAGE_ID_KEY);
748 11444 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 11444 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 11444 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 11444 globus_free(message_uuid);
775
776 11444 RelatesTo_destroy:
777
778 11444 wsa_RelatesToType_destroy_contents(&value);
779
780 11444 globus_soap_message_handle_set_attr(
781 message_handle,
782 WS_ADDRESSING_CLIENT_RELATESTO_ALREADY_INVOKED,
783 NULL, NULL, (void *)1);
784
785 11444 exit:
786
787 11444 GlobusWSAddressingDebugExit();
788 11444 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 11445 {
918 wsa_AttributedURIType value;
919 11445 char * source_endpoint = NULL;
920 GlobusFuncName(globus_ws_addressing_handler_client_invoke_To);
921 11445 GlobusWSAddressingDebugEnter();
922
923 11445 if(result != GLOBUS_SUCCESS)
924 {
925 0 goto exit;
926 }
927
928 11445 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 11445 wsa_AttributedURIType_init_contents(&value);
936
937 11445 result = wsa_AttributedURIType_deserialize(
938 &wsa_To_qname,
939 &value,
940 message_handle,
941 0);
942 11445 if(result != GLOBUS_SUCCESS)
943 {
944 0 result = GlobusWSAddressingErrorDeserializeFailed(
945 result,
946 ("Failed to deserialize Action"));
947 0 goto exit;
948 }
949
950 11445 source_endpoint = globus_soap_message_handle_get_attr(
951 message_handle,
952 WSADDR_SOURCE_ENDPOINT_KEY);
953 11445 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 11445 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 11445 To_destroy:
975
976 11445 wsa_AttributedURIType_destroy_contents(&value);
977
978 11445 globus_soap_message_handle_set_attr(
979 message_handle,
980 WS_ADDRESSING_CLIENT_TO_ALREADY_INVOKED,
981 NULL, NULL, (void *)1);
982
983 11445 exit:
984
985 11445 GlobusWSAddressingDebugExit();
986 11445 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 11446 {
1077 wsa_AttributedURIType value;
1078 11446 char * response_action = NULL;
1079 GlobusFuncName(globus_ws_addressing_handler_client_invoke_Action);
1080 11446 GlobusWSAddressingDebugEnter();
1081
1082 11446 if(result != GLOBUS_SUCCESS)
1083 {
1084 0 goto exit;
1085 }
1086
1087 11446 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 11446 wsa_AttributedURIType_init_contents(&value);
1095
1096 11446 result = wsa_AttributedURIType_deserialize(
1097 &wsa_Action_qname,
1098 &value,
1099 message_handle,
1100 0);
1101 11446 if(result != GLOBUS_SUCCESS)
1102 {
1103 0 result = GlobusWSAddressingErrorDeserializeFailed(
1104 result,
1105 ("Failed to deserialize Action"));
1106 0 goto exit;
1107 }
1108
1109 11446 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 11195 response_action = globus_soap_message_handle_get_attr(
1119 message_handle,
1120 WSADDR_ACTION_RESPONSE_KEY);
1121 11195 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 11195 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 11446 Action_destroy:
1140
1141 11446 wsa_AttributedURIType_destroy_contents(&value);
1142
1143 11446 globus_soap_message_handle_set_attr(
1144 message_handle,
1145 WS_ADDRESSING_CLIENT_ACTION_ALREADY_INVOKED,
1146 NULL, NULL, (void *)1);
1147
1148 11446 exit:
1149
1150 11446 GlobusWSAddressingDebugExit();
1151 11446 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 11135 {
1247 char * destination;
1248 wsa_EndpointReferenceType * from_epr;
1249 GlobusFuncName(globus_ws_addressing_handler_client_invoke_From);
1250 11135 GlobusWSAddressingDebugEnter();
1251
1252 11135 if(result != GLOBUS_SUCCESS)
1253 {
1254 0 goto exit;
1255 }
1256
1257 11135 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 11135 wsa_EndpointReferenceType_init(
1265 &from_epr);
1266
1267 11135 result = wsa_EndpointReferenceType_deserialize(
1268 &wsa_From_qname,
1269 from_epr,
1270 message_handle,
1271 0);
1272 11135 if(result != GLOBUS_SUCCESS)
1273 {
1274 0 result = GlobusWSAddressingErrorDeserializeFailed(
1275 result, ("Failed to deserialize From element"));
1276 0 goto exit;
1277 }
1278
1279 11135 destination =
1280 globus_soap_message_handle_get_attr(
1281 message_handle,
1282 WSADDR_DESTINATION_KEY);
1283 11135 if(!destination)
1284 {
1285 0 result = GlobusWSAddressingErrorDeserializeFailed(
1286 GLOBUS_SUCCESS,
1287 ("No destination endpoint"));
1288 0 goto destroy_From;
1289 }
1290
1291 11135 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 11135 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 11135 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 11135 destroy_From:
1314
1315 11135 wsa_EndpointReferenceType_destroy(from_epr);
1316
1317 11135 globus_soap_message_handle_set_attr(
1318 message_handle,
1319 WS_ADDRESSING_CLIENT_FROM_ALREADY_INVOKED,
1320 NULL, NULL, (void *)1);
1321
1322 11135 exit:
1323
1324 11135 GlobusWSAddressingDebugExit();
1325 11135 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 11195 {
1453 GlobusFuncName(globus_ws_addressing_handler_client_response_invoke);
1454 11195 GlobusWSAddressingDebugEnter();
1455
1456 11195 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 11195 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 11195 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 11195 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 11195 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 11195 globus_soap_message_handle_set_attr(
1516 message_handle,
1517 WS_ADDRESSING_CLIENT_RESPONSE_ALREADY_INVOKED,
1518 NULL, NULL, (void *)1);
1519
1520 11195 exit:
1521
1522 11195 GlobusWSAddressingDebugExit();
1523 11195 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 9936 {
1532 globus_uuid_t uuid;
1533 9936 char * uuid_string = NULL;
1534 wsa_AttributedURIType MessageID;
1535 wsa_AttributedURIType To;
1536 wsa_AttributedURIType Action;
1537 wsa_RelatesToType RelatesTo;
1538 9936 char * soap_action = NULL;
1539 9936 wsa_EndpointReferenceType * endpoint_reference = NULL;
1540 9936 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 9936 GlobusWSAddressingDebugEnter();
1545
1546 9936 if(result != GLOBUS_SUCCESS)
1547 {
1548 0 goto exit;
1549 }
1550
1551 9936 compat_mode = (globus_bool_t) globus_soap_message_handle_get_attr(
1552 message_handle,
1553 WS_ADDRESSING_SERVER_REQUEST_COMPAT_MODE);
1554
1555 9936 if(globus_soap_message_handle_get_attr(
1556 message_handle,
1557 WS_ADDRESSING_SERVER_RESPONSE_ALREADY_INVOKED))
1558 {
1559 3 goto exit;
1560 }
1561
1562 9933 endpoint_reference = globus_soap_message_handle_get_attr(
1563 message_handle, WSADDR_OUTBOUND_EPR_KEY);
1564 9933 if(!endpoint_reference)
1565 {
1566 9933 endpoint_reference = (wsa_EndpointReferenceType *)
1567 globus_soap_message_handle_get_attr(
1568 message_handle, WSADDR_EPR_KEY);
1569 }
1570
1571 9933 globus_uuid_create(&uuid);
1572 9933 uuid_string = globus_common_create_string("uuid:%s", uuid.text);
1573
1574 9933 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 9933 MessageID.base_value = uuid_string;
1590 9933 MessageID.anyAttributes = NULL;
1591
1592 9933 result = wsa_AttributedURIType_serialize(
1593 (xsd_QName *)&wsa_MessageID_qname,
1594 &MessageID,
1595 message_handle,
1596 0);
1597 }
1598 9933 free(uuid_string);
1599
1600 9933 if(result != GLOBUS_SUCCESS)
1601 {
1602 0 result = GlobusWSAddressingErrorSerializeFailed(
1603 result, "MessageID element");
1604 0 goto exit;
1605 }
1606
1607 9933 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 9933 To.anyAttributes = NULL;
1629 9933 To.base_value = globus_soap_message_handle_get_attr(
1630 message_handle, WSADDR_REQUEST_ENDPOINT_KEY);
1631 9933 result = wsa_AttributedURIType_serialize(
1632 &wsa_To_qname,
1633 &To,
1634 message_handle,
1635 0);
1636 9933 if(result != GLOBUS_SUCCESS)
1637 {
1638 0 result = GlobusWSAddressingErrorSerializeFailed(
1639 result, "To element");
1640 0 goto exit;
1641 }
1642 }
1643
1644 9933 source_endpoint = globus_soap_message_handle_get_attr(
1645 message_handle, WSADDR_SOURCE_ENDPOINT_KEY);
1646 9933 if(! source_endpoint)
1647 {
1648 9933 result = wsa_EndpointReferenceType_init_contents(&default_From);
1649
1650 9933 default_From.Address.base_value =
1651 globus_soap_message_handle_get_attr(
1652 message_handle,
1653 GLOBUS_SOAP_MESSAGE_SERVICE_ENDPOINT_KEY);
1654 9933 if (default_From.Address.base_value == NULL)
1655 {
1656 2 wsa_EndpointReferenceType_destroy_contents(&default_From);
1657 2 source_endpoint = NULL;
1658 }
1659 9931 else if (endpoint_reference && endpoint_reference->ReferenceParameters)
1660 {
1661 9620 default_From.ReferenceParameters =
1662 endpoint_reference->ReferenceParameters;
1663 9620 source_endpoint = &default_From;
1664 }
1665 }
1666
1667 9933 if (compat_mode)
1668 {
1669 wsacompat_EndpointReferenceType compat_source_endpoint;
1670
1671 0 result = wsacompat_EndpointReferenceType_init_contents(
1672 &compat_source_endpoint);
1673 0 if(result != GLOBUS_SUCCESS)
1674 {
1675 0 result = GlobusWSAddressingErrorSerializeFailed(
1676 GLOBUS_FAILURE, "From element");
1677 0 goto exit;
1678 }
1679
1680 0 result = globus_l_wsa_convert_new_epr(
1681 &compat_source_endpoint,
1682 source_endpoint);
1683 0 if(result != GLOBUS_SUCCESS)
1684 {
1685 0 result = GlobusWSAddressingErrorSerializeFailed(
1686 GLOBUS_FAILURE, "From element");
1687 0 goto exit;
1688 }
1689
1690 0 result = wsacompat_EndpointReferenceType_serialize(
1691 &wsacompat_From_qname,
1692 &compat_source_endpoint,
1693 message_handle,
1694 0);
1695 0 if(result != GLOBUS_SUCCESS)
1696 {
1697 0 result = GlobusWSAddressingErrorSerializeFailed(
1698 GLOBUS_FAILURE, "From element");
1699 0 goto exit;
1700 }
1701 0 wsacompat_EndpointReferenceType_destroy_contents(
1702 &compat_source_endpoint);
1703 }
1704 else
1705 {
1706 9933 if (source_endpoint)
1707 {
1708 9620 result = wsa_EndpointReferenceType_serialize(
1709 (xsd_QName *)&wsa_From_qname,
1710 source_endpoint,
1711 message_handle,
1712 0);
1713 9620 if(result != GLOBUS_SUCCESS)
1714 {
1715 0 result = GlobusWSAddressingErrorSerializeFailed(
1716 GLOBUS_FAILURE, "{"WSADDRESSING_NS"}From element");
1717 0 goto exit;
1718 }
1719 }
1720 }
1721
1722 9933 soap_action = globus_soap_message_handle_get_attr(
1723 message_handle, WSADDR_ACTION_RESPONSE_KEY);
1724 9933 if(!soap_action)
1725 {
1726 0 result = GlobusWSAddressingErrorSerializeFailed(
1727 GLOBUS_FAILURE,
1728 "No "WSADDRESSING_NS
1729 "#ResponseAction property defined");
1730 0 goto exit;
1731 }
1732
1733 9933 if (compat_mode)
1734 {
1735 wsacompat_AttributedURI compat_Action;
1736
1737 0 compat_Action.base_value = soap_action;
1738 0 compat_Action.anyAttributes = NULL;
1739
1740 0 result = wsacompat_AttributedURI_serialize(
1741 &wsacompat_Action_qname,
1742 &compat_Action,
1743 message_handle,
1744 0);
1745 }
1746 else
1747 {
1748 9933 Action.base_value = soap_action;
1749 9933 Action.anyAttributes = NULL;
1750
1751 9933 result = wsa_AttributedURIType_serialize(
1752 (xsd_QName *)&wsa_Action_qname,
1753 &Action,
1754 message_handle,
1755 0);
1756 }
1757 9933 if(result != GLOBUS_SUCCESS)
1758 {
1759 0 result = GlobusWSAddressingErrorSerializeFailed(
1760 result, "Action element");
1761 0 goto exit;
1762 }
1763
1764 9933 uuid_string = globus_soap_message_handle_get_attr(
1765 message_handle,
1766 WSADDR_INBOUND_MESSAGE_ID_KEY);
1767 9933 if(!uuid_string)
1768 {
1769 2 result = GlobusWSAddressingErrorSerializeFailed(
1770 result, "RelatesTo element");
1771 2 goto exit;
1772 }
1773
1774 9931 if (compat_mode)
1775 {
1776 wsacompat_Relationship compat_RelatesTo;
1777
1778 0 result = wsacompat_Relationship_init_contents(&compat_RelatesTo);
1779 0 if (result != GLOBUS_SUCCESS)
1780 {
1781 0 result = GlobusWSAddressingErrorSerializeFailed(
1782 result, "RelatesTo element");
1783 0 free(uuid_string);
1784 0 goto exit;
1785 }
1786 0 compat_RelatesTo.base_value = uuid_string;
1787
1788 0 result = wsacompat_Relationship_serialize(
1789 &wsacompat_RelatesTo_qname,
1790 &compat_RelatesTo,
1791 message_handle,
1792 0);
1793 }
1794 else
1795 {
1796 9931 result = wsa_RelatesToType_init_contents(&RelatesTo);
1797 9931 if (result != GLOBUS_SUCCESS)
1798 {
1799 0 result = GlobusWSAddressingErrorSerializeFailed(
1800 result, "RelatesTo element");
1801 0 free(uuid_string);
1802 0 goto exit;
1803 }
1804 9931 RelatesTo.base_value = uuid_string;
1805
1806 9931 result = wsa_RelatesToType_serialize(
1807 (xsd_QName *)&wsa_RelatesTo_qname,
1808 &RelatesTo,
1809 message_handle,
1810 0);
1811 }
1812 9931 if(result != GLOBUS_SUCCESS)
1813 {
1814 0 result = GlobusWSAddressingErrorSerializeFailed(
1815 result, "RelatesTo element");
1816 0 goto exit;
1817 }
1818
1819 9931 globus_soap_message_handle_set_attr(
1820 message_handle,
1821 WS_ADDRESSING_SERVER_RESPONSE_ALREADY_INVOKED,
1822 NULL, NULL, (void *)1);
1823
1824 9936 exit:
1825
1826 9936 GlobusWSAddressingDebugExit();
1827 9936 return result;
1828 }
1829
1830
1831
1832 static
1833 globus_result_t
1834 globus_l_handler_ws_addressing_server_invoke_MessageID(
1835 globus_soap_message_handle_t message_handle,
1836 globus_result_t result)
1837 10021 {
1838 wsa_AttributedURIType messID;
1839 GlobusFuncName(globus_handler_ws_addressing_server_invoke_MessageID);
1840 10021 GlobusWSAddressingDebugEnter();
1841
1842 10021 if(result != GLOBUS_SUCCESS)
1843 {
1844 0 goto exit;
1845 }
1846
1847 10021 if(globus_soap_message_handle_get_attr(
1848 message_handle,
1849 WS_ADDRESSING_SERVER_MESSAGEID_ALREADY_INVOKED))
1850 {
1851 0 goto exit;
1852 }
1853
1854
1855 10021 wsa_AttributedURIType_init_contents(&messID);
1856
1857 10021 result = wsa_AttributedURIType_deserialize(
1858 &wsa_MessageID_qname,
1859 &messID,
1860 message_handle,
1861 0);
1862 10021 if(result != GLOBUS_SUCCESS)
1863 {
1864 0 result = GlobusWSAddressingErrorDeserializeFailed(
1865 result, ("Failed to deserialize MessageID element"));
1866 0 goto exit;
1867 }
1868
1869 10021 globus_soap_message_handle_set_attr(
1870 message_handle,
1871 WSADDR_INBOUND_MESSAGE_ID_KEY,
1872 globus_soap_message_attr_copy_string,
1873 globus_libc_free,
1874 messID.base_value);
1875
1876 10021 wsa_AttributedURIType_destroy_contents(&messID);
1877
1878 10021 globus_soap_message_remove_required_header_element(
1879 message_handle, &wsa_MessageID_qname);
1880
1881 10021 globus_soap_message_handle_set_attr(
1882 message_handle,
1883 WS_ADDRESSING_SERVER_MESSAGEID_ALREADY_INVOKED,
1884 NULL, NULL, (void *)1);
1885
1886 10021 exit:
1887
1888 10021 GlobusWSAddressingDebugExit();
1889 10021 return result;
1890 }
1891
1892 static
1893 globus_result_t
1894 globus_l_handler_ws_addressing_server_invoke_compat_MessageID(
1895 globus_soap_message_handle_t message_handle,
1896 globus_result_t result)
1897 0 {
1898 wsacompat_AttributedURI messID;
1899 GlobusFuncName(globus_handler_ws_addressing_server_invoke_compat_MessageID);
1900 0 GlobusWSAddressingDebugEnter();
1901
1902 0 if(result != GLOBUS_SUCCESS)
1903 {
1904 0 goto exit;
1905 }
1906
1907 0 if(globus_soap_message_handle_get_attr(
1908 message_handle,
1909 WS_ADDRESSING_SERVER_MESSAGEID_ALREADY_INVOKED))
1910 {
1911 0 goto exit;
1912 }
1913
1914
1915 0 wsacompat_AttributedURI_init_contents(&messID);
1916
1917 0 result = wsacompat_AttributedURI_deserialize(
1918 &wsacompat_MessageID_qname,
1919 &messID,
1920 message_handle,
1921 0);
1922 0 if(result != GLOBUS_SUCCESS)
1923 {
1924 0 result = GlobusWSAddressingErrorDeserializeFailed(
1925 result, ("Failed to deserialize MessageID element"));
1926 0 goto exit;
1927 }
1928
1929 0 globus_soap_message_handle_set_attr(
1930 message_handle,
1931 WSADDR_INBOUND_MESSAGE_ID_KEY,
1932 globus_soap_message_attr_copy_string,
1933 globus_libc_free,
1934 messID.base_value);
1935
1936 0 wsacompat_AttributedURI_destroy_contents(&messID);
1937
1938 0 globus_soap_message_remove_required_header_element(
1939 message_handle, &wsacompat_MessageID_qname);
1940
1941 0 globus_soap_message_handle_set_attr(
1942 message_handle,
1943 WS_ADDRESSING_SERVER_MESSAGEID_ALREADY_INVOKED,
1944 NULL, NULL, (void *)1);
1945
1946 0 exit:
1947
1948 0 GlobusWSAddressingDebugExit();
1949 0 return result;
1950 }
1951
1952
1953 static
1954 globus_result_t
1955 globus_l_handler_ws_addressing_server_invoke_From(
1956 globus_soap_message_handle_t message_handle,
1957 globus_result_t result)
1958 10021 {
1959 wsa_EndpointReferenceType from_epr;
1960 GlobusFuncName(globus_handler_ws_addressing_server_invoke_From);
1961 10021 GlobusWSAddressingDebugEnter();
1962
1963 10021 if(result != GLOBUS_SUCCESS)
1964 {
1965 0 goto exit;
1966 }
1967
1968 10021 if(globus_soap_message_handle_get_attr(
1969 message_handle,
1970 WS_ADDRESSING_SERVER_FROM_ALREADY_INVOKED))
1971 {
1972 0 goto exit;
1973 }
1974
1975 10021 wsa_EndpointReferenceType_init_contents(&from_epr);
1976
1977 10021 result = wsa_EndpointReferenceType_deserialize(
1978 &wsa_From_qname,
1979 &from_epr,
1980 message_handle,
1981 0);
1982 10021 if(result != GLOBUS_SUCCESS)
1983 {
1984 0 result = GlobusWSAddressingErrorDeserializeFailed(
1985 result, ("Failed to deserialize From element"));
1986 0 goto exit;
1987 }
1988
1989 10021 globus_soap_message_handle_set_attr(
1990 message_handle,
1991 WSADDR_REQUEST_ENDPOINT_KEY,
1992 globus_soap_message_attr_copy_string,
1993 globus_libc_free,
1994 from_epr.Address.base_value);
1995
1996 10021 wsa_EndpointReferenceType_destroy_contents(
1997 &from_epr);
1998
1999 10021 globus_soap_message_remove_required_header_element(
2000 message_handle, &wsa_From_qname);
2001
2002 10021 globus_soap_message_handle_set_attr(
2003 message_handle,
2004 WS_ADDRESSING_SERVER_FROM_ALREADY_INVOKED,
2005 NULL, NULL, (void *)1);
2006
2007 10021 exit:
2008
2009 10021 GlobusWSAddressingDebugExit();
2010 10021 return result;
2011 }
2012
2013 static
2014 globus_result_t
2015 globus_l_handler_ws_addressing_server_invoke_compat_From(
2016 globus_soap_message_handle_t message_handle,
2017 globus_result_t result)
2018 0 {
2019 wsacompat_EndpointReferenceType compat_from_epr;
2020 GlobusFuncName(globus_handler_ws_addressing_server_invoke_compat_From);
2021 0 GlobusWSAddressingDebugEnter();
2022
2023 0 if(result != GLOBUS_SUCCESS)
2024 {
2025 0 goto exit;
2026 }
2027
2028 0 if(globus_soap_message_handle_get_attr(
2029 message_handle,
2030 WS_ADDRESSING_SERVER_FROM_ALREADY_INVOKED))
2031 {
2032 0 goto exit;
2033 }
2034
2035 0 result = wsacompat_EndpointReferenceType_init_contents(&compat_from_epr);
2036 0 if(result != GLOBUS_SUCCESS)
2037 {
2038 0 result = GlobusWSAddressingErrorDeserializeFailed(
2039 result, ("Failed to deserialize From element"));
2040 0 goto exit;
2041 }
2042
2043 0 result = wsacompat_EndpointReferenceType_deserialize(
2044 &wsacompat_From_qname,
2045 &compat_from_epr,
2046 message_handle,
2047 0);
2048 0 if(result != GLOBUS_SUCCESS)
2049 {
2050 0 result = GlobusWSAddressingErrorDeserializeFailed(
2051 result, ("Failed to deserialize From element"));
2052 0 goto exit;
2053 }
2054
2055 0 if(result != GLOBUS_SUCCESS)
2056 {
2057 0 result = GlobusWSAddressingErrorDeserializeFailed(
2058 result, ("Failed to deserialize From element"));
2059 0 goto exit;
2060 }
2061
2062 0 globus_soap_message_handle_set_attr(
2063 message_handle,
2064 WSADDR_REQUEST_ENDPOINT_KEY,
2065 globus_soap_message_attr_copy_string,
2066 globus_libc_free,
2067 compat_from_epr.Address.base_value);
2068
2069 0 wsacompat_EndpointReferenceType_destroy_contents(
2070 &compat_from_epr);
2071
2072 0 globus_soap_message_remove_required_header_element(
2073 message_handle, &wsacompat_From_qname);
2074
2075 0 globus_soap_message_handle_set_attr(
2076 message_handle,
2077 WS_ADDRESSING_SERVER_FROM_ALREADY_INVOKED,
2078 NULL, NULL, (void *)1);
2079
2080 0 exit:
2081
2082 0 GlobusWSAddressingDebugExit();
2083 0 return result;
2084 }
2085
2086 static
2087 globus_result_t
2088 globus_l_handler_ws_addressing_server_invoke_To(
2089 globus_soap_message_handle_t message_handle,
2090 globus_result_t result)
2091 10021 {
2092 wsa_EndpointReferenceType * dest_epr;
2093 wsa_AttributedURIType To;
2094 GlobusFuncName(globus_handler_ws_addressing_server_invoke_To);
2095 10021 GlobusWSAddressingDebugEnter();
2096
2097 10021 if(result != GLOBUS_SUCCESS)
2098 {
2099 0 goto exit;
2100 }
2101
2102 10021 if(globus_soap_message_handle_get_attr(
2103 message_handle,
2104 WS_ADDRESSING_SERVER_TO_ALREADY_INVOKED))
2105 {
2106 0 goto exit;
2107 }
2108
2109 10021 wsa_AttributedURIType_init_contents(&To);
2110
2111 10021 result = wsa_AttributedURIType_deserialize(
2112 &wsa_To_qname,
2113 &To,
2114 message_handle,
2115 0);
2116 10021 if(result != GLOBUS_SUCCESS)
2117 {
2118 0 result = GlobusWSAddressingErrorDeserializeFailed(
2119 result, ("Failed to deserialize To element"));
2120 0 goto exit;
2121 }
2122
2123 10021 globus_soap_message_handle_set_attr(
2124 message_handle,
2125 GLOBUS_SOAP_MESSAGE_SERVICE_ENDPOINT_KEY,
2126 globus_soap_message_attr_copy_string,
2127 globus_libc_free,
2128 To.base_value);
2129
2130 10021 wsa_EndpointReferenceType_init(&dest_epr);
2131
2132 10021 dest_epr->Address.base_value = globus_libc_strdup(To.base_value);
2133
2134 10021 wsa_AttributedURIType_destroy_contents(&To);
2135
2136 10021 globus_soap_message_handle_set_attr(
2137 message_handle,
2138 WSADDR_EPR_KEY,
2139 wsa_EndpointReferenceType_info.copy,
2140 wsa_EndpointReferenceType_info.destroy,
2141 (void *) dest_epr);
2142
2143 10021 wsa_EndpointReferenceType_destroy(dest_epr);
2144
2145 10021 globus_soap_message_remove_required_header_element(
2146 message_handle, &wsa_To_qname);
2147
2148 10021 globus_soap_message_handle_set_attr(
2149 message_handle,
2150 WS_ADDRESSING_SERVER_TO_ALREADY_INVOKED,
2151 NULL, NULL, (void *)1);
2152
2153 10021 exit:
2154
2155 10021 GlobusWSAddressingDebugExit();
2156 10021 return result;
2157 }
2158
2159 static
2160 globus_result_t
2161 globus_l_handler_ws_addressing_server_invoke_compat_To(
2162 globus_soap_message_handle_t message_handle,
2163 globus_result_t result)
2164 0 {
2165 wsa_EndpointReferenceType * dest_epr;
2166 wsa_AttributedURIType To;
2167 wsacompat_AttributedURI compat_To;
2168 GlobusFuncName(globus_handler_ws_addressing_server_invoke_compat_To);
2169 0 GlobusWSAddressingDebugEnter();
2170
2171 0 if(result != GLOBUS_SUCCESS)
2172 {
2173 0 goto exit;
2174 }
2175
2176 0 if(globus_soap_message_handle_get_attr(
2177 message_handle,
2178 WS_ADDRESSING_SERVER_TO_ALREADY_INVOKED))
2179 {
2180 0 goto exit;
2181 }
2182
2183 0 wsacompat_AttributedURI_init_contents(&compat_To);
2184
2185 0 result = wsacompat_AttributedURI_deserialize(
2186 &wsacompat_To_qname,
2187 &compat_To,
2188 message_handle,
2189 0);
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 result = wsa_AttributedURIType_init_contents(&To);
2198 0 if(result != GLOBUS_SUCCESS)
2199 {
2200 0 result = GlobusWSAddressingErrorDeserializeFailed(
2201 result, ("Failed to deserialize To element"));
2202 0 goto exit;
2203 }
2204
2205 0 To.base_value = compat_To.base_value;
2206 0 To.anyAttributes = compat_To.anyAttributes;
2207
2208 0 globus_soap_message_handle_set_attr(
2209 message_handle,
2210 GLOBUS_SOAP_MESSAGE_SERVICE_ENDPOINT_KEY,
2211 globus_soap_message_attr_copy_string,
2212 globus_libc_free,
2213 To.base_value);
2214
2215 0 wsa_EndpointReferenceType_init(&dest_epr);
2216
2217 0 dest_epr->Address.base_value = globus_libc_strdup(To.base_value);
2218 0 wsacompat_AttributedURI_destroy_contents(&compat_To);
2219
2220 0 globus_soap_message_handle_set_attr(
2221 message_handle,
2222 WSADDR_EPR_KEY,
2223 wsa_EndpointReferenceType_info.copy,
2224 wsa_EndpointReferenceType_info.destroy,
2225 (void *) dest_epr);
2226
2227 0 wsa_EndpointReferenceType_destroy(dest_epr);
2228
2229 0 globus_soap_message_remove_required_header_element(
2230 message_handle, &wsacompat_To_qname);
2231
2232 0 globus_soap_message_handle_set_attr(
2233 message_handle,
2234 WS_ADDRESSING_SERVER_TO_ALREADY_INVOKED,
2235 NULL, NULL, (void *)1);
2236
2237 0 globus_soap_message_handle_set_attr(
2238 message_handle,
2239 WS_ADDRESSING_SERVER_REQUEST_COMPAT_MODE,
2240 NULL, NULL, (void *)1);
2241
2242 0 exit:
2243
2244 0 GlobusWSAddressingDebugExit();
2245 0 return result;
2246 }
2247
2248 static
2249 globus_result_t
2250 globus_l_handler_ws_addressing_server_invoke_Action(
2251 globus_soap_message_handle_t message_handle,
2252 globus_result_t result)
2253 10021 {
2254 wsa_AttributedURIType Action;
2255 GlobusFuncName(globus_handler_ws_addressing_server_invoke_Action);
2256 10021 GlobusWSAddressingDebugEnter();
2257
2258 10021 if(result != GLOBUS_SUCCESS)
2259 {
2260 0 goto exit;
2261 }
2262
2263 10021 if(globus_soap_message_handle_get_attr(
2264 message_handle,
2265 WS_ADDRESSING_SERVER_ACTION_ALREADY_INVOKED))
2266 {
2267 0 goto exit;
2268 }
2269
2270 10021 wsa_AttributedURIType_init_contents(&Action);
2271
2272 10021 result = wsa_AttributedURIType_deserialize(
2273 &wsa_Action_qname,
2274 &Action,
2275 message_handle,
2276 0);
2277 10021 if(result != GLOBUS_SUCCESS)
2278 {
2279 0 result = GlobusWSAddressingErrorDeserializeFailed(
2280 result, ("Failed to deserialize Action element"));
2281 0 goto exit;
2282 }
2283
2284 10021 globus_soap_message_handle_set_attr(
2285 message_handle,
2286 WSADDR_ACTION_REQUEST_KEY,
2287 globus_soap_message_attr_copy_string,
2288 globus_libc_free,
2289 Action.base_value);
2290
2291 10021 globus_soap_message_remove_required_header_element(
2292 message_handle, &wsa_Action_qname);
2293
2294 10021 globus_soap_message_handle_set_attr(
2295 message_handle,
2296 WS_ADDRESSING_SERVER_ACTION_ALREADY_INVOKED,
2297 NULL, NULL, (void *)1);
2298 10021 wsa_AttributedURIType_destroy_contents(&Action);
2299
2300 10021 exit:
2301
2302 10021 GlobusWSAddressingDebugExit();
2303 10021 return result;
2304 }
2305
2306 static
2307 globus_result_t
2308 globus_l_handler_ws_addressing_server_invoke_compat_Action(
2309 globus_soap_message_handle_t message_handle,
2310 globus_result_t result)
2311 0 {
2312 wsacompat_AttributedURI Action;
2313 GlobusFuncName(globus_handler_ws_addressing_server_invoke_compat_Action);
2314 0 GlobusWSAddressingDebugEnter();
2315
2316 0 if(result != GLOBUS_SUCCESS)
2317 {
2318 0 goto exit;
2319 }
2320
2321 0 if(globus_soap_message_handle_get_attr(
2322 message_handle,
2323 WS_ADDRESSING_SERVER_ACTION_ALREADY_INVOKED))
2324 {
2325 0 goto exit;
2326 }
2327
2328 0 wsacompat_AttributedURI_init_contents(&Action);
2329
2330 0 result = wsacompat_AttributedURI_deserialize(
2331 &wsacompat_Action_qname,
2332 &Action,
2333 message_handle,
2334 0);
2335 0 if(result != GLOBUS_SUCCESS)
2336 {
2337 0 result = GlobusWSAddressingErrorDeserializeFailed(
2338 result, ("Failed to deserialize Action element"));
2339 0 goto exit;
2340 }
2341
2342 0 globus_soap_message_handle_set_attr(
2343 message_handle,
2344 WSADDR_ACTION_REQUEST_KEY,
2345 globus_soap_message_attr_copy_string,
2346 globus_libc_free,
2347 Action.base_value);
2348
2349 0 globus_soap_message_remove_required_header_element(
2350 message_handle, &wsacompat_Action_qname);
2351
2352 0 globus_soap_message_handle_set_attr(
2353 message_handle,
2354 WS_ADDRESSING_SERVER_ACTION_ALREADY_INVOKED,
2355 NULL, NULL, (void *)1);
2356 0 wsacompat_AttributedURI_destroy_contents(&Action);
2357
2358 0 exit:
2359
2360 0 GlobusWSAddressingDebugExit();
2361 0 return result;
2362 }
2363
2364
2365 static
2366 globus_result_t
2367 globus_handler_ws_addressing_server_request_default_trigger(
2368 globus_soap_message_handle_t message_handle,
2369 globus_result_t result)
2370 9710 {
2371 wsa_EndpointReferenceType * dest_epr;
2372 GlobusFuncName(
2373 globus_handler_ws_addressing_server_request_default_trigger);
2374 9710 GlobusWSAddressingDebugEnter();
2375
2376 9710 if(result != GLOBUS_SUCCESS)
2377 {
2378 0 goto exit;
2379 }
2380
2381 9710 dest_epr = globus_soap_message_handle_get_attr(
2382 message_handle,
2383 WSADDR_OUTBOUND_EPR_KEY);
2384 9710 if(!dest_epr)
2385 {
2386 9710 dest_epr = globus_soap_message_handle_get_attr(
2387 message_handle,
2388 WSADDR_EPR_KEY);
2389 }
2390
2391 9710 if(dest_epr)
2392 {
2393 9710 wsa_ReferenceParametersType_init(&dest_epr->ReferenceParameters);
2394
2395 9710 result = globus_l_ws_addressing_deserialize_refparams(
2396 NULL,
2397 &dest_epr->ReferenceParameters->any,
2398 message_handle,
2399 0);
2400
2401 9710 if(result != GLOBUS_SUCCESS)
2402 {
2403 0 result = GlobusWSAddressingErrorDeserializeFailed(
2404 result,
2405 ("Failed to deserialize ReferenceParameters elements"));
2406 0 goto exit;
2407 }
2408 }
2409 else
2410 {
2411 xsd_QName header_elem;
2412 0 result = globus_soap_message_deserialize_element_unknown(
2413 message_handle, &header_elem);
2414 0 if(result != GLOBUS_SUCCESS)
2415 {
2416 0 result = GlobusWSAddressingErrorDeserializeFailed(
2417 result,
2418 ("Failed skipping unknown header element"));
2419 0 goto exit;
2420 }
2421
2422 0 result = globus_soap_message_deserialize_skip(
2423 message_handle);
2424 0 if(result != GLOBUS_SUCCESS)
2425 {
2426 0 result = GlobusWSAddressingErrorDeserializeFailed(
2427 result,
2428 ("Failed skipping unknown header element"));
2429 0 goto exit;
2430 }
2431
2432 0 result = globus_soap_message_deserialize_element_end(
2433 message_handle,
2434 &header_elem);
2435 0 if(result != GLOBUS_SUCCESS)
2436 {
2437 0 result = GlobusWSAddressingErrorDeserializeFailed(
2438 result,
2439 ("Failed skipping unknown header element"));
2440 0 goto exit;
2441 }
2442 }
2443
2444 9710 exit:
2445
2446 9710 GlobusWSAddressingDebugExit();
2447 9710 return result;
2448 }
2449
2450 static
2451 globus_result_t
2452 globus_handler_ws_addressing_server_request_invoke(
2453 globus_soap_message_handle_t message_handle,
2454 globus_result_t result)
2455 10022 {
2456 10022 int To_handled = 0;
2457 10022 int Action_handled = 0;
2458 GlobusFuncName(globus_handler_ws_addressing_server_request_invoke);
2459 10022 GlobusWSAddressingDebugEnter();
2460
2461 10022 if(globus_soap_message_handle_get_attr(
2462 message_handle,
2463 WS_ADDRESSING_SERVER_REQUEST_ALREADY_INVOKED))
2464 {
2465 3 goto exit;
2466 }
2467
2468 10019 if(globus_soap_message_handle_get_attr(
2469 message_handle,
2470 GLOBUS_SOAP_MESSAGE_SERVICE_ENDPOINT_KEY))
2471 {
2472 10019 To_handled = 1;
2473 }
2474
2475 10019 if(globus_soap_message_handle_get_attr(
2476 message_handle,
2477 WSADDR_ACTION_REQUEST_KEY))
2478 {
2479 10019 Action_handled = 1;
2480 }
2481
2482 10019 if(!To_handled || !Action_handled)
2483 {
2484 xsd_QName * missing_header_qname;
2485 xsd_any * missing_header;
2486 globus_soap_message_fault_t soap_fault;
2487
2488 0 globus_soap_message_fault_init(&soap_fault);
2489
2490 0 xsd_QName_init(&missing_header_qname);
2491 0 if(!To_handled)
2492 {
2493 0 missing_header_qname->local =
2494 globus_libc_strdup(wsa_To_qname.local);
2495 0 missing_header_qname->Namespace =
2496 globus_libc_strdup(wsa_To_qname.Namespace);
2497 }
2498 else
2499 {
2500 0 missing_header_qname->local =
2501 globus_libc_strdup(wsa_Action_qname.local);
2502 0 missing_header_qname->Namespace =
2503 globus_libc_strdup(wsa_Action_qname.Namespace);
2504 }
2505
2506 0 xsd_any_init((void *)&missing_header);
2507 0 missing_header->any_info = &xsd_QName_contents_info;
2508 0 missing_header->value = (void *)missing_header_qname;
2509
2510 0 soap_fault->faultcode =
2511 globus_libc_strdup("MessageInformationHeaderRequired");
2512 0 soap_fault->faultstring = globus_libc_strdup(
2513 "A required message information header: To, MessageID, "
2514 "or Action is not present.");
2515 0 soap_fault->detail = missing_header;
2516
2517 0 result = GlobusSoapMessageErrorFault(soap_fault);
2518 0 goto exit;
2519 }
2520
2521 10019 globus_soap_message_handle_set_attr(
2522 message_handle,
2523 WS_ADDRESSING_SERVER_REQUEST_ALREADY_INVOKED,
2524 NULL, NULL, (void *)1);
2525
2526 10022 exit:
2527
2528 10022 GlobusWSAddressingDebugExit();
2529 10022 return result;
2530 }
2531
2532 #define GLOBUS_L_HANDLER_WSADD_DEFINE_CLIENT_TRIGGER(__ELEMENT__) \
2533 static globus_handler_trigger_t \
2534 globus_l_handler_ws_addressing_client_trigger_##__ELEMENT__ = \
2535 { \
2536 &wsa_##__ELEMENT__##_qname, \
2537 globus_l_handler_ws_addressing_client_invoke_##__ELEMENT__ \
2538 }; \
2539 static globus_handler_trigger_t \
2540 globus_l_handler_ws_addressing_client_trigger_compat_##__ELEMENT__ =\
2541 { \
2542 &wsacompat_##__ELEMENT__##_qname, \
2543 globus_l_handler_ws_addressing_client_invoke_compat_##__ELEMENT__\
2544 }
2545
2546 GLOBUS_L_HANDLER_WSADD_DEFINE_CLIENT_TRIGGER(MessageID);
2547 GLOBUS_L_HANDLER_WSADD_DEFINE_CLIENT_TRIGGER(RelatesTo);
2548 GLOBUS_L_HANDLER_WSADD_DEFINE_CLIENT_TRIGGER(To);
2549 GLOBUS_L_HANDLER_WSADD_DEFINE_CLIENT_TRIGGER(Action);
2550 GLOBUS_L_HANDLER_WSADD_DEFINE_CLIENT_TRIGGER(From);
2551
2552 #define GLOBUS_L_HANDLER_WSADD_DEFINE_SERVER_TRIGGER(__ELEMENT__) \
2553 static globus_handler_trigger_t \
2554 globus_l_handler_ws_addressing_server_trigger_##__ELEMENT__ = \
2555 { \
2556 &wsa_##__ELEMENT__##_qname, \
2557 globus_l_handler_ws_addressing_server_invoke_##__ELEMENT__ \
2558 }; \
2559 static globus_handler_trigger_t \
2560 globus_l_handler_ws_addressing_server_trigger_compat_##__ELEMENT__ =\
2561 { \
2562 &wsacompat_##__ELEMENT__##_qname, \
2563 globus_l_handler_ws_addressing_server_invoke_compat_##__ELEMENT__\
2564 }
2565
2566 GLOBUS_L_HANDLER_WSADD_DEFINE_SERVER_TRIGGER(MessageID);
2567 GLOBUS_L_HANDLER_WSADD_DEFINE_SERVER_TRIGGER(To);
2568 GLOBUS_L_HANDLER_WSADD_DEFINE_SERVER_TRIGGER(Action);
2569 GLOBUS_L_HANDLER_WSADD_DEFINE_SERVER_TRIGGER(From);
2570
2571 globus_handler_descriptor_t globus_l_handler_ws_addressing_client_descriptor =
2572 {
2573 NULL,
2574 globus_handler_ws_addressing_client_request_invoke,
2575 NULL,
2576 NULL,
2577 globus_handler_ws_addressing_client_response_invoke,
2578 NULL,
2579 NULL,
2580 NULL
2581 };
2582
2583 globus_handler_descriptor_t globus_l_handler_ws_addressing_server_descriptor =
2584 {
2585 NULL,
2586 globus_handler_ws_addressing_server_request_invoke,
2587 NULL,
2588 NULL,
2589 globus_handler_ws_addressing_server_response_invoke,
2590 NULL,
2591 NULL,
2592 globus_handler_ws_addressing_server_request_default_trigger
2593 };
2594
2595 int
2596 globus_l_handler_ws_addressing_activate(void)
2597 649 {
2598 649 int res = 0;
2599 GlobusFuncName(globus_l_handler_ws_addressing_activate);
2600
2601 649 GlobusDebugInit(GLOBUS_HANDLER_WS_ADDRESSING, TRACE DEBUG);
2602 649 GlobusWSAddressingDebugEnter();
2603
2604 649 globus_l_handler_ws_addressing_client_descriptor.trigger_list = NULL;
2605
2606 649 globus_list_insert(
2607 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2608 &globus_l_handler_ws_addressing_client_trigger_MessageID);
2609 649 globus_list_insert(
2610 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2611 &globus_l_handler_ws_addressing_client_trigger_RelatesTo);
2612 649 globus_list_insert(
2613 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2614 &globus_l_handler_ws_addressing_client_trigger_To);
2615 649 globus_list_insert(
2616 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2617 &globus_l_handler_ws_addressing_client_trigger_Action);
2618 649 globus_list_insert(
2619 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2620 &globus_l_handler_ws_addressing_client_trigger_From);
2621
2622 649 globus_list_insert(
2623 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2624 &globus_l_handler_ws_addressing_client_trigger_compat_MessageID);
2625 649 globus_list_insert(
2626 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2627 &globus_l_handler_ws_addressing_client_trigger_compat_RelatesTo);
2628 649 globus_list_insert(
2629 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2630 &globus_l_handler_ws_addressing_client_trigger_compat_To);
2631 649 globus_list_insert(
2632 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2633 &globus_l_handler_ws_addressing_client_trigger_compat_Action);
2634 649 globus_list_insert(
2635 &globus_l_handler_ws_addressing_client_descriptor.trigger_list,
2636 &globus_l_handler_ws_addressing_client_trigger_compat_From);
2637
2638 649 res = globus_extension_registry_add(
2639 GLOBUS_HANDLER_REGISTRY,
2640 GLOBUS_HANDLER_WS_ADDRESSING_CLIENT,
2641 GlobusExtensionMyModule(globus_handler_ws_addressing),
2642 &globus_l_handler_ws_addressing_client_descriptor);
2643 649 if(res != GLOBUS_SUCCESS)
2644 {
2645 0 goto exit;
2646 }
2647
2648 649 globus_l_handler_ws_addressing_server_descriptor.trigger_list = NULL;
2649 649 globus_list_insert(
2650 &globus_l_handler_ws_addressing_server_descriptor.trigger_list,
2651 &globus_l_handler_ws_addressing_server_trigger_MessageID);
2652 649 globus_list_insert(
2653 &globus_l_handler_ws_addressing_server_descriptor.trigger_list,
2654 &globus_l_handler_ws_addressing_server_trigger_To);
2655 649 globus_list_insert(
2656 &globus_l_handler_ws_addressing_server_descriptor.trigger_list,
2657 &globus_l_handler_ws_addressing_server_trigger_Action);
2658 649 globus_list_insert(
2659 &globus_l_handler_ws_addressing_server_descriptor.trigger_list,
2660 &globus_l_handler_ws_addressing_server_trigger_From);
2661
2662 649 globus_list_insert(
2663 &globus_l_handler_ws_addressing_server_descriptor.trigger_list,
2664 &globus_l_handler_ws_addressing_server_trigger_compat_MessageID);
2665 649 globus_list_insert(
2666 &globus_l_handler_ws_addressing_server_descriptor.trigger_list,
2667 &globus_l_handler_ws_addressing_server_trigger_compat_To);
2668 649 globus_list_insert(
2669 &globus_l_handler_ws_addressing_server_descriptor.trigger_list,
2670 &globus_l_handler_ws_addressing_server_trigger_compat_Action);
2671 649 globus_list_insert(
2672 &globus_l_handler_ws_addressing_server_descriptor.trigger_list,
2673 &globus_l_handler_ws_addressing_server_trigger_compat_From);
2674 649 res = globus_extension_registry_add(
2675 GLOBUS_HANDLER_REGISTRY,
2676 GLOBUS_HANDLER_WS_ADDRESSING_SERVER,
2677 GlobusExtensionMyModule(globus_handler_ws_addressing),
2678 &globus_l_handler_ws_addressing_server_descriptor);
2679
2680 649 exit:
2681
2682 649 GlobusWSAddressingDebugExit();
2683 649 return res;
2684 }
2685
2686 int
2687 globus_l_handler_ws_addressing_deactivate(void)
2688 3 {
2689 GlobusFuncName(globus_l_handler_ws_addressing_deactivate);
2690 3 GlobusWSAddressingDebugEnter();
2691
2692 3 globus_extension_registry_remove(
2693 GLOBUS_HANDLER_REGISTRY,
2694 GLOBUS_HANDLER_WS_ADDRESSING_CLIENT);
2695
2696 3 globus_extension_registry_remove(
2697 GLOBUS_HANDLER_REGISTRY,
2698 GLOBUS_HANDLER_WS_ADDRESSING_SERVER);
2699
2700 3 globus_list_free(
2701 globus_l_handler_ws_addressing_client_descriptor.trigger_list);
2702
2703 3 globus_list_free(
2704 globus_l_handler_ws_addressing_server_descriptor.trigger_list);
2705
2706 3 globus_l_handler_ws_addressing_client_descriptor.trigger_list = NULL;
2707 3 globus_l_handler_ws_addressing_server_descriptor.trigger_list = NULL;
2708
2709 3 GlobusWSAddressingDebugExit();
2710 3 return 0;
2711 }
2712
2713 static
2714 globus_result_t
2715 globus_l_uuid_copy(
2716 void ** new_id,
2717 const void * id)
2718 34421 {
2719 34421 const globus_uuid_t * uuid = id;
2720 globus_uuid_t * new_uuid;
2721
2722 34421 new_uuid = globus_malloc(sizeof(globus_uuid_t));
2723 34421 globus_uuid_import(new_uuid, uuid->text);
2724
2725 34421 *new_id = new_uuid;
2726 34421 return GLOBUS_SUCCESS;
2727 }
2728
2729 static
2730 globus_result_t
2731 globus_l_wsa_convert_old_epr(
2732 wsa_EndpointReferenceType * new_epr,
2733 wsacompat_EndpointReferenceType * old_epr)
2734 0 {
2735 globus_result_t result;
2736
2737 0 result = xsd_anyURI_copy_contents(
2738 &new_epr->Address.base_value,
2739 &old_epr->Address.base_value);
2740 0 if(result != GLOBUS_SUCCESS)
2741 {
2742 0 goto out;
2743 }
2744 0 result = xsd_anyAttributes_copy(
2745 &new_epr->Address.anyAttributes,
2746 old_epr->Address.anyAttributes);
2747 0 if(result != GLOBUS_SUCCESS)
2748 {
2749 0 goto out;
2750 }
2751
2752 0 if (old_epr->ReferenceProperties != NULL)
2753 {
2754 0 result = wsa_ReferenceParametersType_init(
2755 &new_epr->ReferenceParameters);
2756 0 if (result != GLOBUS_SUCCESS)
2757 {
2758 0 goto out;
2759 }
2760
2761 0 result = xsd_any_array_copy_contents(
2762 &new_epr->ReferenceParameters->any,
2763 &old_epr->ReferenceProperties->any);
2764 if (result != GLOBUS_SUCCESS)
2765 {
2766 0 goto out;
2767 }
2768 }
2769
2770 /* TODO: Deal with other elements in the old EPR */
2771
2772 0 out:
2773 0 return result;
2774 }
2775 /* globus_l_wsa_convert_old_epr() */
2776
2777 static
2778 globus_result_t
2779 globus_l_wsa_convert_new_epr(
2780 wsacompat_EndpointReferenceType * new_epr,
2781 wsa_EndpointReferenceType * old_epr)
2782 0 {
2783 globus_result_t result;
2784
2785 0 result = xsd_anyURI_copy_contents(
2786 &new_epr->Address.base_value,
2787 &old_epr->Address.base_value);
2788 0 if(result != GLOBUS_SUCCESS)
2789 {
2790 0 goto out;
2791 }
2792
2793 0 if (old_epr->Address.anyAttributes)
2794 {
2795 0 result = xsd_anyAttributes_copy(
2796 &new_epr->Address.anyAttributes,
2797 old_epr->Address.anyAttributes);
2798 0 if(result != GLOBUS_SUCCESS)
2799 {
2800 0 goto out;
2801 }
2802 }
2803
2804 0 if (old_epr->ReferenceParameters)
2805 {
2806 0 result = wsacompat_ReferencePropertiesType_init(
2807 &new_epr->ReferenceProperties);
2808 0 if (result != GLOBUS_SUCCESS)
2809 {
2810 0 goto out;
2811 }
2812
2813 0 result = xsd_any_array_copy_contents(
2814 &new_epr->ReferenceProperties->any,
2815 &old_epr->ReferenceParameters->any);
2816 if (result != GLOBUS_SUCCESS)
2817 {
2818 0 goto out;
2819 }
2820 }
2821
2822 /* TODO: Deal with other elements in the old EPR */
2823
2824 0 out:
2825 0 return result;
2826 }
2827 /* globus_l_wsa_convert_new_epr() */
2828
2829 static
2830 globus_result_t
2831 globus_l_ws_addressing_refparam_ns_set(
2832 globus_soap_message_handle_t message_handle,
2833 const xsd_QName * element,
2834 globus_xsd_element_options_t * options)
2835 11190 {
2836 11190 return globus_soap_message_element_ns_set(
2837 message_handle,
2838 element,
2839 WSADDRESSING_NS,
2840 options);
2841 }
2842 /* globus_l_ws_addressing_refparam_ns_set() */
2843
2844 static
2845 globus_result_t
2846 globus_l_ws_addressing_refparam_ns_add(
2847 globus_soap_message_handle_t message_handle,
2848 const xsd_QName * element,
2849 globus_xsd_element_options_t * options)
2850 11190 {
2851 11190 return globus_soap_message_element_ns_add(
2852 message_handle,
2853 element,
2854 WSADDRESSING_NS,
2855 options);
2856 }
2857
2858 static
2859 globus_result_t
2860 globus_l_ws_addressing_refparam_ns_remove(
2861 globus_soap_message_handle_t message_handle,
2862 const xsd_QName * element,
2863 globus_xsd_element_options_t * options)
2864 11190 {
2865 11190 globus_soap_message_element_ns_remove(
2866 message_handle,
2867 WSADDRESSING_NS,
2868 options);
2869 11190 return GLOBUS_SUCCESS;
2870 }
2871 /* globus_l_ws_addressing_refparam_ns_remove() */
2872
2873 static
2874 globus_result_t
2875 globus_l_ws_addressing_refparam_attr(
2876 globus_soap_message_handle_t message_handle,
2877 const xsd_QName * type)
2878 11190 {
2879 11190 xsd_boolean trueval = 1;
2880
2881 11190 return globus_soap_message_serialize_boolean_attribute(
2882 message_handle, &wsa_IsReferenceParameter_qname, &trueval);
2883 }
2884 /* globus_l_ws_addressing_refparam_attr() */
2885
2886 static
2887 globus_result_t
2888 globus_l_ws_addressing_serialize_refparam(
2889 globus_soap_message_handle_t message_handle,
2890 globus_xml_buffer * buffer)
2891 1829 {
2892 globus_soap_message_handle_t dom_handle;
2893 xmlDocPtr doc;
2894 xmlNodePtr root;
2895 xsd_anyAttributes_t any_attrs;
2896 xsd_QName element;
2897 1829 xsd_QName any_qname = { "##any", "any" };
2898 globus_xml_buffer new_buffer;
2899 globus_result_t result;
2900 1829 globus_xsd_element_options_t options = 0;
2901
2902 1829 result = globus_soap_message_handle_init_to_dom(&dom_handle, &doc);
2903 1829 if (result != GLOBUS_SUCCESS)
2904 {
2905 0 goto out;
2906 }
2907
2908 1829 result = globus_xml_buffer_serialize_contents(
2909 NULL,
2910 buffer,
2911 dom_handle,
2912 0);
2913 1829 globus_soap_message_handle_destroy(dom_handle);
2914
2915 1829 if (result != GLOBUS_SUCCESS)
2916 {
2917 0 goto destroy_doc_out;
2918 }
2919
2920
2921 1829 root = xmlDocGetRootElement(doc);
2922
2923 1829 result = globus_soap_message_handle_init_from_dom(&dom_handle, doc);
2924 1829 if (result != GLOBUS_SUCCESS)
2925 {
2926 0 goto destroy_doc_out;
2927 }
2928
2929 1829 result = globus_soap_message_deserialize_element_unknown(
2930 dom_handle,
2931 &element);
2932
2933 1829 if (result != GLOBUS_SUCCESS)
2934 {
2935 0 goto destroy_handle_out;
2936 }
2937
2938 1829 result = xsd_anyAttributes_init(&any_attrs);
2939 1829 if (result != GLOBUS_SUCCESS)
2940 {
2941 0 goto destroy_handle_out;
2942 }
2943
2944 1829 result = xsd_anyAttributes_deserialize(
2945 dom_handle,
2946 any_attrs,
2947 &any_qname);
2948
2949 1829 if (result != GLOBUS_SUCCESS)
2950 {
2951 0 goto destroy_handle_out;
2952 }
2953
2954 1829 result = globus_xml_buffer_deserialize_contents(
2955 NULL,
2956 &new_buffer,
2957 dom_handle,
2958 0);
2959 1829 if (result != GLOBUS_SUCCESS)
2960 {
2961 0 goto destroy_handle_out;
2962 }
2963
2964 1829 result = globus_soap_message_element_ns_set(
2965 message_handle,
2966 &element,
2967 element.Namespace,
2968 &options);
2969
2970 1829 result = xsd_anyAttributes_namespace_set(
2971 message_handle,
2972 &element,
2973 any_attrs,
2974 &options);
2975
2976 1829 result = globus_soap_message_attribute_ns_set(
2977 message_handle,
2978 &element,
2979 WSADDRESSING_NS,
2980 &options);
2981
2982 1829 result = globus_soap_message_serialize_element(
2983 message_handle,
2984 &element,
2985 options,
2986 NULL);
2987
2988 1829 result = globus_soap_message_element_ns_add(
2989 message_handle,
2990 &element,
2991 element.Namespace,
2992 &options);
2993
2994 1829 result = xsd_anyAttributes_namespace_add(
2995 message_handle,
2996 &element,
2997 any_attrs,
2998 &options);
2999
3000 1829 result = globus_soap_message_attribute_ns_add(
3001 message_handle,
3002 &element,
3003 WSADDRESSING_NS,
3004 &options);
3005
3006 1829 result = xsd_anyAttributes_serialize(
3007 message_handle,
3008 any_attrs);
3009 1829 result = globus_soap_message_serialize_element_begin_close(
3010 message_handle, &element);
3011
3012 1829 result = globus_xml_buffer_serialize_contents(
3013 NULL,
3014 &new_buffer,
3015 message_handle,
3016 GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
3017
3018 1829 result = globus_soap_message_serialize_element_end(
3019 message_handle,
3020 &element,
3021 options,
3022 NULL);
3023
3024 1829 globus_soap_message_element_ns_remove(
3025 message_handle,
3026 element.Namespace,
3027 &options);
3028
3029 1829 xsd_anyAttributes_namespace_remove(
3030 message_handle, any_attrs, &options);
3031
3032 1829 globus_soap_message_element_ns_remove(
3033 message_handle,
3034 WSADDRESSING_NS,
3035 &options);
3036
3037
3038 1829 destroy_handle_out:
3039 1829 globus_soap_message_handle_destroy(dom_handle);
3040 1829 doc = NULL;
3041 1829 destroy_doc_out:
3042 1829 if (doc)
3043 {
3044 0 xmlFreeDoc(doc);
3045 }
3046 1829 out:
3047 1829 return result;
3048 }
3049 /* globus_l_ws_addressing_serialize_refparam() */
3050
3051 static
3052 globus_result_t
3053 globus_l_ws_addressing_deserialize_refparams(
3054 xsd_QName * element,
3055 xsd_any_array * array,
3056 globus_soap_message_handle_t handle,
3057 globus_xsd_element_options_t options)
3058 9710 {
3059 globus_result_t result;
3060 int i;
3061
3062 9710 result = xsd_any_array_deserialize(NULL, array, handle, 0);
3063 9710 if (result != GLOBUS_SUCCESS)
3064 {
3065 0 goto out;
3066 }
3067
3068 19420 for (i = 0; i < array->length; i++)
3069 {
3070 9710 result = globus_wsrf_core_remove_attribute(
3071 &array->elements[0],
3072 &wsa_IsReferenceParameter_qname);
3073 9710 if (result != GLOBUS_SUCCESS)
3074 {
3075 0 xsd_any_array_destroy_contents(array);
3076 }
3077 }
3078
3079 9710 out:
3080 9710 return result;
3081 }