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 /*
19  * This file is automatically generated by the Globus WSDLtoC converter
20  */
21
22 #include "globus_soap_message.h"
23 #include "CounterService.h"
24 #include "CounterService_skeleton.h"
25 #include "CounterService_internal_skeleton.h"
26 #include "version.h"
27 #include "globus_soap_message_fault.h"
28 #include "globus_ws_addressing.h"
29 #include "globus_wsrf_resource.h"
30
31 static
32 int
33 CounterService_activate(void);
34
35 static
36 int
37 CounterService_deactivate(void);
38
39 GlobusExtensionDefineModule(CounterService) = 
40 {
41     "CounterService",
42     CounterService_activate,
43     CounterService_deactivate,
44     NULL,
45     NULL,
46     &local_version
47 };
48
49 0 GlobusDebugDefine(COUNTERSERVICE);
50
51 xsd_QName CounterService_service_qname =
52 {
53     "http://counter.com/service",
54     "CounterService"
55 };
56
57 globus_service_descriptor_t             CounterService_descriptor =
58 {
59     &CounterService_service_qname,
60     GLOBUS_SERVICE_ENGINE_MODULE_PATH_PREFIX "/" COUNTERSERVICE_BASE_PATH,
61     NULL,
62     NULL,
63     NULL,
64     NULL,
65     globus_resource_id_get_as_string,
66     NULL
67 };
68
69
70 xsd_QName CounterPortType_GetCurrentMessage_op_qname = 
71 {
72     "http://localhost:8080/wsrf/services/CounterService"
73     "GetCurrentMessage"
74 };
75
76 xsd_QName CounterPortType_GetCurrentMessage_input_qname =
77 {
78      "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd",
79      "GetCurrentMessage"
80 };
81
82 typedef globus_result_t (* GetCurrentMessage_invoke_func_t) (
83     globus_service_engine_t             engine,
84     globus_soap_message_handle_t        message,
85     globus_service_descriptor_t *       descriptor,
86     wsnt_GetCurrentMessageType * GetCurrentMessage,
87     wsnt_GetCurrentMessageResponseType * GetCurrentMessageResponse,
88     const char ** fault_type_name,
89     void ** fault);
90     
91 typedef struct GetCurrentMessage_callback_handle_s
92 {
93     globus_service_engine_t                 engine;
94     globus_soap_message_handle_t            message;
95     globus_operation_invoke_callback_func_t callback;
96     void *                                  args;
97 } GetCurrentMessage_callback_handle_t;
98
99
100 const char * CounterPortType_GetCurrentMessage_fault_strings[COUNTERPORTTYPE_GETCURRENTMESSAGE_TOPICNOTSUPPORTEDFAULT] =
101 {
102     "Unknown",
103     "ResourceUnknownFault",
104     "NoCurrentMessageOnTopicFault",
105     "InvalidTopicExpressionFault",
106     "TopicNotSupportedFault"
107  };
108
109 static
110 CounterPortType_GetCurrentMessage_fault_t
111 GetCurrentMessage_lookup_fault_type(
112     const char *                        fault_name)
113 {
114 0     CounterPortType_GetCurrentMessage_fault_t fault_type;
115 0     GlobusFuncName(GetCurrentMessage_lookup_fault_type);
116 0     CounterServiceDebugEnter();
117
118 0     globus_assert(fault_name);
119
120 0     if(!strcmp(fault_name, "ResourceUnknownFault"))
121     {
122 0         fault_type = COUNTERPORTTYPE_GETCURRENTMESSAGE_RESOURCEUNKNOWNFAULT;
123     }
124 0     else if(!strcmp(fault_name, "NoCurrentMessageOnTopicFault"))
125     {
126 0         fault_type = COUNTERPORTTYPE_GETCURRENTMESSAGE_NOCURRENTMESSAGEONTOPICFAULT;
127     }
128 0     else if(!strcmp(fault_name, "InvalidTopicExpressionFault"))
129     {
130 0         fault_type = COUNTERPORTTYPE_GETCURRENTMESSAGE_INVALIDTOPICEXPRESSIONFAULT;
131     }
132 0     else if(!strcmp(fault_name, "TopicNotSupportedFault"))
133     {
134 0         fault_type = COUNTERPORTTYPE_GETCURRENTMESSAGE_TOPICNOTSUPPORTEDFAULT;
135     }
136     else
137     {
138 0         fault_type = COUNTERPORTTYPE_GETCURRENTMESSAGE_UNKNOWN_FAULT;
139     }
140
141 0     CounterServiceDebugExit();
142 0     return fault_type;
143 }
144
145
146     
147 static
148 void
149 GetCurrentMessage_deserialize_callback(
150     void *                              handle)
151 0 {
152 0     GetCurrentMessage_callback_handle_t * callback_handle;
153 0     globus_result_t                     result = GLOBUS_SUCCESS;
154 0     struct globus_soap_message_fault_s  soap_fault;
155 0     GetCurrentMessage_invoke_func_t  invoke_function;
156 0     wsnt_GetCurrentMessageType * GetCurrentMessage = NULL;
157 0     GlobusFuncName(GetCurrentMessage_deserialize_callback);
158 0     CounterServiceDebugEnter();
159
160 0     callback_handle = (GetCurrentMessage_callback_handle_t *) handle;
161
162 0     result = globus_operation_table_get_operation(
163         CounterService_descriptor.operations,
164         "GetCurrentMessage",
165         (void **)&invoke_function);
166 0     if(result != GLOBUS_SUCCESS)
167     {
168 0         goto exit;
169     }
170
171 0     if(CounterService_descriptor.registry)
172     {
173 0         globus_soap_message_handle_set_registry(
174             callback_handle->message,
175             CounterService_descriptor.registry);
176     }
177
178 0     result = wsnt_GetCurrentMessageType_init(
179         &GetCurrentMessage);
180 0     if(result != GLOBUS_SUCCESS)
181     {
182 0         goto exit;
183     }
184
185 0     result = wsnt_GetCurrentMessageType_deserialize(
186         &CounterPortType_GetCurrentMessage_input_qname,
187         GetCurrentMessage,
188         callback_handle->message,
189         0);
190 0     if(result != GLOBUS_SUCCESS)
191     {
192 0         goto exit;
193     }
194
195 0     result = globus_soap_message_handle_set_attr(
196         callback_handle->message,
197         "GetCurrentMessageOperationInputParameter",
198         wsnt_GetCurrentMessageType_copy_wrapper,
199         wsnt_GetCurrentMessageType_destroy_wrapper,
200         (void *)GetCurrentMessage);
201 0     if(result != GLOBUS_SUCCESS)
202     {
203 0         goto exit;
204     }
205
206  exit:
207
208 0     if (GetCurrentMessage != NULL)
209     {
210 0         wsnt_GetCurrentMessageType_destroy(GetCurrentMessage);
211     }
212 0     callback_handle->callback(
213         result,
214         callback_handle->args);
215
216 0     free(callback_handle);
217 0     CounterServiceDebugExit();
218 }
219
220 static
221 globus_result_t
222 GetCurrentMessage_deserialize(
223     globus_service_engine_t                 engine,
224     globus_soap_message_handle_t            message,
225     globus_operation_invoke_callback_func_t invoke_callback,
226     void *                                  args)
227 0 {
228 0     GetCurrentMessage_callback_handle_t * callback_handle;
229 0     globus_result_t                    result = GLOBUS_SUCCESS;
230 0     GlobusFuncName(GetCurrentMessage_deserialize);
231 0     CounterServiceDebugEnter();
232
233 0     callback_handle = malloc(sizeof(GetCurrentMessage_callback_handle_t));
234 0     globus_assert_string(callback_handle, 
235                          "Memory allocation failed "
236                          "for GetCurrentMessage callback handle");
237
238 0     callback_handle->engine = engine;
239 0     callback_handle->message = message;
240 0     callback_handle->callback = invoke_callback;
241 0     callback_handle->args = args;
242
243 0     result = globus_callback_register_oneshot(
244         NULL,
245         &globus_i_reltime_zero,
246         GetCurrentMessage_deserialize_callback,
247         callback_handle);
248
249 0     CounterServiceDebugExit();
250 0     return result;
251 }
252
253 static
254 void
255 GetCurrentMessage_invoke_callback(
256     void *                              handle)
257 0 {
258 0     GetCurrentMessage_callback_handle_t * callback_handle;
259 0     globus_result_t                     result = GLOBUS_SUCCESS;
260 0     struct globus_soap_message_fault_s  soap_fault;
261 0     GetCurrentMessage_invoke_func_t  invoke_function;
262 0     wsnt_GetCurrentMessageType * GetCurrentMessage;
263 0     wsnt_GetCurrentMessageResponseType GetCurrentMessageResponse;
264 0      xsd_QName element_qname;
265 0      const char * fault_type_name = NULL;
266 0      CounterPortType_GetCurrentMessage_fault_t fault_type = COUNTERPORTTYPE_GETCURRENTMESSAGE_NOFAULT;
267 0      void *                              fault = NULL;
268     
269 0     GlobusFuncName(GetCurrentMessage_invoke_callback);
270 0     CounterServiceDebugEnter();
271
272 0     callback_handle = (GetCurrentMessage_callback_handle_t *) handle;
273
274 0     GetCurrentMessage = globus_soap_message_handle_get_attr(
275         callback_handle->message,
276         "GetCurrentMessageOperationInputParameter");
277 0     globus_assert(GetCurrentMessage);
278
279 0     result = globus_operation_table_get_operation(
280         CounterService_descriptor.operations,
281         "GetCurrentMessage",
282         (void **)&invoke_function);
283 0     if(result != GLOBUS_SUCCESS)
284     {
285 0         goto fault_exit;
286     }
287
288
289 0     result = wsnt_GetCurrentMessageResponseType_init_contents(
290         &GetCurrentMessageResponse);
291 0     if(result != GLOBUS_SUCCESS)
292     {
293 0         goto fault_exit;
294     }
295
296 0     result = invoke_function(
297         callback_handle->engine,
298         callback_handle->message,
299         &CounterService_descriptor,
300         GetCurrentMessage,
301         &GetCurrentMessageResponse,
302         &fault_type_name,
303         &fault);
304
305 fault_exit:
306
307 0     if(fault && fault_type_name)
308     {
309 0         fault_type = GetCurrentMessage_lookup_fault_type(fault_type_name);
310
311 0         result = globus_service_session_begin_response(
312             callback_handle->message);
313 0         if(result != GLOBUS_SUCCESS)
314         {
315 0             goto exit;
316         }
317         
318 0         soap_fault.faultcode = "Server";
319 0         soap_fault.faultstring = 
320         "An error occurred while processing the message";
321 0         soap_fault.faultactor = NULL;
322
323 0         switch(fault_type)
324         {
325         
326         case COUNTERPORTTYPE_GETCURRENTMESSAGE_RESOURCEUNKNOWNFAULT:
327
328 0             xsd_any_init(&soap_fault.detail);
329 0             soap_fault.detail->any_info = &wsnt_ResourceUnknownFaultType_info;
330 0             xsd_QName_init(&soap_fault.detail->element);
331 0             soap_fault.detail->element->local = "ResourceUnknownFault";
332 0             soap_fault.detail->element->Namespace = 
333                 "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd";
334 0             soap_fault.detail->value = fault;
335 0             break;
336
337         case COUNTERPORTTYPE_GETCURRENTMESSAGE_NOCURRENTMESSAGEONTOPICFAULT:
338
339 0             xsd_any_init(&soap_fault.detail);
340 0             soap_fault.detail->any_info = &wsnt_NoCurrentMessageOnTopicFaultType_info;
341 0             xsd_QName_init(&soap_fault.detail->element);
342 0             soap_fault.detail->element->local = "NoCurrentMessageOnTopicFault";
343 0             soap_fault.detail->element->Namespace = 
344                 "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd";
345 0             soap_fault.detail->value = fault;
346 0             break;
347
348         case COUNTERPORTTYPE_GETCURRENTMESSAGE_INVALIDTOPICEXPRESSIONFAULT:
349
350 0             xsd_any_init(&soap_fault.detail);
351 0             soap_fault.detail->any_info = &wsnt_InvalidTopicExpressionFaultType_info;
352 0             xsd_QName_init(&soap_fault.detail->element);
353 0             soap_fault.detail->element->local = "InvalidTopicExpressionFault";
354 0             soap_fault.detail->element->Namespace = 
355                 "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd";
356 0             soap_fault.detail->value = fault;
357 0             break;
358
359         case COUNTERPORTTYPE_GETCURRENTMESSAGE_TOPICNOTSUPPORTEDFAULT:
360
361 0             xsd_any_init(&soap_fault.detail);
362 0             soap_fault.detail->any_info = &wsnt_TopicNotSupportedFaultType_info;
363 0             xsd_QName_init(&soap_fault.detail->element);
364 0             soap_fault.detail->element->local = "TopicNotSupportedFault";
365 0             soap_fault.detail->element->Namespace = 
366                 "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd";
367 0             soap_fault.detail->value = fault;
368 0             break;
369
370         default:
371 0             result = CounterServiceErrorReturnedUnknownFault("GetCurrentMessage");
372 0             goto exit;
373         }         
374
375 0         result = globus_service_session_serialize_fault_response(
376             callback_handle->message, &soap_fault);
377 0         if(result != GLOBUS_SUCCESS)
378         {
379 0             goto exit;
380         }
381
382 0         soap_fault.detail->element->local = NULL;
383 0         soap_fault.detail->element->Namespace = NULL;
384 0 soap_fault.detail->any_info = NULL;
385 0         xsd_any_destroy(soap_fault.detail);
386
387 0         globus_soap_message_handle_set_attr(
388             callback_handle->message, 
389             WSADDR_ACTION_RESPONSE_KEY,
390             globus_soap_message_attr_copy_string,
391             globus_libc_free,
392             WSADDRESSING_FAULT_NS);
393     }
394 0     else if(result != GLOBUS_SUCCESS)
395     {
396 0         globus_result_t                 local_result;
397 0         local_result = globus_service_session_begin_response(
398             callback_handle->message);
399 0         if(local_result != GLOBUS_SUCCESS)
400         {
401 0             result = local_result;
402 0             goto exit;
403         }
404
405 0         soap_fault.faultcode = "Server";
406 0         soap_fault.faultstring = globus_error_print_friendly(
407             globus_error_get(result));
408 0         result = GLOBUS_SUCCESS;
409 0         soap_fault.faultactor = NULL;
410 0         soap_fault.detail = NULL;
411 0         result = globus_service_session_serialize_fault_response(
412             callback_handle->message, &soap_fault);
413 0         if(result != GLOBUS_SUCCESS)
414         {
415 0             goto exit;
416         }
417
418 0         globus_soap_message_handle_set_attr(
419             callback_handle->message, 
420             WSADDR_ACTION_RESPONSE_KEY,
421             globus_soap_message_attr_copy_string,
422             globus_libc_free, 
423             WSADDRESSING_FAULT_NS);
424     }
425     else
426     {
427 0         result = globus_service_session_begin_response(
428             callback_handle->message);
429 0         if(result != GLOBUS_SUCCESS)
430         {
431 0             goto exit;
432         }
433
434 0         element_qname.local = "GetCurrentMessageResponse";
435 0         element_qname.Namespace = "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd";
436
437 0         result = wsnt_GetCurrentMessageResponseType_serialize(
438             &element_qname,
439             &GetCurrentMessageResponse,
440             callback_handle->message,
441             GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS);
442 0         if(result != GLOBUS_SUCCESS)
443         {
444 0             goto exit;
445         }
446
447 0         result = globus_service_session_end_response(
448             callback_handle->message);
449 0         if(result != GLOBUS_SUCCESS)
450         {
451 0             goto exit;
452         }
453
454 0         wsnt_GetCurrentMessageResponseType_destroy_contents(
455             &GetCurrentMessageResponse);
456
457 0         globus_soap_message_handle_set_attr(
458             callback_handle->message, 
459             WSADDR_ACTION_RESPONSE_KEY,
460             globus_soap_message_attr_copy_string,
461             globus_libc_free, 
462             "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification/GetCurrentMessageResponse");
463     }
464
465  exit:
466
467 0     callback_handle->callback(
468         result,
469         callback_handle->args);
470
471 0     globus_libc_free(callback_handle);
472
473 0     CounterServiceDebugExit();
474 }
475
476 static
477 globus_result_t
478 GetCurrentMessage_invoke(
479     globus_service_engine_t                 engine,
480     globus_soap_message_handle_t            message,
481     globus_service_response_t *             response,
482     globus_operation_invoke_callback_func_t invoke_callback,
483     void *                                  args)
484 0 {
485 0     GetCurrentMessage_callback_handle_t * callback_handle;
486 0     globus_result_t                    result = GLOBUS_SUCCESS;
487 0     GlobusFuncName(CounterPortType_GetCurrentMessage);
488 0     CounterServiceDebugEnter();
489
490 0     callback_handle = malloc(sizeof(GetCurrentMessage_callback_handle_t));
491 0     if(!callback_handle)
492     {
493 0         result = GlobusSoapMessageErrorOutOfMemory;
494 0         goto exit;
495     }
496 0     callback_handle->engine = engine;
497 0     callback_handle->message = message;
498 0     callback_handle->callback = invoke_callback;
499 0     callback_handle->args = args;
500
501 0     result = globus_callback_register_oneshot(
502         NULL,
503         &globus_i_reltime_zero,
504         GetCurrentMessage_invoke_callback,
505         callback_handle);
506
507  exit:
508 0     CounterServiceDebugExit();
509 0     return result;
510 }
511
512
513 static
514 globus_result_t
515 GetCurrentMessage_fault_to_type(
516     const char *                            fault_type_name,
517     int *                                   fault_type,
518     globus_xsd_type_info_t *                fault_type_info)
519 0 {
520 0     globus_result_t                         result = GLOBUS_SUCCESS;
521
522 0     *fault_type_info = NULL;
523
524 0     *fault_type = GetCurrentMessage_lookup_fault_type(fault_type_name);
525
526 0     switch (*fault_type)
527     {
528         case COUNTERPORTTYPE_GETCURRENTMESSAGE_RESOURCEUNKNOWNFAULT:
529 0             *fault_type_info = &wsnt_ResourceUnknownFaultType_info;
530 0             break;
531
532         case COUNTERPORTTYPE_GETCURRENTMESSAGE_NOCURRENTMESSAGEONTOPICFAULT:
533 0             *fault_type_info = &wsnt_NoCurrentMessageOnTopicFaultType_info;
534 0             break;
535
536         case COUNTERPORTTYPE_GETCURRENTMESSAGE_INVALIDTOPICEXPRESSIONFAULT:
537 0             *fault_type_info = &wsnt_InvalidTopicExpressionFaultType_info;
538 0             break;
539
540         case COUNTERPORTTYPE_GETCURRENTMESSAGE_TOPICNOTSUPPORTEDFAULT:
541 0             *fault_type_info = &wsnt_TopicNotSupportedFaultType_info;
542 0             break;
543
544         default:
545 0             result = CounterServiceErrorReturnedUnknownFault("GetCurrentMessage");
546             goto exit;
547     }
548
549 exit:
550 0     return result;
551 }
552
553
554 static
555 globus_service_operation_descriptor_t 
556 GetCurrentMessage_operation_descriptor =
557 {
558     GetCurrentMessage_deserialize,
559     GetCurrentMessage_invoke,
560
561     GetCurrentMessage_fault_to_type
562
563 };
564
565 static
566 globus_operation_provider_descriptor_t GetCurrentMessage_descriptor =
567 {
568     &CounterPortType_GetCurrentMessage_op_qname,
569     "GetCurrentMessage",
570     (void *)CounterPortType_GetCurrentMessage_impl,
571     NULL
572 };
573
574
575 xsd_QName CounterPortType_Subscribe_op_qname = 
576 {
577     "http://localhost:8080/wsrf/services/CounterService"
578     "Subscribe"
579 };
580
581 xsd_QName CounterPortType_Subscribe_input_qname =
582 {
583      "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd",
584      "Subscribe"
585 };
586
587 typedef globus_result_t (* Subscribe_invoke_func_t) (
588     globus_service_engine_t             engine,
589     globus_soap_message_handle_t        message,
590     globus_service_descriptor_t *       descriptor,
591     wsnt_SubscribeType * Subscribe,
592     wsnt_SubscribeResponseType * SubscribeResponse,
593     const char ** fault_type_name,
594     void ** fault);
595     
596 typedef struct Subscribe_callback_handle_s
597 {
598     globus_service_engine_t                 engine;
599     globus_soap_message_handle_t            message;
600     globus_operation_invoke_callback_func_t callback;
601     void *                                  args;
602 } Subscribe_callback_handle_t;
603
604
605 const char * CounterPortType_Subscribe_fault_strings[COUNTERPORTTYPE_SUBSCRIBE_TOPICNOTSUPPORTEDFAULT] =
606 {
607     "Unknown",
608     "TopicPathDialectUnknownFault",
609     "ResourceUnknownFault",
610     "SubscribeCreationFailedFault",
611     "InvalidTopicExpressionFault",
612     "TopicNotSupportedFault"
613  };
614
615 static
616 CounterPortType_Subscribe_fault_t
617 Subscribe_lookup_fault_type(
618     const char *                        fault_name)
619 0 {
620 0     CounterPortType_Subscribe_fault_t fault_type;
621 0     GlobusFuncName(Subscribe_lookup_fault_type);
622 0     CounterServiceDebugEnter();
623
624 0     globus_assert(fault_name);
625
626 0     if(!strcmp(fault_name, "TopicPathDialectUnknownFault"))
627     {
628 0         fault_type = COUNTERPORTTYPE_SUBSCRIBE_TOPICPATHDIALECTUNKNOWNFAULT;
629     }
630 0     else if(!strcmp(fault_name, "ResourceUnknownFault"))
631     {
632 0         fault_type = COUNTERPORTTYPE_SUBSCRIBE_RESOURCEUNKNOWNFAULT;
633     }
634 0     else if(!strcmp(fault_name, "SubscribeCreationFailedFault"))
635     {
636 0         fault_type = COUNTERPORTTYPE_SUBSCRIBE_SUBSCRIBECREATIONFAILEDFAULT;
637     }
638 0     else if(!strcmp(fault_name, "InvalidTopicExpressionFault"))
639     {
640 0         fault_type = COUNTERPORTTYPE_SUBSCRIBE_INVALIDTOPICEXPRESSIONFAULT;
641     }
642 0     else if(!strcmp(fault_name, "TopicNotSupportedFault"))
643     {
644 0         fault_type = COUNTERPORTTYPE_SUBSCRIBE_TOPICNOTSUPPORTEDFAULT;
645     }
646     else
647     {
648 0         fault_type = COUNTERPORTTYPE_SUBSCRIBE_UNKNOWN_FAULT;
649     }
650
651 0     CounterServiceDebugExit();
652 0     return fault_type;
653 }
654
655
656     
657 static
658 void
659 Subscribe_deserialize_callback(
660     void *                              handle)
661 1 {
662 1     Subscribe_callback_handle_t * callback_handle;
663 1     globus_result_t                     result = GLOBUS_SUCCESS;
664 1     struct globus_soap_message_fault_s  soap_fault;
665 1     Subscribe_invoke_func_t  invoke_function;
666 1     wsnt_SubscribeType * Subscribe = NULL;
667 1     GlobusFuncName(Subscribe_deserialize_callback);
668 1     CounterServiceDebugEnter();
669
670 1     callback_handle = (Subscribe_callback_handle_t *) handle;
671
672 1     result = globus_operation_table_get_operation(
673         CounterService_descriptor.operations,
674         "Subscribe",
675         (void **)&invoke_function);
676 1     if(result != GLOBUS_SUCCESS)
677     {
678 0         goto exit;
679     }
680
681 1     if(CounterService_descriptor.registry)
682     {
683 1         globus_soap_message_handle_set_registry(
684             callback_handle->message,
685             CounterService_descriptor.registry);
686     }
687
688 1     result = wsnt_SubscribeType_init(
689         &Subscribe);
690 1     if(result != GLOBUS_SUCCESS)
691     {
692 0         goto exit;
693     }
694
695 1     result = wsnt_SubscribeType_deserialize(
696         &CounterPortType_Subscribe_input_qname,
697         Subscribe,
698         callback_handle->message,
699         0);
700 1     if(result != GLOBUS_SUCCESS)
701     {
702 0         goto exit;
703     }
704
705 1     result = globus_soap_message_handle_set_attr(
706         callback_handle->message,
707         "SubscribeOperationInputParameter",
708         wsnt_SubscribeType_copy_wrapper,
709         wsnt_SubscribeType_destroy_wrapper,
710         (void *)Subscribe);
711 1     if(result != GLOBUS_SUCCESS)
712     {
713 1         goto exit;
714     }
715
716  exit:
717
718 1     if (Subscribe != NULL)
719     {
720 1         wsnt_SubscribeType_destroy(Subscribe);
721     }
722 1     callback_handle->callback(
723         result,
724         callback_handle->args);
725
726 1     free(callback_handle);
727 1     CounterServiceDebugExit();
728 }
729
730 static
731 globus_result_t
732 Subscribe_deserialize(
733     globus_service_engine_t                 engine,
734     globus_soap_message_handle_t            message,
735     globus_operation_invoke_callback_func_t invoke_callback,
736     void *                                  args)
737 1 {
738 1     Subscribe_callback_handle_t * callback_handle;
739 1     globus_result_t                    result = GLOBUS_SUCCESS;
740 1     GlobusFuncName(Subscribe_deserialize);
741 1     CounterServiceDebugEnter();
742
743 1     callback_handle = malloc(sizeof(Subscribe_callback_handle_t));
744 1     globus_assert_string(callback_handle, 
745                          "Memory allocation failed "
746                          "for Subscribe callback handle");
747
748 1     callback_handle->engine = engine;
749 1     callback_handle->message = message;
750 1     callback_handle->callback = invoke_callback;
751 1     callback_handle->args = args;
752
753 1     result = globus_callback_register_oneshot(
754         NULL,
755         &globus_i_reltime_zero,
756         Subscribe_deserialize_callback,
757         callback_handle);
758
759 1     CounterServiceDebugExit();
760 1     return result;
761 }
762
763 static
764 void
765 Subscribe_invoke_callback(
766     void *                              handle)
767 1 {
768 1     Subscribe_callback_handle_t * callback_handle;
769 1     globus_result_t                     result = GLOBUS_SUCCESS;
770 1     struct globus_soap_message_fault_s  soap_fault;
771 1     Subscribe_invoke_func_t  invoke_function;
772 1     wsnt_SubscribeType * Subscribe;
773 1     wsnt_SubscribeResponseType SubscribeResponse;
774 1      xsd_QName element_qname;
775 1      const char * fault_type_name = NULL;
776 1      CounterPortType_Subscribe_fault_t fault_type = COUNTERPORTTYPE_SUBSCRIBE_NOFAULT;
777 1      void *                              fault = NULL;
778     
779 1     GlobusFuncName(Subscribe_invoke_callback);
780 1     CounterServiceDebugEnter();
781
782 1     callback_handle = (Subscribe_callback_handle_t *) handle;
783
784 1     Subscribe = globus_soap_message_handle_get_attr(
785         callback_handle->message,
786         "SubscribeOperationInputParameter");
787 1     globus_assert(Subscribe);
788
789 1     result = globus_operation_table_get_operation(
790         CounterService_descriptor.operations,
791         "Subscribe",
792         (void **)&invoke_function);
793 1     if(result != GLOBUS_SUCCESS)
794     {
795 0         goto fault_exit;
796     }
797
798
799 1     result = wsnt_SubscribeResponseType_init_contents(
800         &SubscribeResponse);
801 1     if(result != GLOBUS_SUCCESS)
802     {
803 0         goto fault_exit;
804     }
805
806 1     result = invoke_function(
807         callback_handle->engine,
808         callback_handle->message,
809         &CounterService_descriptor,
810         Subscribe,
811         &SubscribeResponse,
812         &fault_type_name,
813         &fault);
814
815 fault_exit:
816
817 1     if(fault && fault_type_name)
818     {
819 0         fault_type = Subscribe_lookup_fault_type(fault_type_name);
820
821 0         result = globus_service_session_begin_response(
822             callback_handle->message);
823 0         if(result != GLOBUS_SUCCESS)
824         {
825 0             goto exit;
826         }
827         
828 0         soap_fault.faultcode = "Server";
829 0         soap_fault.faultstring = 
830         "An error occurred while processing the message";
831 0         soap_fault.faultactor = NULL;
832
833 0         switch(fault_type)
834         {
835         
836         case COUNTERPORTTYPE_SUBSCRIBE_TOPICPATHDIALECTUNKNOWNFAULT:
837
838 0             xsd_any_init(&soap_fault.detail);
839 0             soap_fault.detail->any_info = &wsnt_TopicPathDialectUnknownFaultType_info;
840 0             xsd_QName_init(&soap_fault.detail->element);
841 0             soap_fault.detail->element->local = "TopicPathDialectUnknownFault";
842 0             soap_fault.detail->element->Namespace = 
843                 "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd";
844 0             soap_fault.detail->value = fault;
845 0             break;
846
847         case COUNTERPORTTYPE_SUBSCRIBE_RESOURCEUNKNOWNFAULT:
848
849 0             xsd_any_init(&soap_fault.detail);
850 0             soap_fault.detail->any_info = &wsnt_ResourceUnknownFaultType_info;
851 0             xsd_QName_init(&soap_fault.detail->element);
852 0             soap_fault.detail->element->local = "ResourceUnknownFault";
853 0             soap_fault.detail->element->Namespace = 
854                 "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd";
855 0             soap_fault.detail->value = fault;
856 0             break;
857
858         case COUNTERPORTTYPE_SUBSCRIBE_SUBSCRIBECREATIONFAILEDFAULT:
859
860 0             xsd_any_init(&soap_fault.detail);
861 0             soap_fault.detail->any_info = &wsnt_SubscribeCreationFailedFaultType_info;
862 0             xsd_QName_init(&soap_fault.detail->element);
863 0             soap_fault.detail->element->local = "SubscribeCreationFailedFault";
864 0             soap_fault.detail->element->Namespace = 
865                 "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd";
866 0             soap_fault.detail->value = fault;
867 0             break;
868
869         case COUNTERPORTTYPE_SUBSCRIBE_INVALIDTOPICEXPRESSIONFAULT:
870
871 0             xsd_any_init(&soap_fault.detail);
872 0             soap_fault.detail->any_info = &wsnt_InvalidTopicExpressionFaultType_info;
873 0             xsd_QName_init(&soap_fault.detail->element);
874 0             soap_fault.detail->element->local = "InvalidTopicExpressionFault";
875 0             soap_fault.detail->element->Namespace = 
876                 "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd";
877 0             soap_fault.detail->value = fault;
878 0             break;
879
880         case COUNTERPORTTYPE_SUBSCRIBE_TOPICNOTSUPPORTEDFAULT:
881
882 0             xsd_any_init(&soap_fault.detail);
883 0             soap_fault.detail->any_info = &wsnt_TopicNotSupportedFaultType_info;
884 0             xsd_QName_init(&soap_fault.detail->element);
885 0             soap_fault.detail->element->local = "TopicNotSupportedFault";
886 0             soap_fault.detail->element->Namespace = 
887                 "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd";
888 0             soap_fault.detail->value = fault;
889 0             break;
890
891         default:
892 0             result = CounterServiceErrorReturnedUnknownFault("Subscribe");
893 0             goto exit;
894         }         
895
896 0         result = globus_service_session_serialize_fault_response(
897             callback_handle->message, &soap_fault);
898 0         if(result != GLOBUS_SUCCESS)
899         {
900 0             goto exit;
901         }
902
903 0         soap_fault.detail->element->local = NULL;
904 0         soap_fault.detail->element->Namespace = NULL;
905 0 soap_fault.detail->any_info = NULL;
906 0         xsd_any_destroy(soap_fault.detail);
907
908 0         globus_soap_message_handle_set_attr(
909             callback_handle->message, 
910             WSADDR_ACTION_RESPONSE_KEY,
911             globus_soap_message_attr_copy_string,
912             globus_libc_free,
913             WSADDRESSING_FAULT_NS);
914     }
915 1     else if(result != GLOBUS_SUCCESS)
916     {
917 0         globus_result_t                 local_result;
918 0         local_result = globus_service_session_begin_response(
919             callback_handle->message);
920 0         if(local_result != GLOBUS_SUCCESS)
921         {
922 0             result = local_result;
923 0             goto exit;
924         }
925
926 0         soap_fault.faultcode = "Server";
927 0         soap_fault.faultstring = globus_error_print_friendly(
928             globus_error_get(result));
929 0         result = GLOBUS_SUCCESS;
930 0         soap_fault.faultactor = NULL;
931 0         soap_fault.detail = NULL;
932 0         result = globus_service_session_serialize_fault_response(
933             callback_handle->message, &soap_fault);
934 0         if(result != GLOBUS_SUCCESS)
935         {
936 0             goto exit;
937         }
938
939 0         globus_soap_message_handle_set_attr(
940             callback_handle->message, 
941             WSADDR_ACTION_RESPONSE_KEY,
942             globus_soap_message_attr_copy_string,
943             globus_libc_free, 
944             WSADDRESSING_FAULT_NS);
945     }
946     else
947     {
948 1         result = globus_service_session_begin_response(
949             callback_handle->message);
950 1         if(result != GLOBUS_SUCCESS)
951         {
952 0             goto exit;
953         }
954
955 1         element_qname.local = "SubscribeResponse";
956 1         element_qname.Namespace = "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd";
957
958 1         result = wsnt_SubscribeResponseType_serialize(
959             &element_qname,
960             &SubscribeResponse,
961             callback_handle->message,
962             GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS);
963 1         if(result != GLOBUS_SUCCESS)
964         {
965 0             goto exit;
966         }
967
968 1         result = globus_service_session_end_response(
969             callback_handle->message);
970 1         if(result != GLOBUS_SUCCESS)
971         {
972 0             goto exit;
973         }
974
975 1         wsnt_SubscribeResponseType_destroy_contents(
976             &SubscribeResponse);
977
978 1         globus_soap_message_handle_set_attr(
979             callback_handle->message, 
980             WSADDR_ACTION_RESPONSE_KEY,
981             globus_soap_message_attr_copy_string,
982             globus_libc_free, 
983             "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification/SubscribeResponse");
984     }
985
986  exit:
987
988 1     callback_handle->callback(
989         result,
990         callback_handle->args);
991
992 1     globus_libc_free(callback_handle);
993
994 1     CounterServiceDebugExit();
995 }
996
997 static
998 globus_result_t
999 Subscribe_invoke(
1000     globus_service_engine_t                 engine,
1001     globus_soap_message_handle_t            message,
1002     globus_service_response_t *             response,
1003     globus_operation_invoke_callback_func_t invoke_callback,
1004     void *                                  args)
1005 1 {
1006 1     Subscribe_callback_handle_t * callback_handle;
1007 1     globus_result_t                    result = GLOBUS_SUCCESS;
1008 1     GlobusFuncName(CounterPortType_Subscribe);
1009 1     CounterServiceDebugEnter();
1010
1011 1     callback_handle = malloc(sizeof(Subscribe_callback_handle_t));
1012 1     if(!callback_handle)
1013     {
1014 0         result = GlobusSoapMessageErrorOutOfMemory;
1015 0         goto exit;
1016     }
1017 1     callback_handle->engine = engine;
1018 1     callback_handle->message = message;
1019 1     callback_handle->callback = invoke_callback;
1020 1     callback_handle->args = args;
1021
1022 1     result = globus_callback_register_oneshot(
1023         NULL,
1024         &globus_i_reltime_zero,
1025         Subscribe_invoke_callback,
1026         callback_handle);
1027
1028  exit:
1029 1     CounterServiceDebugExit();
1030 1     return result;
1031 }
1032
1033
1034 static
1035 globus_result_t
1036 Subscribe_fault_to_type(
1037     const char *                            fault_type_name,
1038     int *                                   fault_type,
1039     globus_xsd_type_info_t *                fault_type_info)
1040 0 {
1041 0     globus_result_t                         result = GLOBUS_SUCCESS;
1042
1043 0     *fault_type_info = NULL;
1044
1045 0     *fault_type = Subscribe_lookup_fault_type(fault_type_name);
1046
1047 0     switch (*fault_type)
1048     {
1049         case COUNTERPORTTYPE_SUBSCRIBE_TOPICPATHDIALECTUNKNOWNFAULT:
1050 0             *fault_type_info = &wsnt_TopicPathDialectUnknownFaultType_info;
1051 0             break;
1052
1053         case COUNTERPORTTYPE_SUBSCRIBE_RESOURCEUNKNOWNFAULT:
1054 0             *fault_type_info = &wsnt_ResourceUnknownFaultType_info;
1055 0             break;
1056
1057         case COUNTERPORTTYPE_SUBSCRIBE_SUBSCRIBECREATIONFAILEDFAULT:
1058 0             *fault_type_info = &wsnt_SubscribeCreationFailedFaultType_info;
1059 0             break;
1060
1061         case COUNTERPORTTYPE_SUBSCRIBE_INVALIDTOPICEXPRESSIONFAULT:
1062 0             *fault_type_info = &wsnt_InvalidTopicExpressionFaultType_info;
1063 0             break;
1064
1065         case COUNTERPORTTYPE_SUBSCRIBE_TOPICNOTSUPPORTEDFAULT:
1066 0             *fault_type_info = &wsnt_TopicNotSupportedFaultType_info;
1067 0             break;
1068
1069         default:
1070 0             result = CounterServiceErrorReturnedUnknownFault("Subscribe");
1071             goto exit;
1072     }
1073
1074 exit:
1075 0     return result;
1076 }
1077
1078
1079 static
1080 globus_service_operation_descriptor_t 
1081 Subscribe_operation_descriptor =
1082 {
1083     Subscribe_deserialize,
1084     Subscribe_invoke,
1085
1086     Subscribe_fault_to_type
1087
1088 };
1089
1090 static
1091 globus_operation_provider_descriptor_t Subscribe_descriptor =
1092 {
1093     &CounterPortType_Subscribe_op_qname,
1094     "Subscribe",
1095     (void *)CounterPortType_Subscribe_impl,
1096     NULL
1097 };
1098
1099
1100 xsd_QName CounterPortType_GetResourceProperty_op_qname = 
1101 {
1102     "http://localhost:8080/wsrf/services/CounterService"
1103     "GetResourceProperty"
1104 };
1105
1106 xsd_QName CounterPortType_GetResourceProperty_input_qname =
1107 {
1108      "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd",
1109      "GetResourceProperty"
1110 };
1111
1112 typedef globus_result_t (* GetResourceProperty_invoke_func_t) (
1113     globus_service_engine_t             engine,
1114     globus_soap_message_handle_t        message,
1115     globus_service_descriptor_t *       descriptor,
1116     xsd_QName * GetResourceProperty,
1117     wsrp_GetResourcePropertyResponseType * GetResourcePropertyResponse,
1118     const char ** fault_type_name,
1119     void ** fault);
1120     
1121 typedef struct GetResourceProperty_callback_handle_s
1122 {
1123     globus_service_engine_t                 engine;
1124     globus_soap_message_handle_t            message;
1125     globus_operation_invoke_callback_func_t callback;
1126     void *                                  args;
1127 } GetResourceProperty_callback_handle_t;
1128
1129
1130 const char * CounterPortType_GetResourceProperty_fault_strings[COUNTERPORTTYPE_GETRESOURCEPROPERTY_INVALIDRESOURCEPROPERTYQNAMEFAULT] =
1131 {
1132     "Unknown",
1133     "ResourceUnknownFault",
1134     "InvalidResourcePropertyQNameFault"
1135  };
1136
1137 static
1138 CounterPortType_GetResourceProperty_fault_t
1139 GetResourceProperty_lookup_fault_type(
1140     const char *                        fault_name)
1141 0 {
1142 0     CounterPortType_GetResourceProperty_fault_t fault_type;
1143 0     GlobusFuncName(GetResourceProperty_lookup_fault_type);
1144 0     CounterServiceDebugEnter();
1145
1146 0     globus_assert(fault_name);
1147
1148 0     if(!strcmp(fault_name, "ResourceUnknownFault"))
1149     {
1150 0         fault_type = COUNTERPORTTYPE_GETRESOURCEPROPERTY_RESOURCEUNKNOWNFAULT;
1151     }
1152 0     else if(!strcmp(fault_name, "InvalidResourcePropertyQNameFault"))
1153     {
1154 0         fault_type = COUNTERPORTTYPE_GETRESOURCEPROPERTY_INVALIDRESOURCEPROPERTYQNAMEFAULT;
1155     }
1156     else
1157     {
1158 0         fault_type = COUNTERPORTTYPE_GETRESOURCEPROPERTY_UNKNOWN_FAULT;
1159     }
1160
1161 0     CounterServiceDebugExit();
1162 0     return fault_type;
1163 }
1164
1165
1166     
1167 static
1168 void
1169 GetResourceProperty_deserialize_callback(
1170     void *                              handle)
1171 10 {
1172 10     GetResourceProperty_callback_handle_t * callback_handle;
1173 10     globus_result_t                     result = GLOBUS_SUCCESS;
1174 10     struct globus_soap_message_fault_s  soap_fault;
1175 10     GetResourceProperty_invoke_func_t  invoke_function;
1176 10     xsd_QName * GetResourceProperty = NULL;
1177 10     GlobusFuncName(GetResourceProperty_deserialize_callback);
1178 10     CounterServiceDebugEnter();
1179
1180 10     callback_handle = (GetResourceProperty_callback_handle_t *) handle;
1181
1182 10     result = globus_operation_table_get_operation(
1183         CounterService_descriptor.operations,
1184         "GetResourceProperty",
1185         (void **)&invoke_function);
1186 10     if(result != GLOBUS_SUCCESS)
1187     {
1188 0         goto exit;
1189     }
1190
1191 10     if(CounterService_descriptor.registry)
1192     {
1193 10         globus_soap_message_handle_set_registry(
1194             callback_handle->message,
1195             CounterService_descriptor.registry);
1196     }
1197
1198 10     result = xsd_QName_init(
1199         &GetResourceProperty);
1200 10     if(result != GLOBUS_SUCCESS)
1201     {
1202 0         goto exit;
1203     }
1204
1205 10     result = xsd_QName_deserialize(
1206         &CounterPortType_GetResourceProperty_input_qname,
1207         GetResourceProperty,
1208         callback_handle->message,
1209         0);
1210 10     if(result != GLOBUS_SUCCESS)
1211     {
1212 0         goto exit;
1213     }
1214
1215 10     result = globus_soap_message_handle_set_attr(
1216         callback_handle->message,
1217         "GetResourcePropertyOperationInputParameter",
1218         xsd_QName_copy_wrapper,
1219         xsd_QName_destroy_wrapper,
1220         (void *)GetResourceProperty);
1221 10     if(result != GLOBUS_SUCCESS)
1222     {
1223 10         goto exit;
1224     }
1225
1226  exit:
1227
1228 10     if (GetResourceProperty != NULL)
1229     {
1230 10         xsd_QName_destroy(GetResourceProperty);
1231     }
1232 10     callback_handle->callback(
1233         result,
1234         callback_handle->args);
1235
1236 10     free(callback_handle);
1237 10     CounterServiceDebugExit();
1238 }
1239
1240 static
1241 globus_result_t
1242 GetResourceProperty_deserialize(
1243     globus_service_engine_t                 engine,
1244     globus_soap_message_handle_t            message,
1245     globus_operation_invoke_callback_func_t invoke_callback,
1246     void *                                  args)
1247 10 {
1248 10     GetResourceProperty_callback_handle_t * callback_handle;
1249 10     globus_result_t                    result = GLOBUS_SUCCESS;
1250 10     GlobusFuncName(GetResourceProperty_deserialize);
1251 10     CounterServiceDebugEnter();
1252
1253 10     callback_handle = malloc(sizeof(GetResourceProperty_callback_handle_t));
1254 10     globus_assert_string(callback_handle, 
1255                          "Memory allocation failed "
1256                          "for GetResourceProperty callback handle");
1257
1258 10     callback_handle->engine = engine;
1259 10     callback_handle->message = message;
1260 10     callback_handle->callback = invoke_callback;
1261 10     callback_handle->args = args;
1262
1263 10     result = globus_callback_register_oneshot(
1264         NULL,
1265         &globus_i_reltime_zero,
1266         GetResourceProperty_deserialize_callback,
1267         callback_handle);
1268
1269 10     CounterServiceDebugExit();
1270 10     return result;
1271 }
1272
1273 static
1274 void
1275 GetResourceProperty_invoke_callback(
1276     void *                              handle)
1277 10 {
1278 10     GetResourceProperty_callback_handle_t * callback_handle;
1279 10     globus_result_t                     result = GLOBUS_SUCCESS;
1280 10     struct globus_soap_message_fault_s  soap_fault;
1281 10     GetResourceProperty_invoke_func_t  invoke_function;
1282 10     xsd_QName * GetResourceProperty;
1283 10     wsrp_GetResourcePropertyResponseType GetResourcePropertyResponse;
1284 10      xsd_QName element_qname;
1285 10      const char * fault_type_name = NULL;
1286 10      CounterPortType_GetResourceProperty_fault_t fault_type = COUNTERPORTTYPE_GETRESOURCEPROPERTY_NOFAULT;
1287 10      void *                              fault = NULL;
1288     
1289 10     GlobusFuncName(GetResourceProperty_invoke_callback);
1290 10     CounterServiceDebugEnter();
1291
1292 10     callback_handle = (GetResourceProperty_callback_handle_t *) handle;
1293
1294 10     GetResourceProperty = globus_soap_message_handle_get_attr(
1295         callback_handle->message,
1296         "GetResourcePropertyOperationInputParameter");
1297 10     globus_assert(GetResourceProperty);
1298
1299 10     result = globus_operation_table_get_operation(
1300         CounterService_descriptor.operations,
1301         "GetResourceProperty",
1302         (void **)&invoke_function);
1303 10     if(result != GLOBUS_SUCCESS)
1304     {
1305 0         goto fault_exit;
1306     }
1307
1308
1309 10     result = wsrp_GetResourcePropertyResponseType_init_contents(
1310         &GetResourcePropertyResponse);
1311 10     if(result != GLOBUS_SUCCESS)
1312     {
1313 0         goto fault_exit;
1314     }
1315
1316 10     result = invoke_function(
1317         callback_handle->engine,
1318         callback_handle->message,
1319         &CounterService_descriptor,
1320         GetResourceProperty,
1321         &GetResourcePropertyResponse,
1322         &fault_type_name,
1323         &fault);
1324
1325 fault_exit:
1326
1327 10     if(fault && fault_type_name)
1328     {
1329 0         fault_type = GetResourceProperty_lookup_fault_type(fault_type_name);
1330
1331 0         result = globus_service_session_begin_response(
1332             callback_handle->message);
1333 0         if(result != GLOBUS_SUCCESS)
1334         {
1335 0             goto exit;
1336         }
1337         
1338 0         soap_fault.faultcode = "Server";
1339 0         soap_fault.faultstring = 
1340         "An error occurred while processing the message";
1341 0         soap_fault.faultactor = NULL;
1342
1343 0         switch(fault_type)
1344         {
1345         
1346         case COUNTERPORTTYPE_GETRESOURCEPROPERTY_RESOURCEUNKNOWNFAULT:
1347
1348 0             xsd_any_init(&soap_fault.detail);
1349 0             soap_fault.detail->any_info = &wsrp_ResourceUnknownFaultType_info;
1350 0             xsd_QName_init(&soap_fault.detail->element);
1351 0             soap_fault.detail->element->local = "ResourceUnknownFault";
1352 0             soap_fault.detail->element->Namespace = 
1353                 "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd";
1354 0             soap_fault.detail->value = fault;
1355 0             break;
1356
1357         case COUNTERPORTTYPE_GETRESOURCEPROPERTY_INVALIDRESOURCEPROPERTYQNAMEFAULT:
1358
1359 0             xsd_any_init(&soap_fault.detail);
1360 0             soap_fault.detail->any_info = &wsrp_InvalidResourcePropertyQNameFaultType_info;
1361 0             xsd_QName_init(&soap_fault.detail->element);
1362 0             soap_fault.detail->element->local = "InvalidResourcePropertyQNameFault";
1363 0             soap_fault.detail->element->Namespace = 
1364                 "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd";
1365 0             soap_fault.detail->value = fault;
1366 0             break;
1367
1368         default:
1369 0             result = CounterServiceErrorReturnedUnknownFault("GetResourceProperty");
1370 0             goto exit;
1371         }         
1372
1373 0         result = globus_service_session_serialize_fault_response(
1374             callback_handle->message, &soap_fault);
1375 0         if(result != GLOBUS_SUCCESS)
1376         {
1377 0             goto exit;
1378         }
1379
1380 0         soap_fault.detail->element->local = NULL;
1381 0         soap_fault.detail->element->Namespace = NULL;
1382 0 soap_fault.detail->any_info = NULL;
1383 0         xsd_any_destroy(soap_fault.detail);
1384
1385 0         globus_soap_message_handle_set_attr(
1386             callback_handle->message, 
1387             WSADDR_ACTION_RESPONSE_KEY,
1388             globus_soap_message_attr_copy_string,
1389             globus_libc_free,
1390             WSADDRESSING_FAULT_NS);
1391     }
1392 10     else if(result != GLOBUS_SUCCESS)
1393     {
1394 0         globus_result_t                 local_result;
1395 0         local_result = globus_service_session_begin_response(
1396             callback_handle->message);
1397 0         if(local_result != GLOBUS_SUCCESS)
1398         {
1399 0             result = local_result;
1400 0             goto exit;
1401         }
1402
1403 0         soap_fault.faultcode = "Server";
1404 0         soap_fault.faultstring = globus_error_print_friendly(
1405             globus_error_get(result));
1406 0         result = GLOBUS_SUCCESS;
1407 0         soap_fault.faultactor = NULL;
1408 0         soap_fault.detail = NULL;
1409 0         result = globus_service_session_serialize_fault_response(
1410             callback_handle->message, &soap_fault);
1411 0         if(result != GLOBUS_SUCCESS)
1412         {
1413 0             goto exit;
1414         }
1415
1416 0         globus_soap_message_handle_set_attr(
1417             callback_handle->message, 
1418             WSADDR_ACTION_RESPONSE_KEY,
1419             globus_soap_message_attr_copy_string,
1420             globus_libc_free, 
1421             WSADDRESSING_FAULT_NS);
1422     }
1423     else
1424     {
1425 10         result = globus_service_session_begin_response(
1426             callback_handle->message);
1427 10         if(result != GLOBUS_SUCCESS)
1428         {
1429 0             goto exit;
1430         }
1431
1432 10         element_qname.local = "GetResourcePropertyResponse";
1433 10         element_qname.Namespace = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd";
1434
1435 10         result = wsrp_GetResourcePropertyResponseType_serialize(
1436             &element_qname,
1437             &GetResourcePropertyResponse,
1438             callback_handle->message,
1439             GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS);
1440 10         if(result != GLOBUS_SUCCESS)
1441         {
1442 0             goto exit;
1443         }
1444
1445 10         result = globus_service_session_end_response(
1446             callback_handle->message);
1447 10         if(result != GLOBUS_SUCCESS)
1448         {
1449 0             goto exit;
1450         }
1451
1452 10         wsrp_GetResourcePropertyResponseType_destroy_contents(
1453             &GetResourcePropertyResponse);
1454
1455 10         globus_soap_message_handle_set_attr(
1456             callback_handle->message, 
1457             WSADDR_ACTION_RESPONSE_KEY,
1458             globus_soap_message_attr_copy_string,
1459             globus_libc_free, 
1460             "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties/GetResourcePropertyResponse");
1461     }
1462
1463  exit:
1464
1465 10     callback_handle->callback(
1466         result,
1467         callback_handle->args);
1468
1469 10     globus_libc_free(callback_handle);
1470
1471 10     CounterServiceDebugExit();
1472 }
1473
1474 static
1475 globus_result_t
1476 GetResourceProperty_invoke(
1477     globus_service_engine_t                 engine,
1478     globus_soap_message_handle_t            message,
1479     globus_service_response_t *             response,
1480     globus_operation_invoke_callback_func_t invoke_callback,
1481     void *                                  args)
1482 10 {
1483 10     GetResourceProperty_callback_handle_t * callback_handle;
1484 10     globus_result_t                    result = GLOBUS_SUCCESS;
1485 10     GlobusFuncName(CounterPortType_GetResourceProperty);
1486 10     CounterServiceDebugEnter();
1487
1488 10     callback_handle = malloc(sizeof(GetResourceProperty_callback_handle_t));
1489 10     if(!callback_handle)
1490     {
1491 0         result = GlobusSoapMessageErrorOutOfMemory;
1492 0         goto exit;
1493     }
1494 10     callback_handle->engine = engine;
1495 10     callback_handle->message = message;
1496 10     callback_handle->callback = invoke_callback;
1497 10     callback_handle->args = args;
1498
1499 10     result = globus_callback_register_oneshot(
1500         NULL,
1501         &globus_i_reltime_zero,
1502         GetResourceProperty_invoke_callback,
1503         callback_handle);
1504
1505  exit:
1506 10     CounterServiceDebugExit();
1507 10     return result;
1508 }
1509
1510
1511 static
1512 globus_result_t
1513 GetResourceProperty_fault_to_type(
1514     const char *                            fault_type_name,
1515     int *                                   fault_type,
1516     globus_xsd_type_info_t *                fault_type_info)
1517 0 {
1518 0     globus_result_t                         result = GLOBUS_SUCCESS;
1519
1520 0     *fault_type_info = NULL;
1521
1522 0     *fault_type = GetResourceProperty_lookup_fault_type(fault_type_name);
1523
1524 0     switch (*fault_type)
1525     {
1526         case COUNTERPORTTYPE_GETRESOURCEPROPERTY_RESOURCEUNKNOWNFAULT:
1527 0             *fault_type_info = &wsrp_ResourceUnknownFaultType_info;
1528 0             break;
1529
1530         case COUNTERPORTTYPE_GETRESOURCEPROPERTY_INVALIDRESOURCEPROPERTYQNAMEFAULT:
1531 0             *fault_type_info = &wsrp_InvalidResourcePropertyQNameFaultType_info;
1532 0             break;
1533
1534         default:
1535 0             result = CounterServiceErrorReturnedUnknownFault("GetResourceProperty");
1536             goto exit;
1537     }
1538
1539 exit:
1540 0     return result;
1541 }
1542
1543
1544 static
1545 globus_service_operation_descriptor_t 
1546 GetResourceProperty_operation_descriptor =
1547 {
1548     GetResourceProperty_deserialize,
1549     GetResourceProperty_invoke,
1550
1551     GetResourceProperty_fault_to_type
1552
1553 };
1554
1555 static
1556 globus_operation_provider_descriptor_t GetResourceProperty_descriptor =
1557 {
1558     &CounterPortType_GetResourceProperty_op_qname,
1559     "GetResourceProperty",
1560     (void *)CounterPortType_GetResourceProperty_impl,
1561     NULL
1562 };
1563
1564
1565 xsd_QName CounterPortType_GetMultipleResourceProperties_op_qname = 
1566 {
1567     "http://localhost:8080/wsrf/services/CounterService"
1568     "GetMultipleResourceProperties"
1569 };
1570
1571 xsd_QName CounterPortType_GetMultipleResourceProperties_input_qname =
1572 {
1573      "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd",
1574      "GetMultipleResourceProperties"
1575 };
1576
1577 typedef globus_result_t (* GetMultipleResourceProperties_invoke_func_t) (
1578     globus_service_engine_t             engine,
1579     globus_soap_message_handle_t        message,
1580     globus_service_descriptor_t *       descriptor,
1581     wsrp_GetMultipleResourcePropertiesType * GetMultipleResourceProperties,
1582     wsrp_GetMultipleResourcePropertiesResponseType * GetMultipleResourcePropertiesResponse,
1583     const char ** fault_type_name,
1584     void ** fault);
1585     
1586 typedef struct GetMultipleResourceProperties_callback_handle_s
1587 {
1588     globus_service_engine_t                 engine;
1589     globus_soap_message_handle_t            message;
1590     globus_operation_invoke_callback_func_t callback;
1591     void *                                  args;
1592 } GetMultipleResourceProperties_callback_handle_t;
1593
1594
1595 const char * CounterPortType_GetMultipleResourceProperties_fault_strings[COUNTERPORTTYPE_GETMULTIPLERESOURCEPROPERTIES_INVALIDRESOURCEPROPERTYQNAMEFAULT] =
1596 {
1597     "Unknown",
1598     "ResourceUnknownFault",
1599     "InvalidResourcePropertyQNameFault"
1600  };
1601
1602 static
1603 CounterPortType_GetMultipleResourceProperties_fault_t
1604 GetMultipleResourceProperties_lookup_fault_type(
1605     const char *                        fault_name)
1606 0 {
1607 0     CounterPortType_GetMultipleResourceProperties_fault_t fault_type;
1608 0     GlobusFuncName(GetMultipleResourceProperties_lookup_fault_type);
1609 0     CounterServiceDebugEnter();
1610
1611 0     globus_assert(fault_name);
1612
1613 0     if(!strcmp(fault_name, "ResourceUnknownFault"))
1614     {
1615 0         fault_type = COUNTERPORTTYPE_GETMULTIPLERESOURCEPROPERTIES_RESOURCEUNKNOWNFAULT;
1616     }
1617 0     else if(!strcmp(fault_name, "InvalidResourcePropertyQNameFault"))
1618     {
1619 0         fault_type = COUNTERPORTTYPE_GETMULTIPLERESOURCEPROPERTIES_INVALIDRESOURCEPROPERTYQNAMEFAULT;
1620     }
1621     else
1622     {
1623 0         fault_type = COUNTERPORTTYPE_GETMULTIPLERESOURCEPROPERTIES_UNKNOWN_FAULT;
1624     }
1625
1626 0     CounterServiceDebugExit();
1627 0     return fault_type;
1628 }
1629
1630
1631     
1632 static
1633 void
1634 GetMultipleResourceProperties_deserialize_callback(
1635     void *                              handle)
1636 0 {
1637 0     GetMultipleResourceProperties_callback_handle_t * callback_handle;
1638 0     globus_result_t                     result = GLOBUS_SUCCESS;
1639 0     struct globus_soap_message_fault_s  soap_fault;
1640 0     GetMultipleResourceProperties_invoke_func_t  invoke_function;
1641 0     wsrp_GetMultipleResourcePropertiesType * GetMultipleResourceProperties = NULL;
1642 0     GlobusFuncName(GetMultipleResourceProperties_deserialize_callback);
1643 0     CounterServiceDebugEnter();
1644
1645 0     callback_handle = (GetMultipleResourceProperties_callback_handle_t *) handle;
1646
1647 0     result = globus_operation_table_get_operation(
1648         CounterService_descriptor.operations,
1649         "GetMultipleResourceProperties",
1650         (void **)&invoke_function);
1651 0     if(result != GLOBUS_SUCCESS)
1652     {
1653 0         goto exit;
1654     }
1655
1656 0     if(CounterService_descriptor.registry)
1657     {
1658 0         globus_soap_message_handle_set_registry(
1659             callback_handle->message,
1660             CounterService_descriptor.registry);
1661     }
1662
1663 0     result = wsrp_GetMultipleResourcePropertiesType_init(
1664         &GetMultipleResourceProperties);
1665 0     if(result != GLOBUS_SUCCESS)
1666     {
1667 0         goto exit;
1668     }
1669
1670 0     result = wsrp_GetMultipleResourcePropertiesType_deserialize(
1671         &CounterPortType_GetMultipleResourceProperties_input_qname,
1672         GetMultipleResourceProperties,
1673         callback_handle->message,
1674         0);
1675 0     if(result != GLOBUS_SUCCESS)
1676     {
1677 0         goto exit;
1678     }
1679
1680 0     result = globus_soap_message_handle_set_attr(
1681         callback_handle->message,
1682         "GetMultipleResourcePropertiesOperationInputParameter",
1683         wsrp_GetMultipleResourcePropertiesType_copy_wrapper,
1684         wsrp_GetMultipleResourcePropertiesType_destroy_wrapper,
1685         (void *)GetMultipleResourceProperties);
1686 0     if(result != GLOBUS_SUCCESS)
1687     {
1688 0         goto exit;
1689     }
1690
1691  exit:
1692
1693 0     if (GetMultipleResourceProperties != NULL)
1694     {
1695 0         wsrp_GetMultipleResourcePropertiesType_destroy(GetMultipleResourceProperties);
1696     }
1697 0     callback_handle->callback(
1698         result,
1699         callback_handle->args);
1700
1701 0     free(callback_handle);
1702 0     CounterServiceDebugExit();
1703 }
1704
1705 static
1706 globus_result_t
1707 GetMultipleResourceProperties_deserialize(
1708     globus_service_engine_t                 engine,
1709     globus_soap_message_handle_t            message,
1710     globus_operation_invoke_callback_func_t invoke_callback,
1711     void *                                  args)
1712 0 {
1713 0     GetMultipleResourceProperties_callback_handle_t * callback_handle;
1714 0     globus_result_t                    result = GLOBUS_SUCCESS;
1715 0     GlobusFuncName(GetMultipleResourceProperties_deserialize);
1716 0     CounterServiceDebugEnter();
1717
1718 0     callback_handle = malloc(sizeof(GetMultipleResourceProperties_callback_handle_t));
1719 0     globus_assert_string(callback_handle, 
1720                          "Memory allocation failed "
1721                          "for GetMultipleResourceProperties callback handle");
1722
1723 0     callback_handle->engine = engine;
1724 0     callback_handle->message = message;
1725 0     callback_handle->callback = invoke_callback;
1726 0     callback_handle->args = args;
1727
1728 0     result = globus_callback_register_oneshot(
1729         NULL,
1730         &globus_i_reltime_zero,
1731         GetMultipleResourceProperties_deserialize_callback,
1732         callback_handle);
1733
1734 0     CounterServiceDebugExit();
1735 0     return result;
1736 }
1737
1738 static
1739 void
1740 GetMultipleResourceProperties_invoke_callback(
1741     void *                              handle)
1742 0 {
1743 0     GetMultipleResourceProperties_callback_handle_t * callback_handle;
1744 0     globus_result_t                     result = GLOBUS_SUCCESS;
1745 0     struct globus_soap_message_fault_s  soap_fault;
1746 0     GetMultipleResourceProperties_invoke_func_t  invoke_function;
1747 0     wsrp_GetMultipleResourcePropertiesType * GetMultipleResourceProperties;
1748 0     wsrp_GetMultipleResourcePropertiesResponseType GetMultipleResourcePropertiesResponse;
1749 0      xsd_QName element_qname;
1750 0      const char * fault_type_name = NULL;
1751 0      CounterPortType_GetMultipleResourceProperties_fault_t fault_type = COUNTERPORTTYPE_GETMULTIPLERESOURCEPROPERTIES_NOFAULT;
1752 0      void *                              fault = NULL;
1753     
1754 0     GlobusFuncName(GetMultipleResourceProperties_invoke_callback);
1755 0     CounterServiceDebugEnter();
1756
1757 0     callback_handle = (GetMultipleResourceProperties_callback_handle_t *) handle;
1758
1759 0     GetMultipleResourceProperties = globus_soap_message_handle_get_attr(
1760         callback_handle->message,
1761         "GetMultipleResourcePropertiesOperationInputParameter");
1762 0     globus_assert(GetMultipleResourceProperties);
1763
1764 0     result = globus_operation_table_get_operation(
1765         CounterService_descriptor.operations,
1766         "GetMultipleResourceProperties",
1767         (void **)&invoke_function);
1768 0     if(result != GLOBUS_SUCCESS)
1769     {
1770 0         goto fault_exit;
1771     }
1772
1773
1774 0     result = wsrp_GetMultipleResourcePropertiesResponseType_init_contents(
1775         &GetMultipleResourcePropertiesResponse);
1776 0     if(result != GLOBUS_SUCCESS)
1777     {
1778 0         goto fault_exit;
1779     }
1780
1781 0     result = invoke_function(
1782         callback_handle->engine,
1783         callback_handle->message,
1784         &CounterService_descriptor,
1785         GetMultipleResourceProperties,
1786         &GetMultipleResourcePropertiesResponse,
1787         &fault_type_name,
1788         &fault);
1789
1790 fault_exit:
1791
1792 0     if(fault && fault_type_name)
1793     {
1794 0         fault_type = GetMultipleResourceProperties_lookup_fault_type(fault_type_name);
1795
1796 0         result = globus_service_session_begin_response(
1797             callback_handle->message);
1798 0         if(result != GLOBUS_SUCCESS)
1799         {
1800 0             goto exit;
1801         }
1802         
1803 0         soap_fault.faultcode = "Server";
1804 0         soap_fault.faultstring = 
1805         "An error occurred while processing the message";
1806 0         soap_fault.faultactor = NULL;
1807
1808 0         switch(fault_type)
1809         {
1810         
1811         case COUNTERPORTTYPE_GETMULTIPLERESOURCEPROPERTIES_RESOURCEUNKNOWNFAULT:
1812
1813 0             xsd_any_init(&soap_fault.detail);
1814 0             soap_fault.detail->any_info = &wsrp_ResourceUnknownFaultType_info;
1815 0             xsd_QName_init(&soap_fault.detail->element);
1816 0             soap_fault.detail->element->local = "ResourceUnknownFault";
1817 0             soap_fault.detail->element->Namespace = 
1818                 "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd";
1819 0             soap_fault.detail->value = fault;
1820 0             break;
1821
1822         case COUNTERPORTTYPE_GETMULTIPLERESOURCEPROPERTIES_INVALIDRESOURCEPROPERTYQNAMEFAULT:
1823
1824 0             xsd_any_init(&soap_fault.detail);
1825 0             soap_fault.detail->any_info = &wsrp_InvalidResourcePropertyQNameFaultType_info;
1826 0             xsd_QName_init(&soap_fault.detail->element);
1827 0             soap_fault.detail->element->local = "InvalidResourcePropertyQNameFault";
1828 0             soap_fault.detail->element->Namespace = 
1829                 "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd";
1830 0             soap_fault.detail->value = fault;
1831 0             break;
1832
1833         default:
1834 0             result = CounterServiceErrorReturnedUnknownFault("GetMultipleResourceProperties");
1835 0             goto exit;
1836         }         
1837
1838 0         result = globus_service_session_serialize_fault_response(
1839             callback_handle->message, &soap_fault);
1840 0         if(result != GLOBUS_SUCCESS)
1841         {
1842 0             goto exit;
1843         }
1844
1845 0         soap_fault.detail->element->local = NULL;
1846 0         soap_fault.detail->element->Namespace = NULL;
1847 0 soap_fault.detail->any_info = NULL;
1848 0         xsd_any_destroy(soap_fault.detail);
1849
1850 0         globus_soap_message_handle_set_attr(
1851             callback_handle->message, 
1852             WSADDR_ACTION_RESPONSE_KEY,
1853             globus_soap_message_attr_copy_string,
1854             globus_libc_free,
1855             WSADDRESSING_FAULT_NS);
1856     }
1857 0     else if(result != GLOBUS_SUCCESS)
1858     {
1859 0         globus_result_t                 local_result;
1860 0         local_result = globus_service_session_begin_response(
1861             callback_handle->message);
1862 0         if(local_result != GLOBUS_SUCCESS)
1863         {
1864 0             result = local_result;
1865 0             goto exit;
1866         }
1867
1868 0         soap_fault.faultcode = "Server";
1869 0         soap_fault.faultstring = globus_error_print_friendly(
1870             globus_error_get(result));
1871 0         result = GLOBUS_SUCCESS;
1872 0         soap_fault.faultactor = NULL;
1873 0         soap_fault.detail = NULL;
1874 0         result = globus_service_session_serialize_fault_response(
1875             callback_handle->message, &soap_fault);
1876 0         if(result != GLOBUS_SUCCESS)
1877         {
1878 0             goto exit;
1879         }
1880
1881 0         globus_soap_message_handle_set_attr(
1882             callback_handle->message, 
1883             WSADDR_ACTION_RESPONSE_KEY,
1884             globus_soap_message_attr_copy_string,
1885             globus_libc_free, 
1886             WSADDRESSING_FAULT_NS);
1887     }
1888     else
1889     {
1890 0         result = globus_service_session_begin_response(
1891             callback_handle->message);
1892 0         if(result != GLOBUS_SUCCESS)
1893         {
1894 0             goto exit;
1895         }
1896
1897 0         element_qname.local = "GetMultipleResourcePropertiesResponse";
1898 0         element_qname.Namespace = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd";
1899
1900 0         result = wsrp_GetMultipleResourcePropertiesResponseType_serialize(
1901             &element_qname,
1902             &GetMultipleResourcePropertiesResponse,
1903             callback_handle->message,
1904             GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS);
1905 0         if(result != GLOBUS_SUCCESS)
1906         {
1907 0             goto exit;
1908         }
1909
1910 0         result = globus_service_session_end_response(
1911             callback_handle->message);
1912 0         if(result != GLOBUS_SUCCESS)
1913         {
1914 0             goto exit;
1915         }
1916
1917 0         wsrp_GetMultipleResourcePropertiesResponseType_destroy_contents(
1918             &GetMultipleResourcePropertiesResponse);
1919
1920 0         globus_soap_message_handle_set_attr(
1921             callback_handle->message, 
1922             WSADDR_ACTION_RESPONSE_KEY,
1923             globus_soap_message_attr_copy_string,
1924             globus_libc_free, 
1925             "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties/GetMultipleResourcePropertiesResponse");
1926     }
1927
1928  exit:
1929
1930 0     callback_handle->callback(
1931         result,
1932         callback_handle->args);
1933
1934 0     globus_libc_free(callback_handle);
1935
1936 0     CounterServiceDebugExit();
1937 }
1938
1939 static
1940 globus_result_t
1941 GetMultipleResourceProperties_invoke(
1942     globus_service_engine_t                 engine,
1943     globus_soap_message_handle_t            message,
1944     globus_service_response_t *             response,
1945     globus_operation_invoke_callback_func_t invoke_callback,
1946     void *                                  args)
1947 0 {
1948 0     GetMultipleResourceProperties_callback_handle_t * callback_handle;
1949 0     globus_result_t                    result = GLOBUS_SUCCESS;
1950 0     GlobusFuncName(CounterPortType_GetMultipleResourceProperties);
1951 0     CounterServiceDebugEnter();
1952
1953 0     callback_handle = malloc(sizeof(GetMultipleResourceProperties_callback_handle_t));
1954 0     if(!callback_handle)
1955     {
1956 0         result = GlobusSoapMessageErrorOutOfMemory;
1957 0         goto exit;
1958     }
1959 0     callback_handle->engine = engine;
1960 0     callback_handle->message = message;
1961 0     callback_handle->callback = invoke_callback;
1962 0     callback_handle->args = args;
1963
1964 0     result = globus_callback_register_oneshot(
1965         NULL,
1966         &globus_i_reltime_zero,
1967         GetMultipleResourceProperties_invoke_callback,
1968         callback_handle);
1969
1970  exit:
1971 0     CounterServiceDebugExit();
1972 0     return result;
1973 }
1974
1975
1976 static
1977 globus_result_t
1978 GetMultipleResourceProperties_fault_to_type(
1979     const char *                            fault_type_name,
1980     int *                                   fault_type,
1981     globus_xsd_type_info_t *                fault_type_info)
1982 0 {
1983 0     globus_result_t                         result = GLOBUS_SUCCESS;
1984
1985 0     *fault_type_info = NULL;
1986
1987 0     *fault_type = GetMultipleResourceProperties_lookup_fault_type(fault_type_name);
1988
1989 0     switch (*fault_type)
1990     {
1991         case COUNTERPORTTYPE_GETMULTIPLERESOURCEPROPERTIES_RESOURCEUNKNOWNFAULT:
1992 0             *fault_type_info = &wsrp_ResourceUnknownFaultType_info;
1993 0             break;
1994
1995         case COUNTERPORTTYPE_GETMULTIPLERESOURCEPROPERTIES_INVALIDRESOURCEPROPERTYQNAMEFAULT:
1996 0             *fault_type_info = &wsrp_InvalidResourcePropertyQNameFaultType_info;
1997 0             break;
1998
1999         default:
2000 0             result = CounterServiceErrorReturnedUnknownFault("GetMultipleResourceProperties");
2001             goto exit;
2002     }
2003
2004 exit:
2005 0     return result;
2006 }
2007
2008
2009 static
2010 globus_service_operation_descriptor_t 
2011 GetMultipleResourceProperties_operation_descriptor =
2012 {
2013     GetMultipleResourceProperties_deserialize,
2014     GetMultipleResourceProperties_invoke,
2015
2016     GetMultipleResourceProperties_fault_to_type
2017
2018 };
2019
2020 static
2021 globus_operation_provider_descriptor_t GetMultipleResourceProperties_descriptor =
2022 {
2023     &CounterPortType_GetMultipleResourceProperties_op_qname,
2024     "GetMultipleResourceProperties",
2025     (void *)CounterPortType_GetMultipleResourceProperties_impl,
2026     NULL
2027 };
2028
2029
2030 xsd_QName CounterPortType_QueryResourceProperties_op_qname = 
2031 {
2032     "http://localhost:8080/wsrf/services/CounterService"
2033     "QueryResourceProperties"
2034 };
2035
2036 xsd_QName CounterPortType_QueryResourceProperties_input_qname =
2037 {
2038      "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd",
2039      "QueryResourceProperties"
2040 };
2041
2042 typedef globus_result_t (* QueryResourceProperties_invoke_func_t) (
2043     globus_service_engine_t             engine,
2044     globus_soap_message_handle_t        message,
2045     globus_service_descriptor_t *       descriptor,
2046     wsrp_QueryResourcePropertiesType * QueryResourceProperties,
2047     wsrp_QueryResourcePropertiesResponseType * QueryResourcePropertiesResponse,
2048     const char ** fault_type_name,
2049     void ** fault);
2050     
2051 typedef struct QueryResourceProperties_callback_handle_s
2052 {
2053     globus_service_engine_t                 engine;
2054     globus_soap_message_handle_t            message;
2055     globus_operation_invoke_callback_func_t callback;
2056     void *                                  args;
2057 } QueryResourceProperties_callback_handle_t;
2058
2059
2060 const char * CounterPortType_QueryResourceProperties_fault_strings[COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_INVALIDRESOURCEPROPERTYQNAMEFAULT] =
2061 {
2062     "Unknown",
2063     "UnknownQueryExpressionDialectFault",
2064     "ResourceUnknownFault",
2065     "QueryEvaluationErrorFault",
2066     "InvalidQueryExpressionFault",
2067     "InvalidResourcePropertyQNameFault"
2068  };
2069
2070 static
2071 CounterPortType_QueryResourceProperties_fault_t
2072 QueryResourceProperties_lookup_fault_type(
2073     const char *                        fault_name)
2074 0 {
2075 0     CounterPortType_QueryResourceProperties_fault_t fault_type;
2076 0     GlobusFuncName(QueryResourceProperties_lookup_fault_type);
2077 0     CounterServiceDebugEnter();
2078
2079 0     globus_assert(fault_name);
2080
2081 0     if(!strcmp(fault_name, "UnknownQueryExpressionDialectFault"))
2082     {
2083 0         fault_type = COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_UNKNOWNQUERYEXPRESSIONDIALECTFAULT;
2084     }
2085 0     else if(!strcmp(fault_name, "ResourceUnknownFault"))
2086     {
2087 0         fault_type = COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_RESOURCEUNKNOWNFAULT;
2088     }
2089 0     else if(!strcmp(fault_name, "QueryEvaluationErrorFault"))
2090     {
2091 0         fault_type = COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_QUERYEVALUATIONERRORFAULT;
2092     }
2093 0     else if(!strcmp(fault_name, "InvalidQueryExpressionFault"))
2094     {
2095 0         fault_type = COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_INVALIDQUERYEXPRESSIONFAULT;
2096     }
2097 0     else if(!strcmp(fault_name, "InvalidResourcePropertyQNameFault"))
2098     {
2099 0         fault_type = COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_INVALIDRESOURCEPROPERTYQNAMEFAULT;
2100     }
2101     else
2102     {
2103 0         fault_type = COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_UNKNOWN_FAULT;
2104     }
2105
2106 0     CounterServiceDebugExit();
2107 0     return fault_type;
2108 }
2109
2110
2111     
2112 static
2113 void
2114 QueryResourceProperties_deserialize_callback(
2115     void *                              handle)
2116 0 {
2117 0     QueryResourceProperties_callback_handle_t * callback_handle;
2118 0     globus_result_t                     result = GLOBUS_SUCCESS;
2119 0     struct globus_soap_message_fault_s  soap_fault;
2120 0     QueryResourceProperties_invoke_func_t  invoke_function;
2121 0     wsrp_QueryResourcePropertiesType * QueryResourceProperties = NULL;
2122 0     GlobusFuncName(QueryResourceProperties_deserialize_callback);
2123 0     CounterServiceDebugEnter();
2124
2125 0     callback_handle = (QueryResourceProperties_callback_handle_t *) handle;
2126
2127 0     result = globus_operation_table_get_operation(
2128         CounterService_descriptor.operations,
2129         "QueryResourceProperties",
2130         (void **)&invoke_function);
2131 0     if(result != GLOBUS_SUCCESS)
2132     {
2133 0         goto exit;
2134     }
2135
2136 0     if(CounterService_descriptor.registry)
2137     {
2138 0         globus_soap_message_handle_set_registry(
2139             callback_handle->message,
2140             CounterService_descriptor.registry);
2141     }
2142
2143 0     result = wsrp_QueryResourcePropertiesType_init(
2144         &QueryResourceProperties);
2145 0     if(result != GLOBUS_SUCCESS)
2146     {
2147 0         goto exit;
2148     }
2149
2150 0     result = wsrp_QueryResourcePropertiesType_deserialize(
2151         &CounterPortType_QueryResourceProperties_input_qname,
2152         QueryResourceProperties,
2153         callback_handle->message,
2154         0);
2155 0     if(result != GLOBUS_SUCCESS)
2156     {
2157 0         goto exit;
2158     }
2159
2160 0     result = globus_soap_message_handle_set_attr(
2161         callback_handle->message,
2162         "QueryResourcePropertiesOperationInputParameter",
2163         wsrp_QueryResourcePropertiesType_copy_wrapper,
2164         wsrp_QueryResourcePropertiesType_destroy_wrapper,
2165         (void *)QueryResourceProperties);
2166 0     if(result != GLOBUS_SUCCESS)
2167     {
2168 0         goto exit;
2169     }
2170
2171  exit:
2172
2173 0     if (QueryResourceProperties != NULL)
2174     {
2175 0         wsrp_QueryResourcePropertiesType_destroy(QueryResourceProperties);
2176     }
2177 0     callback_handle->callback(
2178         result,
2179         callback_handle->args);
2180
2181 0     free(callback_handle);
2182 0     CounterServiceDebugExit();
2183 }
2184
2185 static
2186 globus_result_t
2187 QueryResourceProperties_deserialize(
2188     globus_service_engine_t                 engine,
2189     globus_soap_message_handle_t            message,
2190     globus_operation_invoke_callback_func_t invoke_callback,
2191     void *                                  args)
2192 0 {
2193 0     QueryResourceProperties_callback_handle_t * callback_handle;
2194 0     globus_result_t                    result = GLOBUS_SUCCESS;
2195 0     GlobusFuncName(QueryResourceProperties_deserialize);
2196 0     CounterServiceDebugEnter();
2197
2198 0     callback_handle = malloc(sizeof(QueryResourceProperties_callback_handle_t));
2199 0     globus_assert_string(callback_handle, 
2200                          "Memory allocation failed "
2201                          "for QueryResourceProperties callback handle");
2202
2203 0     callback_handle->engine = engine;
2204 0     callback_handle->message = message;
2205 0     callback_handle->callback = invoke_callback;
2206 0     callback_handle->args = args;
2207
2208 0     result = globus_callback_register_oneshot(
2209         NULL,
2210         &globus_i_reltime_zero,
2211         QueryResourceProperties_deserialize_callback,
2212         callback_handle);
2213
2214 0     CounterServiceDebugExit();
2215 0     return result;
2216 }
2217
2218 static
2219 void
2220 QueryResourceProperties_invoke_callback(
2221     void *                              handle)
2222 0 {
2223 0     QueryResourceProperties_callback_handle_t * callback_handle;
2224 0     globus_result_t                     result = GLOBUS_SUCCESS;
2225 0     struct globus_soap_message_fault_s  soap_fault;
2226 0     QueryResourceProperties_invoke_func_t  invoke_function;
2227 0     wsrp_QueryResourcePropertiesType * QueryResourceProperties;
2228 0     wsrp_QueryResourcePropertiesResponseType QueryResourcePropertiesResponse;
2229 0      xsd_QName element_qname;
2230 0      const char * fault_type_name = NULL;
2231 0      CounterPortType_QueryResourceProperties_fault_t fault_type = COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_NOFAULT;
2232 0      void *                              fault = NULL;
2233     
2234 0     GlobusFuncName(QueryResourceProperties_invoke_callback);
2235 0     CounterServiceDebugEnter();
2236
2237 0     callback_handle = (QueryResourceProperties_callback_handle_t *) handle;
2238
2239 0     QueryResourceProperties = globus_soap_message_handle_get_attr(
2240         callback_handle->message,
2241         "QueryResourcePropertiesOperationInputParameter");
2242 0     globus_assert(QueryResourceProperties);
2243
2244 0     result = globus_operation_table_get_operation(
2245         CounterService_descriptor.operations,
2246         "QueryResourceProperties",
2247         (void **)&invoke_function);
2248 0     if(result != GLOBUS_SUCCESS)
2249     {
2250 0         goto fault_exit;
2251     }
2252
2253
2254 0     result = wsrp_QueryResourcePropertiesResponseType_init_contents(
2255         &QueryResourcePropertiesResponse);
2256 0     if(result != GLOBUS_SUCCESS)
2257     {
2258 0         goto fault_exit;
2259     }
2260
2261 0     result = invoke_function(
2262         callback_handle->engine,
2263         callback_handle->message,
2264         &CounterService_descriptor,
2265         QueryResourceProperties,
2266         &QueryResourcePropertiesResponse,
2267         &fault_type_name,
2268         &fault);
2269
2270 fault_exit:
2271
2272 0     if(fault && fault_type_name)
2273     {
2274 0         fault_type = QueryResourceProperties_lookup_fault_type(fault_type_name);
2275
2276 0         result = globus_service_session_begin_response(
2277             callback_handle->message);
2278 0         if(result != GLOBUS_SUCCESS)
2279         {
2280 0             goto exit;
2281         }
2282         
2283 0         soap_fault.faultcode = "Server";
2284 0         soap_fault.faultstring = 
2285         "An error occurred while processing the message";
2286 0         soap_fault.faultactor = NULL;
2287
2288 0         switch(fault_type)
2289         {
2290         
2291         case COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_UNKNOWNQUERYEXPRESSIONDIALECTFAULT:
2292
2293 0             xsd_any_init(&soap_fault.detail);
2294 0             soap_fault.detail->any_info = &wsrp_UnknownQueryExpressionDialectFaultType_info;
2295 0             xsd_QName_init(&soap_fault.detail->element);
2296 0             soap_fault.detail->element->local = "UnknownQueryExpressionDialectFault";
2297 0             soap_fault.detail->element->Namespace = 
2298                 "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd";
2299 0             soap_fault.detail->value = fault;
2300 0             break;
2301
2302         case COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_RESOURCEUNKNOWNFAULT:
2303
2304 0             xsd_any_init(&soap_fault.detail);
2305 0             soap_fault.detail->any_info = &wsrp_ResourceUnknownFaultType_info;
2306 0             xsd_QName_init(&soap_fault.detail->element);
2307 0             soap_fault.detail->element->local = "ResourceUnknownFault";
2308 0             soap_fault.detail->element->Namespace = 
2309                 "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd";
2310 0             soap_fault.detail->value = fault;
2311 0             break;
2312
2313         case COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_QUERYEVALUATIONERRORFAULT:
2314
2315 0             xsd_any_init(&soap_fault.detail);
2316 0             soap_fault.detail->any_info = &wsrp_QueryEvaluationErrorFaultType_info;
2317 0             xsd_QName_init(&soap_fault.detail->element);
2318 0             soap_fault.detail->element->local = "QueryEvaluationErrorFault";
2319 0             soap_fault.detail->element->Namespace = 
2320                 "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd";
2321 0             soap_fault.detail->value = fault;
2322 0             break;
2323
2324         case COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_INVALIDQUERYEXPRESSIONFAULT:
2325
2326 0             xsd_any_init(&soap_fault.detail);
2327 0             soap_fault.detail->any_info = &wsrp_InvalidQueryExpressionFaultType_info;
2328 0             xsd_QName_init(&soap_fault.detail->element);
2329 0             soap_fault.detail->element->local = "InvalidQueryExpressionFault";
2330 0             soap_fault.detail->element->Namespace = 
2331                 "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd";
2332 0             soap_fault.detail->value = fault;
2333 0             break;
2334
2335         case COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_INVALIDRESOURCEPROPERTYQNAMEFAULT:
2336
2337 0             xsd_any_init(&soap_fault.detail);
2338 0             soap_fault.detail->any_info = &wsrp_InvalidResourcePropertyQNameFaultType_info;
2339 0             xsd_QName_init(&soap_fault.detail->element);
2340 0             soap_fault.detail->element->local = "InvalidResourcePropertyQNameFault";
2341 0             soap_fault.detail->element->Namespace = 
2342                 "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd";
2343 0             soap_fault.detail->value = fault;
2344 0             break;
2345
2346         default:
2347 0             result = CounterServiceErrorReturnedUnknownFault("QueryResourceProperties");
2348 0             goto exit;
2349         }         
2350
2351 0         result = globus_service_session_serialize_fault_response(
2352             callback_handle->message, &soap_fault);
2353 0         if(result != GLOBUS_SUCCESS)
2354         {
2355 0             goto exit;
2356         }
2357
2358 0         soap_fault.detail->element->local = NULL;
2359 0         soap_fault.detail->element->Namespace = NULL;
2360 0 soap_fault.detail->any_info = NULL;
2361 0         xsd_any_destroy(soap_fault.detail);
2362
2363 0         globus_soap_message_handle_set_attr(
2364             callback_handle->message, 
2365             WSADDR_ACTION_RESPONSE_KEY,
2366             globus_soap_message_attr_copy_string,
2367             globus_libc_free,
2368             WSADDRESSING_FAULT_NS);
2369     }
2370 0     else if(result != GLOBUS_SUCCESS)
2371     {
2372 0         globus_result_t                 local_result;
2373 0         local_result = globus_service_session_begin_response(
2374             callback_handle->message);
2375 0         if(local_result != GLOBUS_SUCCESS)
2376         {
2377 0             result = local_result;
2378 0             goto exit;
2379         }
2380
2381 0         soap_fault.faultcode = "Server";
2382 0         soap_fault.faultstring = globus_error_print_friendly(
2383             globus_error_get(result));
2384 0         result = GLOBUS_SUCCESS;
2385 0         soap_fault.faultactor = NULL;
2386 0         soap_fault.detail = NULL;
2387 0         result = globus_service_session_serialize_fault_response(
2388             callback_handle->message, &soap_fault);
2389 0         if(result != GLOBUS_SUCCESS)
2390         {
2391 0             goto exit;
2392         }
2393
2394 0         globus_soap_message_handle_set_attr(
2395             callback_handle->message, 
2396             WSADDR_ACTION_RESPONSE_KEY,
2397             globus_soap_message_attr_copy_string,
2398             globus_libc_free, 
2399             WSADDRESSING_FAULT_NS);
2400     }
2401     else
2402     {
2403 0         result = globus_service_session_begin_response(
2404             callback_handle->message);
2405 0         if(result != GLOBUS_SUCCESS)
2406         {
2407 0             goto exit;
2408         }
2409
2410 0         element_qname.local = "QueryResourcePropertiesResponse";
2411 0         element_qname.Namespace = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd";
2412
2413 0         result = wsrp_QueryResourcePropertiesResponseType_serialize(
2414             &element_qname,
2415             &QueryResourcePropertiesResponse,
2416             callback_handle->message,
2417             GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS);
2418 0         if(result != GLOBUS_SUCCESS)
2419         {
2420 0             goto exit;
2421         }
2422
2423 0         result = globus_service_session_end_response(
2424             callback_handle->message);
2425 0         if(result != GLOBUS_SUCCESS)
2426         {
2427 0             goto exit;
2428         }
2429
2430 0         wsrp_QueryResourcePropertiesResponseType_destroy_contents(
2431             &QueryResourcePropertiesResponse);
2432
2433 0         globus_soap_message_handle_set_attr(
2434             callback_handle->message, 
2435             WSADDR_ACTION_RESPONSE_KEY,
2436             globus_soap_message_attr_copy_string,
2437             globus_libc_free, 
2438             "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties/QueryResourcePropertiesResponse");
2439     }
2440
2441  exit:
2442
2443 0     callback_handle->callback(
2444         result,
2445         callback_handle->args);
2446
2447 0     globus_libc_free(callback_handle);
2448
2449 0     CounterServiceDebugExit();
2450 }
2451
2452 static
2453 globus_result_t
2454 QueryResourceProperties_invoke(
2455     globus_service_engine_t                 engine,
2456     globus_soap_message_handle_t            message,
2457     globus_service_response_t *             response,
2458     globus_operation_invoke_callback_func_t invoke_callback,
2459     void *                                  args)
2460 0 {
2461 0     QueryResourceProperties_callback_handle_t * callback_handle;
2462 0     globus_result_t                    result = GLOBUS_SUCCESS;
2463 0     GlobusFuncName(CounterPortType_QueryResourceProperties);
2464 0     CounterServiceDebugEnter();
2465
2466 0     callback_handle = malloc(sizeof(QueryResourceProperties_callback_handle_t));
2467 0     if(!callback_handle)
2468     {
2469 0         result = GlobusSoapMessageErrorOutOfMemory;
2470 0         goto exit;
2471     }
2472 0     callback_handle->engine = engine;
2473 0     callback_handle->message = message;
2474 0     callback_handle->callback = invoke_callback;
2475 0     callback_handle->args = args;
2476
2477 0     result = globus_callback_register_oneshot(
2478         NULL,
2479         &globus_i_reltime_zero,
2480         QueryResourceProperties_invoke_callback,
2481         callback_handle);
2482
2483  exit:
2484 0     CounterServiceDebugExit();
2485 0     return result;
2486 }
2487
2488
2489 static
2490 globus_result_t
2491 QueryResourceProperties_fault_to_type(
2492     const char *                            fault_type_name,
2493     int *                                   fault_type,
2494     globus_xsd_type_info_t *                fault_type_info)
2495 0 {
2496 0     globus_result_t                         result = GLOBUS_SUCCESS;
2497
2498 0     *fault_type_info = NULL;
2499
2500 0     *fault_type = QueryResourceProperties_lookup_fault_type(fault_type_name);
2501
2502 0     switch (*fault_type)
2503     {
2504         case COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_UNKNOWNQUERYEXPRESSIONDIALECTFAULT:
2505 0             *fault_type_info = &wsrp_UnknownQueryExpressionDialectFaultType_info;
2506 0             break;
2507
2508         case COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_RESOURCEUNKNOWNFAULT:
2509 0             *fault_type_info = &wsrp_ResourceUnknownFaultType_info;
2510 0             break;
2511
2512         case COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_QUERYEVALUATIONERRORFAULT:
2513 0             *fault_type_info = &wsrp_QueryEvaluationErrorFaultType_info;
2514 0             break;
2515
2516         case COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_INVALIDQUERYEXPRESSIONFAULT:
2517 0             *fault_type_info = &wsrp_InvalidQueryExpressionFaultType_info;
2518 0             break;
2519
2520         case COUNTERPORTTYPE_QUERYRESOURCEPROPERTIES_INVALIDRESOURCEPROPERTYQNAMEFAULT:
2521 0             *fault_type_info = &wsrp_InvalidResourcePropertyQNameFaultType_info;
2522 0             break;
2523
2524         default:
2525 0             result = CounterServiceErrorReturnedUnknownFault("QueryResourceProperties");
2526             goto exit;
2527     }
2528
2529 exit:
2530 0     return result;
2531 }
2532
2533
2534 static
2535 globus_service_operation_descriptor_t 
2536 QueryResourceProperties_operation_descriptor =
2537 {
2538     QueryResourceProperties_deserialize,
2539     QueryResourceProperties_invoke,
2540
2541     QueryResourceProperties_fault_to_type
2542
2543 };
2544
2545 static
2546 globus_operation_provider_descriptor_t QueryResourceProperties_descriptor =
2547 {
2548     &CounterPortType_QueryResourceProperties_op_qname,
2549     "QueryResourceProperties",
2550     (void *)CounterPortType_QueryResourceProperties_impl,
2551     NULL
2552 };
2553
2554
2555 xsd_QName CounterPortType_Destroy_op_qname = 
2556 {
2557     "http://localhost:8080/wsrf/services/CounterService"
2558     "Destroy"
2559 };
2560
2561 xsd_QName CounterPortType_Destroy_input_qname =
2562 {
2563      "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd",
2564      "Destroy"
2565 };
2566
2567 typedef globus_result_t (* Destroy_invoke_func_t) (
2568     globus_service_engine_t             engine,
2569     globus_soap_message_handle_t        message,
2570     globus_service_descriptor_t *       descriptor,
2571     wsrl_DestroyType * Destroy,
2572     wsrl_DestroyResponseType * DestroyResponse,
2573     const char ** fault_type_name,
2574     void ** fault);
2575     
2576 typedef struct Destroy_callback_handle_s
2577 {
2578     globus_service_engine_t                 engine;
2579     globus_soap_message_handle_t            message;
2580     globus_operation_invoke_callback_func_t callback;
2581     void *                                  args;
2582 } Destroy_callback_handle_t;
2583
2584
2585 const char * CounterPortType_Destroy_fault_strings[COUNTERPORTTYPE_DESTROY_RESOURCENOTDESTROYEDFAULT] =
2586 {
2587     "Unknown",
2588     "ResourceUnknownFault",
2589     "ResourceNotDestroyedFault"
2590  };
2591
2592 static
2593 CounterPortType_Destroy_fault_t
2594 Destroy_lookup_fault_type(
2595     const char *                        fault_name)
2596 0 {
2597 0     CounterPortType_Destroy_fault_t fault_type;
2598 0     GlobusFuncName(Destroy_lookup_fault_type);
2599 0     CounterServiceDebugEnter();
2600
2601 0     globus_assert(fault_name);
2602
2603 0     if(!strcmp(fault_name, "ResourceUnknownFault"))
2604     {
2605 0         fault_type = COUNTERPORTTYPE_DESTROY_RESOURCEUNKNOWNFAULT;
2606     }
2607 0     else if(!strcmp(fault_name, "ResourceNotDestroyedFault"))
2608     {
2609 0         fault_type = COUNTERPORTTYPE_DESTROY_RESOURCENOTDESTROYEDFAULT;
2610     }
2611     else
2612     {
2613 0         fault_type = COUNTERPORTTYPE_DESTROY_UNKNOWN_FAULT;
2614     }
2615
2616 0     CounterServiceDebugExit();
2617 0     return fault_type;
2618 }
2619
2620
2621     
2622 static
2623 void
2624 Destroy_deserialize_callback(
2625     void *                              handle)
2626 2 {
2627 2     Destroy_callback_handle_t * callback_handle;
2628 2     globus_result_t                     result = GLOBUS_SUCCESS;
2629 2     struct globus_soap_message_fault_s  soap_fault;
2630 2     Destroy_invoke_func_t  invoke_function;
2631 2     wsrl_DestroyType * Destroy = NULL;
2632 2     GlobusFuncName(Destroy_deserialize_callback);
2633 2     CounterServiceDebugEnter();
2634
2635 2     callback_handle = (Destroy_callback_handle_t *) handle;
2636
2637 2     result = globus_operation_table_get_operation(
2638         CounterService_descriptor.operations,
2639         "Destroy",
2640         (void **)&invoke_function);
2641 2     if(result != GLOBUS_SUCCESS)
2642     {
2643 0         goto exit;
2644     }
2645
2646 2     if(CounterService_descriptor.registry)
2647     {
2648 2         globus_soap_message_handle_set_registry(
2649             callback_handle->message,
2650             CounterService_descriptor.registry);
2651     }
2652
2653 2     result = wsrl_DestroyType_init(
2654         &Destroy);
2655 2     if(result != GLOBUS_SUCCESS)
2656     {
2657 0         goto exit;
2658     }
2659
2660 2     result = wsrl_DestroyType_deserialize(
2661         &CounterPortType_Destroy_input_qname,
2662         Destroy,
2663         callback_handle->message,
2664         0);
2665 2     if(result != GLOBUS_SUCCESS)
2666     {
2667 0         goto exit;
2668     }
2669
2670 2     result = globus_soap_message_handle_set_attr(
2671         callback_handle->message,
2672         "DestroyOperationInputParameter",
2673         wsrl_DestroyType_copy_wrapper,
2674         wsrl_DestroyType_destroy_wrapper,
2675         (void *)Destroy);
2676 2     if(result != GLOBUS_SUCCESS)
2677     {
2678 2         goto exit;
2679     }
2680
2681  exit:
2682
2683 2     if (Destroy != NULL)
2684     {
2685 2         wsrl_DestroyType_destroy(Destroy);
2686     }
2687 2     callback_handle->callback(
2688         result,
2689         callback_handle->args);
2690
2691 2     free(callback_handle);
2692 2     CounterServiceDebugExit();
2693 }
2694
2695 static
2696 globus_result_t
2697 Destroy_deserialize(
2698     globus_service_engine_t                 engine,
2699     globus_soap_message_handle_t            message,
2700     globus_operation_invoke_callback_func_t invoke_callback,
2701     void *                                  args)
2702 2 {
2703 2     Destroy_callback_handle_t * callback_handle;
2704 2     globus_result_t                    result = GLOBUS_SUCCESS;
2705 2     GlobusFuncName(Destroy_deserialize);
2706 2     CounterServiceDebugEnter();
2707
2708 2     callback_handle = malloc(sizeof(Destroy_callback_handle_t));
2709 2     globus_assert_string(callback_handle, 
2710                          "Memory allocation failed "
2711                          "for Destroy callback handle");
2712
2713 2     callback_handle->engine = engine;
2714 2     callback_handle->message = message;
2715 2     callback_handle->callback = invoke_callback;
2716 2     callback_handle->args = args;
2717
2718 2     result = globus_callback_register_oneshot(
2719         NULL,
2720         &globus_i_reltime_zero,
2721         Destroy_deserialize_callback,
2722         callback_handle);
2723
2724 2     CounterServiceDebugExit();
2725 2     return result;
2726 }
2727
2728 static
2729 void
2730 Destroy_invoke_callback(
2731     void *                              handle)
2732 2 {
2733 2     Destroy_callback_handle_t * callback_handle;
2734 2     globus_result_t                     result = GLOBUS_SUCCESS;
2735 2     struct globus_soap_message_fault_s  soap_fault;
2736 2     Destroy_invoke_func_t  invoke_function;
2737 2     wsrl_DestroyType * Destroy;
2738 2     wsrl_DestroyResponseType DestroyResponse;
2739 2      xsd_QName element_qname;
2740 2      const char * fault_type_name = NULL;
2741 2      CounterPortType_Destroy_fault_t fault_type = COUNTERPORTTYPE_DESTROY_NOFAULT;
2742 2      void *                              fault = NULL;
2743     
2744 2     GlobusFuncName(Destroy_invoke_callback);
2745 2     CounterServiceDebugEnter();
2746
2747 2     callback_handle = (Destroy_callback_handle_t *) handle;
2748
2749 2     Destroy = globus_soap_message_handle_get_attr(
2750         callback_handle->message,
2751         "DestroyOperationInputParameter");
2752 2     globus_assert(Destroy);
2753
2754 2     result = globus_operation_table_get_operation(
2755         CounterService_descriptor.operations,
2756         "Destroy",
2757         (void **)&invoke_function);
2758 2     if(result != GLOBUS_SUCCESS)
2759     {
2760 0         goto fault_exit;
2761     }
2762
2763
2764 2     result = wsrl_DestroyResponseType_init_contents(
2765         &DestroyResponse);
2766 2     if(result != GLOBUS_SUCCESS)
2767     {
2768 0         goto fault_exit;
2769     }
2770
2771 2     result = invoke_function(
2772         callback_handle->engine,
2773         callback_handle->message,
2774         &CounterService_descriptor,
2775         Destroy,
2776         &DestroyResponse,
2777         &fault_type_name,
2778         &fault);
2779
2780 fault_exit:
2781
2782 2     if(fault && fault_type_name)
2783     {
2784 0         fault_type = Destroy_lookup_fault_type(fault_type_name);
2785
2786 0         result = globus_service_session_begin_response(
2787             callback_handle->message);
2788 0         if(result != GLOBUS_SUCCESS)
2789         {
2790 0             goto exit;
2791         }
2792         
2793 0         soap_fault.faultcode = "Server";
2794 0         soap_fault.faultstring = 
2795         "An error occurred while processing the message";
2796 0         soap_fault.faultactor = NULL;
2797
2798 0         switch(fault_type)
2799         {
2800         
2801         case COUNTERPORTTYPE_DESTROY_RESOURCEUNKNOWNFAULT:
2802
2803 0             xsd_any_init(&soap_fault.detail);
2804 0             soap_fault.detail->any_info = &wsrl_ResourceUnknownFaultType_info;
2805 0             xsd_QName_init(&soap_fault.detail->element);
2806 0             soap_fault.detail->element->local = "ResourceUnknownFault";
2807 0             soap_fault.detail->element->Namespace = 
2808                 "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd";
2809 0             soap_fault.detail->value = fault;
2810 0             break;
2811
2812         case COUNTERPORTTYPE_DESTROY_RESOURCENOTDESTROYEDFAULT:
2813
2814 0             xsd_any_init(&soap_fault.detail);
2815 0             soap_fault.detail->any_info = &wsrl_ResourceNotDestroyedFaultType_info;
2816 0             xsd_QName_init(&soap_fault.detail->element);
2817 0             soap_fault.detail->element->local = "ResourceNotDestroyedFault";
2818 0             soap_fault.detail->element->Namespace = 
2819                 "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd";
2820 0             soap_fault.detail->value = fault;
2821 0             break;
2822
2823         default:
2824 0             result = CounterServiceErrorReturnedUnknownFault("Destroy");
2825 0             goto exit;
2826         }         
2827
2828 0         result = globus_service_session_serialize_fault_response(
2829             callback_handle->message, &soap_fault);
2830 0         if(result != GLOBUS_SUCCESS)
2831         {
2832 0             goto exit;
2833         }
2834
2835 0         soap_fault.detail->element->local = NULL;
2836 0         soap_fault.detail->element->Namespace = NULL;
2837 0 soap_fault.detail->any_info = NULL;
2838 0         xsd_any_destroy(soap_fault.detail);
2839
2840 0         globus_soap_message_handle_set_attr(
2841             callback_handle->message, 
2842             WSADDR_ACTION_RESPONSE_KEY,
2843             globus_soap_message_attr_copy_string,
2844             globus_libc_free,
2845             WSADDRESSING_FAULT_NS);
2846     }
2847 2     else if(result != GLOBUS_SUCCESS)
2848     {
2849 0         globus_result_t                 local_result;
2850 0         local_result = globus_service_session_begin_response(
2851             callback_handle->message);
2852 0         if(local_result != GLOBUS_SUCCESS)
2853         {
2854 0             result = local_result;
2855 0             goto exit;
2856         }
2857
2858 0         soap_fault.faultcode = "Server";
2859 0         soap_fault.faultstring = globus_error_print_friendly(
2860             globus_error_get(result));
2861 0         result = GLOBUS_SUCCESS;
2862 0         soap_fault.faultactor = NULL;
2863 0         soap_fault.detail = NULL;
2864 0         result = globus_service_session_serialize_fault_response(
2865             callback_handle->message, &soap_fault);
2866 0         if(result != GLOBUS_SUCCESS)
2867         {
2868 0             goto exit;
2869         }
2870
2871 0         globus_soap_message_handle_set_attr(
2872             callback_handle->message, 
2873             WSADDR_ACTION_RESPONSE_KEY,
2874             globus_soap_message_attr_copy_string,
2875             globus_libc_free, 
2876             WSADDRESSING_FAULT_NS);
2877     }
2878     else
2879     {
2880 2         result = globus_service_session_begin_response(
2881             callback_handle->message);
2882 2         if(result != GLOBUS_SUCCESS)
2883         {
2884 0             goto exit;
2885         }
2886
2887 2         element_qname.local = "DestroyResponse";
2888 2         element_qname.Namespace = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd";
2889
2890 2         result = wsrl_DestroyResponseType_serialize(
2891             &element_qname,
2892             &DestroyResponse,
2893             callback_handle->message,
2894             GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS);
2895 2         if(result != GLOBUS_SUCCESS)
2896         {
2897 0             goto exit;
2898         }
2899
2900 2         result = globus_service_session_end_response(
2901             callback_handle->message);
2902 2         if(result != GLOBUS_SUCCESS)
2903         {
2904 0             goto exit;
2905         }
2906
2907 2         wsrl_DestroyResponseType_destroy_contents(
2908             &DestroyResponse);
2909
2910 2         globus_soap_message_handle_set_attr(
2911             callback_handle->message, 
2912             WSADDR_ACTION_RESPONSE_KEY,
2913             globus_soap_message_attr_copy_string,
2914             globus_libc_free, 
2915             "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime/DestroyResponse");
2916     }
2917
2918  exit:
2919
2920 2     callback_handle->callback(
2921         result,
2922         callback_handle->args);
2923
2924 2     globus_libc_free(callback_handle);
2925
2926 2     CounterServiceDebugExit();
2927 }
2928
2929 static
2930 globus_result_t
2931 Destroy_invoke(
2932     globus_service_engine_t                 engine,
2933     globus_soap_message_handle_t            message,
2934     globus_service_response_t *             response,
2935     globus_operation_invoke_callback_func_t invoke_callback,
2936     void *                                  args)
2937 2 {
2938 2     Destroy_callback_handle_t * callback_handle;
2939 2     globus_result_t                    result = GLOBUS_SUCCESS;
2940 2     GlobusFuncName(CounterPortType_Destroy);
2941 2     CounterServiceDebugEnter();
2942
2943 2     callback_handle = malloc(sizeof(Destroy_callback_handle_t));
2944 2     if(!callback_handle)
2945     {
2946 0         result = GlobusSoapMessageErrorOutOfMemory;
2947 0         goto exit;
2948     }
2949 2     callback_handle->engine = engine;
2950 2     callback_handle->message = message;
2951 2     callback_handle->callback = invoke_callback;
2952 2     callback_handle->args = args;
2953
2954 2     result = globus_callback_register_oneshot(
2955         NULL,
2956         &globus_i_reltime_zero,
2957         Destroy_invoke_callback,
2958         callback_handle);
2959
2960  exit:
2961 2     CounterServiceDebugExit();
2962 2     return result;
2963 }
2964
2965
2966 static
2967 globus_result_t
2968 Destroy_fault_to_type(
2969     const char *                            fault_type_name,
2970     int *                                   fault_type,
2971     globus_xsd_type_info_t *                fault_type_info)
2972 0 {
2973 0     globus_result_t                         result = GLOBUS_SUCCESS;
2974
2975 0     *fault_type_info = NULL;
2976
2977 0     *fault_type = Destroy_lookup_fault_type(fault_type_name);
2978
2979 0     switch (*fault_type)
2980     {
2981         case COUNTERPORTTYPE_DESTROY_RESOURCEUNKNOWNFAULT:
2982 0             *fault_type_info = &wsrl_ResourceUnknownFaultType_info;
2983 0             break;
2984
2985         case COUNTERPORTTYPE_DESTROY_RESOURCENOTDESTROYEDFAULT:
2986 0             *fault_type_info = &wsrl_ResourceNotDestroyedFaultType_info;
2987 0             break;
2988
2989         default:
2990 0             result = CounterServiceErrorReturnedUnknownFault("Destroy");
2991             goto exit;
2992     }
2993
2994 exit:
2995 0     return result;
2996 }
2997
2998
2999 static
3000 globus_service_operation_descriptor_t 
3001 Destroy_operation_descriptor =
3002 {
3003     Destroy_deserialize,
3004     Destroy_invoke,
3005
3006     Destroy_fault_to_type
3007
3008 };
3009
3010 static
3011 globus_operation_provider_descriptor_t Destroy_descriptor =
3012 {
3013     &CounterPortType_Destroy_op_qname,
3014     "Destroy",
3015     (void *)CounterPortType_Destroy_impl,
3016     NULL
3017 };
3018
3019
3020 xsd_QName CounterPortType_SetTerminationTime_op_qname = 
3021 {
3022     "http://localhost:8080/wsrf/services/CounterService"
3023     "SetTerminationTime"
3024 };
3025
3026 xsd_QName CounterPortType_SetTerminationTime_input_qname =
3027 {
3028      "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd",
3029      "SetTerminationTime"
3030 };
3031
3032 typedef globus_result_t (* SetTerminationTime_invoke_func_t) (
3033     globus_service_engine_t             engine,
3034     globus_soap_message_handle_t        message,
3035     globus_service_descriptor_t *       descriptor,
3036     wsrl_SetTerminationTimeType * SetTerminationTime,
3037     wsrl_SetTerminationTimeResponseType * SetTerminationTimeResponse,
3038     const char ** fault_type_name,
3039     void ** fault);
3040     
3041 typedef struct SetTerminationTime_callback_handle_s
3042 {
3043     globus_service_engine_t                 engine;
3044     globus_soap_message_handle_t            message;
3045     globus_operation_invoke_callback_func_t callback;
3046     void *                                  args;
3047 } SetTerminationTime_callback_handle_t;
3048
3049
3050 const char * CounterPortType_SetTerminationTime_fault_strings[COUNTERPORTTYPE_SETTERMINATIONTIME_UNABLETOSETTERMINATIONTIMEFAULT] =
3051 {
3052     "Unknown",
3053     "TerminationTimeChangeRejectedFault",
3054     "ResourceUnknownFault",
3055     "UnableToSetTerminationTimeFault"
3056  };
3057
3058 static
3059 CounterPortType_SetTerminationTime_fault_t
3060 SetTerminationTime_lookup_fault_type(
3061     const char *                        fault_name)
3062 0 {
3063 0     CounterPortType_SetTerminationTime_fault_t fault_type;
3064 0     GlobusFuncName(SetTerminationTime_lookup_fault_type);
3065 0     CounterServiceDebugEnter();
3066
3067 0     globus_assert(fault_name);
3068
3069 0     if(!strcmp(fault_name, "TerminationTimeChangeRejectedFault"))
3070     {
3071 0         fault_type = COUNTERPORTTYPE_SETTERMINATIONTIME_TERMINATIONTIMECHANGEREJECTEDFAULT;
3072     }
3073 0     else if(!strcmp(fault_name, "ResourceUnknownFault"))
3074     {
3075 0         fault_type = COUNTERPORTTYPE_SETTERMINATIONTIME_RESOURCEUNKNOWNFAULT;
3076     }
3077 0     else if(!strcmp(fault_name, "UnableToSetTerminationTimeFault"))
3078     {
3079 0         fault_type = COUNTERPORTTYPE_SETTERMINATIONTIME_UNABLETOSETTERMINATIONTIMEFAULT;
3080     }
3081     else
3082     {
3083 0         fault_type = COUNTERPORTTYPE_SETTERMINATIONTIME_UNKNOWN_FAULT;
3084     }
3085
3086 0     CounterServiceDebugExit();
3087 0     return fault_type;
3088 }
3089
3090
3091     
3092 static
3093 void
3094 SetTerminationTime_deserialize_callback(
3095     void *                              handle)
3096 0 {
3097 0     SetTerminationTime_callback_handle_t * callback_handle;
3098 0     globus_result_t                     result = GLOBUS_SUCCESS;
3099 0     struct globus_soap_message_fault_s  soap_fault;
3100 0     SetTerminationTime_invoke_func_t  invoke_function;
3101 0     wsrl_SetTerminationTimeType * SetTerminationTime = NULL;
3102 0     GlobusFuncName(SetTerminationTime_deserialize_callback);
3103 0     CounterServiceDebugEnter();
3104
3105 0     callback_handle = (SetTerminationTime_callback_handle_t *) handle;
3106
3107 0     result = globus_operation_table_get_operation(
3108         CounterService_descriptor.operations,
3109         "SetTerminationTime",
3110         (void **)&invoke_function);
3111 0     if(result != GLOBUS_SUCCESS)
3112     {
3113 0         goto exit;
3114     }
3115
3116 0     if(CounterService_descriptor.registry)
3117     {
3118 0         globus_soap_message_handle_set_registry(
3119             callback_handle->message,
3120             CounterService_descriptor.registry);
3121     }
3122
3123 0     result = wsrl_SetTerminationTimeType_init(
3124         &SetTerminationTime);
3125 0     if(result != GLOBUS_SUCCESS)
3126     {
3127 0         goto exit;
3128     }
3129
3130 0     result = wsrl_SetTerminationTimeType_deserialize(
3131         &CounterPortType_SetTerminationTime_input_qname,
3132         SetTerminationTime,
3133         callback_handle->message,
3134         0);
3135 0     if(result != GLOBUS_SUCCESS)
3136     {
3137 0         goto exit;
3138     }
3139
3140 0     result = globus_soap_message_handle_set_attr(
3141         callback_handle->message,
3142         "SetTerminationTimeOperationInputParameter",
3143         wsrl_SetTerminationTimeType_copy_wrapper,
3144         wsrl_SetTerminationTimeType_destroy_wrapper,
3145         (void *)SetTerminationTime);
3146 0     if(result != GLOBUS_SUCCESS)
3147     {
3148 0         goto exit;
3149     }
3150
3151  exit:
3152
3153 0     if (SetTerminationTime != NULL)
3154     {
3155 0         wsrl_SetTerminationTimeType_destroy(SetTerminationTime);
3156     }
3157 0     callback_handle->callback(
3158         result,
3159         callback_handle->args);
3160
3161 0     free(callback_handle);
3162 0     CounterServiceDebugExit();
3163 }
3164
3165 static
3166 globus_result_t
3167 SetTerminationTime_deserialize(
3168     globus_service_engine_t                 engine,
3169     globus_soap_message_handle_t            message,
3170     globus_operation_invoke_callback_func_t invoke_callback,
3171     void *                                  args)
3172 0 {
3173 0     SetTerminationTime_callback_handle_t * callback_handle;
3174 0     globus_result_t                    result = GLOBUS_SUCCESS;
3175 0     GlobusFuncName(SetTerminationTime_deserialize);
3176 0     CounterServiceDebugEnter();
3177
3178 0     callback_handle = malloc(sizeof(SetTerminationTime_callback_handle_t));
3179 0     globus_assert_string(callback_handle, 
3180                          "Memory allocation failed "
3181                          "for SetTerminationTime callback handle");
3182
3183 0     callback_handle->engine = engine;
3184 0     callback_handle->message = message;
3185 0     callback_handle->callback = invoke_callback;
3186 0     callback_handle->args = args;
3187
3188 0     result = globus_callback_register_oneshot(
3189         NULL,
3190         &globus_i_reltime_zero,
3191         SetTerminationTime_deserialize_callback,
3192         callback_handle);
3193
3194 0     CounterServiceDebugExit();
3195 0     return result;
3196 }
3197
3198 static
3199 void
3200 SetTerminationTime_invoke_callback(
3201     void *                              handle)
3202 0 {
3203 0     SetTerminationTime_callback_handle_t * callback_handle;
3204 0     globus_result_t                     result = GLOBUS_SUCCESS;
3205 0     struct globus_soap_message_fault_s  soap_fault;
3206 0     SetTerminationTime_invoke_func_t  invoke_function;
3207 0     wsrl_SetTerminationTimeType * SetTerminationTime;
3208 0     wsrl_SetTerminationTimeResponseType SetTerminationTimeResponse;
3209 0      xsd_QName element_qname;
3210 0      const char * fault_type_name = NULL;
3211 0      CounterPortType_SetTerminationTime_fault_t fault_type = COUNTERPORTTYPE_SETTERMINATIONTIME_NOFAULT;
3212 0      void *                              fault = NULL;
3213     
3214 0     GlobusFuncName(SetTerminationTime_invoke_callback);
3215 0     CounterServiceDebugEnter();
3216
3217 0     callback_handle = (SetTerminationTime_callback_handle_t *) handle;
3218
3219 0     SetTerminationTime = globus_soap_message_handle_get_attr(
3220         callback_handle->message,
3221         "SetTerminationTimeOperationInputParameter");
3222 0     globus_assert(SetTerminationTime);
3223
3224 0     result = globus_operation_table_get_operation(
3225         CounterService_descriptor.operations,
3226         "SetTerminationTime",
3227         (void **)&invoke_function);
3228 0     if(result != GLOBUS_SUCCESS)
3229     {
3230 0         goto fault_exit;
3231     }
3232
3233
3234 0     result = wsrl_SetTerminationTimeResponseType_init_contents(
3235         &SetTerminationTimeResponse);
3236 0     if(result != GLOBUS_SUCCESS)
3237     {
3238 0         goto fault_exit;
3239     }
3240
3241 0     result = invoke_function(
3242         callback_handle->engine,
3243         callback_handle->message,
3244         &CounterService_descriptor,
3245         SetTerminationTime,
3246         &SetTerminationTimeResponse,
3247         &fault_type_name,
3248         &fault);
3249
3250 fault_exit:
3251
3252 0     if(fault && fault_type_name)
3253     {
3254 0         fault_type = SetTerminationTime_lookup_fault_type(fault_type_name);
3255
3256 0         result = globus_service_session_begin_response(
3257             callback_handle->message);
3258 0         if(result != GLOBUS_SUCCESS)
3259         {
3260 0             goto exit;
3261         }
3262         
3263 0         soap_fault.faultcode = "Server";
3264 0         soap_fault.faultstring = 
3265         "An error occurred while processing the message";
3266 0         soap_fault.faultactor = NULL;
3267
3268 0         switch(fault_type)
3269         {
3270         
3271         case COUNTERPORTTYPE_SETTERMINATIONTIME_TERMINATIONTIMECHANGEREJECTEDFAULT:
3272
3273 0             xsd_any_init(&soap_fault.detail);
3274 0             soap_fault.detail->any_info = &wsrl_TerminationTimeChangeRejectedFaultType_info;
3275 0             xsd_QName_init(&soap_fault.detail->element);
3276 0             soap_fault.detail->element->local = "TerminationTimeChangeRejectedFault";
3277 0             soap_fault.detail->element->Namespace = 
3278                 "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd";
3279 0             soap_fault.detail->value = fault;
3280 0             break;
3281
3282         case COUNTERPORTTYPE_SETTERMINATIONTIME_RESOURCEUNKNOWNFAULT:
3283
3284 0             xsd_any_init(&soap_fault.detail);
3285 0             soap_fault.detail->any_info = &wsrl_ResourceUnknownFaultType_info;
3286 0             xsd_QName_init(&soap_fault.detail->element);
3287 0             soap_fault.detail->element->local = "ResourceUnknownFault";
3288 0             soap_fault.detail->element->Namespace = 
3289                 "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd";
3290 0             soap_fault.detail->value = fault;
3291 0             break;
3292
3293         case COUNTERPORTTYPE_SETTERMINATIONTIME_UNABLETOSETTERMINATIONTIMEFAULT:
3294
3295 0             xsd_any_init(&soap_fault.detail);
3296 0             soap_fault.detail->any_info = &wsrl_UnableToSetTerminationTimeFaultType_info;
3297 0             xsd_QName_init(&soap_fault.detail->element);
3298 0             soap_fault.detail->element->local = "UnableToSetTerminationTimeFault";
3299 0             soap_fault.detail->element->Namespace = 
3300                 "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd";
3301 0             soap_fault.detail->value = fault;
3302 0             break;
3303
3304         default:
3305 0             result = CounterServiceErrorReturnedUnknownFault("SetTerminationTime");
3306 0             goto exit;
3307         }         
3308
3309 0         result = globus_service_session_serialize_fault_response(
3310             callback_handle->message, &soap_fault);
3311 0         if(result != GLOBUS_SUCCESS)
3312         {
3313 0             goto exit;
3314         }
3315
3316 0         soap_fault.detail->element->local = NULL;
3317 0         soap_fault.detail->element->Namespace = NULL;
3318 0 soap_fault.detail->any_info = NULL;
3319 0         xsd_any_destroy(soap_fault.detail);
3320
3321 0         globus_soap_message_handle_set_attr(
3322             callback_handle->message, 
3323             WSADDR_ACTION_RESPONSE_KEY,
3324             globus_soap_message_attr_copy_string,
3325             globus_libc_free,
3326             WSADDRESSING_FAULT_NS);
3327     }
3328 0     else if(result != GLOBUS_SUCCESS)
3329     {
3330 0         globus_result_t                 local_result;
3331 0         local_result = globus_service_session_begin_response(
3332             callback_handle->message);
3333 0         if(local_result != GLOBUS_SUCCESS)
3334         {
3335 0             result = local_result;
3336 0             goto exit;
3337         }
3338
3339 0         soap_fault.faultcode = "Server";
3340 0         soap_fault.faultstring = globus_error_print_friendly(
3341             globus_error_get(result));
3342 0         result = GLOBUS_SUCCESS;
3343 0         soap_fault.faultactor = NULL;
3344 0         soap_fault.detail = NULL;
3345 0         result = globus_service_session_serialize_fault_response(
3346             callback_handle->message, &soap_fault);
3347 0         if(result != GLOBUS_SUCCESS)
3348         {
3349 0             goto exit;
3350         }
3351
3352 0         globus_soap_message_handle_set_attr(
3353             callback_handle->message, 
3354             WSADDR_ACTION_RESPONSE_KEY,
3355             globus_soap_message_attr_copy_string,
3356             globus_libc_free, 
3357             WSADDRESSING_FAULT_NS);
3358     }
3359     else
3360     {
3361 0         result = globus_service_session_begin_response(
3362             callback_handle->message);
3363 0         if(result != GLOBUS_SUCCESS)
3364         {
3365 0             goto exit;
3366         }
3367
3368 0         element_qname.local = "SetTerminationTimeResponse";
3369 0         element_qname.Namespace = "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd";
3370
3371 0         result = wsrl_SetTerminationTimeResponseType_serialize(
3372             &element_qname,
3373             &SetTerminationTimeResponse,
3374             callback_handle->message,
3375             GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS);
3376 0         if(result != GLOBUS_SUCCESS)
3377         {
3378 0             goto exit;
3379         }
3380
3381 0         result = globus_service_session_end_response(
3382             callback_handle->message);
3383 0         if(result != GLOBUS_SUCCESS)
3384         {
3385 0             goto exit;
3386         }
3387
3388 0         wsrl_SetTerminationTimeResponseType_destroy_contents(
3389             &SetTerminationTimeResponse);
3390
3391 0         globus_soap_message_handle_set_attr(
3392             callback_handle->message, 
3393             WSADDR_ACTION_RESPONSE_KEY,
3394             globus_soap_message_attr_copy_string,
3395             globus_libc_free, 
3396             "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime/SetTerminationTimeResponse");
3397     }
3398
3399  exit:
3400
3401 0     callback_handle->callback(
3402         result,
3403         callback_handle->args);
3404
3405 0     globus_libc_free(callback_handle);
3406
3407 0     CounterServiceDebugExit();
3408 }
3409
3410 static
3411 globus_result_t
3412 SetTerminationTime_invoke(
3413     globus_service_engine_t                 engine,
3414     globus_soap_message_handle_t            message,
3415     globus_service_response_t *             response,
3416     globus_operation_invoke_callback_func_t invoke_callback,
3417     void *                                  args)
3418 0 {
3419 0     SetTerminationTime_callback_handle_t * callback_handle;
3420 0     globus_result_t                    result = GLOBUS_SUCCESS;
3421 0     GlobusFuncName(CounterPortType_SetTerminationTime);
3422 0     CounterServiceDebugEnter();
3423
3424 0     callback_handle = malloc(sizeof(SetTerminationTime_callback_handle_t));
3425 0     if(!callback_handle)
3426     {
3427 0         result = GlobusSoapMessageErrorOutOfMemory;
3428 0         goto exit;
3429     }
3430 0     callback_handle->engine = engine;
3431 0     callback_handle->message = message;
3432 0     callback_handle->callback = invoke_callback;
3433 0     callback_handle->args = args;
3434
3435 0     result = globus_callback_register_oneshot(
3436         NULL,
3437         &globus_i_reltime_zero,
3438         SetTerminationTime_invoke_callback,
3439         callback_handle);
3440
3441  exit:
3442 0     CounterServiceDebugExit();
3443 0     return result;
3444 }
3445
3446
3447 static
3448 globus_result_t
3449 SetTerminationTime_fault_to_type(
3450     const char *                            fault_type_name,
3451     int *                                   fault_type,
3452     globus_xsd_type_info_t *                fault_type_info)
3453 0 {
3454 0     globus_result_t                         result = GLOBUS_SUCCESS;
3455
3456 0     *fault_type_info = NULL;
3457
3458 0     *fault_type = SetTerminationTime_lookup_fault_type(fault_type_name);
3459
3460 0     switch (*fault_type)
3461     {
3462         case COUNTERPORTTYPE_SETTERMINATIONTIME_TERMINATIONTIMECHANGEREJECTEDFAULT:
3463 0             *fault_type_info = &wsrl_TerminationTimeChangeRejectedFaultType_info;
3464 0             break;
3465
3466         case COUNTERPORTTYPE_SETTERMINATIONTIME_RESOURCEUNKNOWNFAULT:
3467 0             *fault_type_info = &wsrl_ResourceUnknownFaultType_info;
3468 0             break;
3469
3470         case COUNTERPORTTYPE_SETTERMINATIONTIME_UNABLETOSETTERMINATIONTIMEFAULT:
3471 0             *fault_type_info = &wsrl_UnableToSetTerminationTimeFaultType_info;
3472 0             break;
3473
3474         default:
3475 0             result = CounterServiceErrorReturnedUnknownFault("SetTerminationTime");
3476             goto exit;
3477     }
3478
3479 exit:
3480 0     return result;
3481 }
3482
3483
3484 static
3485 globus_service_operation_descriptor_t 
3486 SetTerminationTime_operation_descriptor =
3487 {
3488     SetTerminationTime_deserialize,
3489     SetTerminationTime_invoke,
3490
3491     SetTerminationTime_fault_to_type
3492
3493 };
3494
3495 static
3496 globus_operation_provider_descriptor_t SetTerminationTime_descriptor =
3497 {
3498     &CounterPortType_SetTerminationTime_op_qname,
3499     "SetTerminationTime",
3500     (void *)CounterPortType_SetTerminationTime_impl,
3501     NULL
3502 };
3503
3504
3505 xsd_QName CounterPortType_add_op_qname = 
3506 {
3507     "http://localhost:8080/wsrf/services/CounterService"
3508     "add"
3509 };
3510
3511 xsd_QName CounterPortType_add_input_qname =
3512 {
3513      "http://counter.com",
3514      "add"
3515 };
3516
3517 typedef globus_result_t (* add_invoke_func_t) (
3518     globus_service_engine_t             engine,
3519     globus_soap_message_handle_t        message,
3520     globus_service_descriptor_t *       descriptor,
3521     xsd_int * add,
3522     xsd_int * addResponse,
3523     const char ** fault_type_name,
3524     void ** fault);
3525     
3526 typedef struct add_callback_handle_s
3527 {
3528     globus_service_engine_t                 engine;
3529     globus_soap_message_handle_t            message;
3530     globus_operation_invoke_callback_func_t callback;
3531     void *                                  args;
3532 } add_callback_handle_t;
3533
3534             
3535 const char * CounterPortType_add_fault_strings[COUNTERPORTTYPE_ADD_UNKNOWN_FAULT] =
3536 {
3537     "Unknown"
3538
3539  };
3540
3541 static
3542 CounterPortType_add_fault_t
3543 add_lookup_fault_type(
3544     const char *                        fault_name)
3545 0 {
3546 0     CounterPortType_add_fault_t fault_type;
3547 0     GlobusFuncName(add_lookup_fault_type);
3548 0     CounterServiceDebugEnter();
3549
3550 0     globus_assert(fault_name);
3551
3552    
3553     {
3554 0         fault_type = COUNTERPORTTYPE_ADD_UNKNOWN_FAULT;
3555     }
3556
3557 0     CounterServiceDebugExit();
3558 0     return fault_type;
3559 }
3560
3561
3562     
3563 static
3564 void
3565 add_deserialize_callback(
3566     void *                              handle)
3567 22 {
3568 22     add_callback_handle_t * callback_handle;
3569 22     globus_result_t                     result = GLOBUS_SUCCESS;
3570 22     struct globus_soap_message_fault_s  soap_fault;
3571 22     add_invoke_func_t  invoke_function;
3572 22     xsd_int * add = NULL;
3573 22     GlobusFuncName(add_deserialize_callback);
3574 22     CounterServiceDebugEnter();
3575
3576 22     callback_handle = (add_callback_handle_t *) handle;
3577
3578 22     result = globus_operation_table_get_operation(
3579         CounterService_descriptor.operations,
3580         "add",
3581         (void **)&invoke_function);
3582 22     if(result != GLOBUS_SUCCESS)
3583     {
3584 0         goto exit;
3585     }
3586
3587 22     if(CounterService_descriptor.registry)
3588     {
3589 22         globus_soap_message_handle_set_registry(
3590             callback_handle->message,
3591             CounterService_descriptor.registry);
3592     }
3593
3594 22     result = xsd_int_init(
3595         &add);
3596 22     if(result != GLOBUS_SUCCESS)
3597     {
3598 0         goto exit;
3599     }
3600
3601 22     result = xsd_int_deserialize(
3602         &CounterPortType_add_input_qname,
3603         add,
3604         callback_handle->message,
3605         0);
3606 22     if(result != GLOBUS_SUCCESS)
3607     {
3608 0         goto exit;
3609     }
3610
3611 22     result = globus_soap_message_handle_set_attr(
3612         callback_handle->message,
3613         "addOperationInputParameter",
3614         xsd_int_copy_wrapper,
3615         xsd_int_destroy_wrapper,
3616         (void *)add);
3617 22     if(result != GLOBUS_SUCCESS)
3618     {
3619 22         goto exit;
3620     }
3621
3622  exit:
3623
3624 22     if (add != NULL)
3625     {
3626 22         xsd_int_destroy(add);
3627     }
3628 22     callback_handle->callback(
3629         result,
3630         callback_handle->args);
3631
3632 22     free(callback_handle);
3633 22     CounterServiceDebugExit();
3634 }
3635
3636 static
3637 globus_result_t
3638 add_deserialize(
3639     globus_service_engine_t                 engine,
3640     globus_soap_message_handle_t            message,
3641     globus_operation_invoke_callback_func_t invoke_callback,
3642     void *                                  args)
3643 22 {
3644 22     add_callback_handle_t * callback_handle;
3645 22     globus_result_t                    result = GLOBUS_SUCCESS;
3646 22     GlobusFuncName(add_deserialize);
3647 22     CounterServiceDebugEnter();
3648
3649 22     callback_handle = malloc(sizeof(add_callback_handle_t));
3650 22     globus_assert_string(callback_handle, 
3651                          "Memory allocation failed "
3652                          "for add callback handle");
3653
3654 22     callback_handle->engine = engine;
3655 22     callback_handle->message = message;
3656 22     callback_handle->callback = invoke_callback;
3657 22     callback_handle->args = args;
3658
3659 22     result = globus_callback_register_oneshot(
3660         NULL,
3661         &globus_i_reltime_zero,
3662         add_deserialize_callback,
3663         callback_handle);
3664
3665 22     CounterServiceDebugExit();
3666 22     return result;
3667 }
3668
3669 static
3670 void
3671 add_invoke_callback(
3672     void *                              handle)
3673 22 {
3674 22     add_callback_handle_t * callback_handle;
3675 22     globus_result_t                     result = GLOBUS_SUCCESS;
3676 22     struct globus_soap_message_fault_s  soap_fault;
3677 22     add_invoke_func_t  invoke_function;
3678 22     xsd_int * add;
3679 22     xsd_int addResponse;
3680 22      xsd_QName element_qname;
3681 22      const char * fault_type_name = NULL;
3682 22      CounterPortType_add_fault_t fault_type = COUNTERPORTTYPE_ADD_NOFAULT;
3683 22      void *                              fault = NULL;
3684     
3685 22     GlobusFuncName(add_invoke_callback);
3686 22     CounterServiceDebugEnter();
3687
3688 22     callback_handle = (add_callback_handle_t *) handle;
3689
3690 22     add = globus_soap_message_handle_get_attr(
3691         callback_handle->message,
3692         "addOperationInputParameter");
3693 22     globus_assert(add);
3694
3695 22     result = globus_operation_table_get_operation(
3696         CounterService_descriptor.operations,
3697         "add",
3698         (void **)&invoke_function);
3699 22     if(result != GLOBUS_SUCCESS)
3700     {
3701 0         goto fault_exit;
3702     }
3703
3704
3705 22     result = xsd_int_init_contents(
3706         &addResponse);
3707 22     if(result != GLOBUS_SUCCESS)
3708     {
3709 0         goto fault_exit;
3710     }
3711
3712 22     result = invoke_function(
3713         callback_handle->engine,
3714         callback_handle->message,
3715         &CounterService_descriptor,
3716         add,
3717         &addResponse,
3718         &fault_type_name,
3719         &fault);
3720
3721 fault_exit:
3722
3723 22     if(fault && fault_type_name)
3724     {
3725 0         fault_type = add_lookup_fault_type(fault_type_name);
3726
3727 0         result = globus_service_session_begin_response(
3728             callback_handle->message);
3729 0         if(result != GLOBUS_SUCCESS)
3730         {
3731 0             goto exit;
3732         }
3733         
3734 0         soap_fault.faultcode = "Server";
3735 0         soap_fault.faultstring = 
3736         "An error occurred while processing the message";
3737 0         soap_fault.faultactor = NULL;
3738
3739 0         switch(fault_type)
3740         {
3741         
3742         default:
3743 0             result = CounterServiceErrorReturnedUnknownFault("add");
3744 0             goto exit;
3745         }         
3746
3747 22         result = globus_service_session_serialize_fault_response(
3748             callback_handle->message, &soap_fault);
3749 22         if(result != GLOBUS_SUCCESS)
3750         {
3751 22             goto exit;
3752         }
3753
3754 22         soap_fault.detail->element->local = NULL;
3755 22         soap_fault.detail->element->Namespace = NULL;
3756 22 soap_fault.detail->any_info = NULL;
3757 22         xsd_any_destroy(soap_fault.detail);
3758
3759 22         globus_soap_message_handle_set_attr(
3760             callback_handle->message, 
3761             WSADDR_ACTION_RESPONSE_KEY,
3762             globus_soap_message_attr_copy_string,
3763             globus_libc_free,
3764             WSADDRESSING_FAULT_NS);
3765     }
3766 22     else if(result != GLOBUS_SUCCESS)
3767     {
3768 1         globus_result_t                 local_result;
3769 1         local_result = globus_service_session_begin_response(
3770             callback_handle->message);
3771 1         if(local_result != GLOBUS_SUCCESS)
3772         {
3773 0             result = local_result;
3774 0             goto exit;
3775         }
3776
3777 1         soap_fault.faultcode = "Server";
3778 1         soap_fault.faultstring = globus_error_print_friendly(
3779             globus_error_get(result));
3780 1         result = GLOBUS_SUCCESS;
3781 1         soap_fault.faultactor = NULL;
3782 1         soap_fault.detail = NULL;
3783 1         result = globus_service_session_serialize_fault_response(
3784             callback_handle->message, &soap_fault);
3785 1         if(result != GLOBUS_SUCCESS)
3786         {
3787 0             goto exit;
3788         }
3789
3790 1         globus_soap_message_handle_set_attr(
3791             callback_handle->message, 
3792             WSADDR_ACTION_RESPONSE_KEY,
3793             globus_soap_message_attr_copy_string,
3794             globus_libc_free, 
3795             WSADDRESSING_FAULT_NS);
3796     }
3797     else
3798     {
3799 21         result = globus_service_session_begin_response(
3800             callback_handle->message);
3801 21         if(result != GLOBUS_SUCCESS)
3802         {
3803 0             goto exit;
3804         }
3805
3806 21         element_qname.local = "addResponse";
3807 21         element_qname.Namespace = "http://counter.com";
3808
3809 21         result = xsd_int_serialize(
3810             &element_qname,
3811             &addResponse,
3812             callback_handle->message,
3813             GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS);
3814 21         if(result != GLOBUS_SUCCESS)
3815         {
3816 0             goto exit;
3817         }
3818
3819 21         result = globus_service_session_end_response(
3820             callback_handle->message);
3821 21         if(result != GLOBUS_SUCCESS)
3822         {
3823 0             goto exit;
3824         }
3825
3826 21         xsd_int_destroy_contents(
3827             &addResponse);
3828
3829 21         globus_soap_message_handle_set_attr(
3830             callback_handle->message, 
3831             WSADDR_ACTION_RESPONSE_KEY,
3832             globus_soap_message_attr_copy_string,
3833             globus_libc_free, 
3834             "http://counter.com/CounterPortType/addResponse");
3835     }
3836
3837  exit:
3838
3839 22     callback_handle->callback(
3840         result,
3841         callback_handle->args);
3842
3843 22     globus_libc_free(callback_handle);
3844
3845 22     CounterServiceDebugExit();
3846 }
3847
3848 static
3849 globus_result_t
3850 add_invoke(
3851     globus_service_engine_t                 engine,
3852     globus_soap_message_handle_t            message,
3853     globus_service_response_t *             response,
3854     globus_operation_invoke_callback_func_t invoke_callback,
3855     void *                                  args)
3856 22 {
3857 22     add_callback_handle_t * callback_handle;
3858 22     globus_result_t                    result = GLOBUS_SUCCESS;
3859 22     GlobusFuncName(CounterPortType_add);
3860 22     CounterServiceDebugEnter();
3861
3862 22     callback_handle = malloc(sizeof(add_callback_handle_t));
3863 22     if(!callback_handle)
3864     {
3865 0         result = GlobusSoapMessageErrorOutOfMemory;
3866 0         goto exit;
3867     }
3868 22     callback_handle->engine = engine;
3869 22     callback_handle->message = message;
3870 22     callback_handle->callback = invoke_callback;
3871 22     callback_handle->args = args;
3872
3873 22     result = globus_callback_register_oneshot(
3874         NULL,
3875         &globus_i_reltime_zero,
3876         add_invoke_callback,
3877         callback_handle);
3878
3879  exit:
3880 22     CounterServiceDebugExit();
3881 22     return result;
3882 }
3883
3884
3885 static
3886 globus_result_t
3887 add_fault_to_type(
3888     const char *                            fault_type_name,
3889     int *                                   fault_type,
3890     globus_xsd_type_info_t *                fault_type_info)
3891 0 {
3892 0     globus_result_t                         result = GLOBUS_SUCCESS;
3893
3894 0     *fault_type_info = NULL;
3895
3896 0     *fault_type = add_lookup_fault_type(fault_type_name);
3897
3898 0     switch (*fault_type)
3899     {
3900         default:
3901 0             result = CounterServiceErrorReturnedUnknownFault("add");
3902 0             goto exit;
3903     }
3904
3905 exit:
3906 0     return result;
3907 }
3908
3909
3910 static
3911 globus_service_operation_descriptor_t 
3912 add_operation_descriptor =
3913 {
3914     add_deserialize,
3915     add_invoke,
3916
3917     add_fault_to_type
3918
3919 };
3920
3921 static
3922 globus_operation_provider_descriptor_t add_descriptor =
3923 {
3924     &CounterPortType_add_op_qname,
3925     "add",
3926     (void *)CounterPortType_add_impl,
3927     NULL
3928 };
3929
3930
3931 xsd_QName CounterPortType_createCounter_op_qname = 
3932 {
3933     "http://localhost:8080/wsrf/services/CounterService"
3934     "createCounter"
3935 };
3936
3937 xsd_QName CounterPortType_createCounter_input_qname =
3938 {
3939      "http://counter.com",
3940      "createCounter"
3941 };
3942
3943 typedef globus_result_t (* createCounter_invoke_func_t) (
3944     globus_service_engine_t             engine,
3945     globus_soap_message_handle_t        message,
3946     globus_service_descriptor_t *       descriptor,
3947     createCounterType * createCounter,
3948     createCounterResponseType * createCounterResponse,
3949     const char ** fault_type_name,
3950     void ** fault);
3951     
3952 typedef struct createCounter_callback_handle_s
3953 {
3954     globus_service_engine_t                 engine;
3955     globus_soap_message_handle_t            message;
3956     globus_operation_invoke_callback_func_t callback;
3957     void *                                  args;
3958 } createCounter_callback_handle_t;
3959
3960             
3961 const char * CounterPortType_createCounter_fault_strings[COUNTERPORTTYPE_CREATECOUNTER_UNKNOWN_FAULT] =
3962 {
3963     "Unknown"
3964
3965  };
3966
3967 static
3968 CounterPortType_createCounter_fault_t
3969 createCounter_lookup_fault_type(
3970     const char *                        fault_name)
3971 0 {
3972 0     CounterPortType_createCounter_fault_t fault_type;
3973 0     GlobusFuncName(createCounter_lookup_fault_type);
3974 0     CounterServiceDebugEnter();
3975
3976 0     globus_assert(fault_name);
3977
3978    
3979     {
3980 0         fault_type = COUNTERPORTTYPE_CREATECOUNTER_UNKNOWN_FAULT;
3981     }
3982
3983 0     CounterServiceDebugExit();
3984 0     return fault_type;
3985 }
3986
3987
3988     
3989 static
3990 void
3991 createCounter_deserialize_callback(
3992     void *                              handle)
3993 3 {
3994 3     createCounter_callback_handle_t * callback_handle;
3995 3     globus_result_t                     result = GLOBUS_SUCCESS;
3996 3     struct globus_soap_message_fault_s  soap_fault;
3997 3     createCounter_invoke_func_t  invoke_function;
3998 3     createCounterType * createCounter = NULL;
3999 3     GlobusFuncName(createCounter_deserialize_callback);
4000 3     CounterServiceDebugEnter();
4001
4002 3     callback_handle = (createCounter_callback_handle_t *) handle;
4003
4004 3     result = globus_operation_table_get_operation(
4005         CounterService_descriptor.operations,
4006         "createCounter",
4007         (void **)&invoke_function);
4008 3     if(result != GLOBUS_SUCCESS)
4009     {
4010 0         goto exit;
4011     }
4012
4013 3     if(CounterService_descriptor.registry)
4014     {
4015 3         globus_soap_message_handle_set_registry(
4016             callback_handle->message,
4017             CounterService_descriptor.registry);
4018     }
4019
4020 3     result = createCounterType_init(
4021         &createCounter);
4022 3     if(result != GLOBUS_SUCCESS)
4023     {
4024 0         goto exit;
4025     }
4026
4027 3     result = createCounterType_deserialize(
4028         &CounterPortType_createCounter_input_qname,
4029         createCounter,
4030         callback_handle->message,
4031         0);
4032 3     if(result != GLOBUS_SUCCESS)
4033     {
4034 0         goto exit;
4035     }
4036
4037 3     result = globus_soap_message_handle_set_attr(
4038         callback_handle->message,
4039         "createCounterOperationInputParameter",
4040         createCounterType_copy_wrapper,
4041         createCounterType_destroy_wrapper,
4042         (void *)createCounter);
4043 3     if(result != GLOBUS_SUCCESS)
4044     {
4045 3         goto exit;
4046     }
4047
4048  exit:
4049
4050 3     if (createCounter != NULL)
4051     {
4052 3         createCounterType_destroy(createCounter);
4053     }
4054 3     callback_handle->callback(
4055         result,
4056         callback_handle->args);
4057
4058 3     free(callback_handle);
4059 3     CounterServiceDebugExit();
4060 }
4061
4062 static
4063 globus_result_t
4064 createCounter_deserialize(
4065     globus_service_engine_t                 engine,
4066     globus_soap_message_handle_t            message,
4067     globus_operation_invoke_callback_func_t invoke_callback,
4068     void *                                  args)
4069 3 {
4070 3     createCounter_callback_handle_t * callback_handle;
4071 3     globus_result_t                    result = GLOBUS_SUCCESS;
4072 3     GlobusFuncName(createCounter_deserialize);
4073 3     CounterServiceDebugEnter();
4074
4075 3     callback_handle = malloc(sizeof(createCounter_callback_handle_t));
4076 3     globus_assert_string(callback_handle, 
4077                          "Memory allocation failed "
4078                          "for createCounter callback handle");
4079
4080 3     callback_handle->engine = engine;
4081 3     callback_handle->message = message;
4082 3     callback_handle->callback = invoke_callback;
4083 3     callback_handle->args = args;
4084
4085 3     result = globus_callback_register_oneshot(
4086         NULL,
4087         &globus_i_reltime_zero,
4088         createCounter_deserialize_callback,
4089         callback_handle);
4090
4091 3     CounterServiceDebugExit();
4092 3     return result;
4093 }
4094
4095 static
4096 void
4097 createCounter_invoke_callback(
4098     void *                              handle)
4099 3 {
4100 3     createCounter_callback_handle_t * callback_handle;
4101 3     globus_result_t                     result = GLOBUS_SUCCESS;
4102 3     struct globus_soap_message_fault_s  soap_fault;
4103 3     createCounter_invoke_func_t  invoke_function;
4104 3     createCounterType * createCounter;
4105 3     createCounterResponseType createCounterResponse;
4106 3      xsd_QName element_qname;
4107 3      const char * fault_type_name = NULL;
4108 3      CounterPortType_createCounter_fault_t fault_type = COUNTERPORTTYPE_CREATECOUNTER_NOFAULT;
4109 3      void *                              fault = NULL;
4110     
4111 3     GlobusFuncName(createCounter_invoke_callback);
4112 3     CounterServiceDebugEnter();
4113
4114 3     callback_handle = (createCounter_callback_handle_t *) handle;
4115
4116 3     createCounter = globus_soap_message_handle_get_attr(
4117         callback_handle->message,
4118         "createCounterOperationInputParameter");
4119 3     globus_assert(createCounter);
4120
4121 3     result = globus_operation_table_get_operation(
4122         CounterService_descriptor.operations,
4123         "createCounter",
4124         (void **)&invoke_function);
4125 3     if(result != GLOBUS_SUCCESS)
4126     {
4127 0         goto fault_exit;
4128     }
4129
4130
4131 3     result = createCounterResponseType_init_contents(
4132         &createCounterResponse);
4133 3     if(result != GLOBUS_SUCCESS)
4134     {
4135 0         goto fault_exit;
4136     }
4137
4138 3     result = invoke_function(
4139         callback_handle->engine,
4140         callback_handle->message,
4141         &CounterService_descriptor,
4142         createCounter,
4143         &createCounterResponse,
4144         &fault_type_name,
4145         &fault);
4146
4147 fault_exit:
4148
4149 3     if(fault && fault_type_name)
4150     {
4151 0         fault_type = createCounter_lookup_fault_type(fault_type_name);
4152
4153 0         result = globus_service_session_begin_response(
4154             callback_handle->message);
4155 0         if(result != GLOBUS_SUCCESS)
4156         {
4157 0             goto exit;
4158         }
4159         
4160 0         soap_fault.faultcode = "Server";
4161 0         soap_fault.faultstring = 
4162         "An error occurred while processing the message";
4163 0         soap_fault.faultactor = NULL;
4164
4165 0         switch(fault_type)
4166         {
4167         
4168         default:
4169 0             result = CounterServiceErrorReturnedUnknownFault("createCounter");
4170 0             goto exit;
4171         }         
4172
4173 3         result = globus_service_session_serialize_fault_response(
4174             callback_handle->message, &soap_fault);
4175 3         if(result != GLOBUS_SUCCESS)
4176         {
4177 3             goto exit;
4178         }
4179
4180 3         soap_fault.detail->element->local = NULL;
4181 3         soap_fault.detail->element->Namespace = NULL;
4182 3 soap_fault.detail->any_info = NULL;
4183 3         xsd_any_destroy(soap_fault.detail);
4184
4185 3         globus_soap_message_handle_set_attr(
4186             callback_handle->message, 
4187             WSADDR_ACTION_RESPONSE_KEY,
4188             globus_soap_message_attr_copy_string,
4189             globus_libc_free,
4190             WSADDRESSING_FAULT_NS);
4191     }
4192 3     else if(result != GLOBUS_SUCCESS)
4193     {
4194 0         globus_result_t                 local_result;
4195 0         local_result = globus_service_session_begin_response(
4196             callback_handle->message);
4197 0         if(local_result != GLOBUS_SUCCESS)
4198         {
4199 0             result = local_result;
4200 0             goto exit;
4201         }
4202
4203 0         soap_fault.faultcode = "Server";
4204 0         soap_fault.faultstring = globus_error_print_friendly(
4205             globus_error_get(result));
4206 0         result = GLOBUS_SUCCESS;
4207 0         soap_fault.faultactor = NULL;
4208 0         soap_fault.detail = NULL;
4209 0         result = globus_service_session_serialize_fault_response(
4210             callback_handle->message, &soap_fault);
4211 0         if(result != GLOBUS_SUCCESS)
4212         {
4213 0             goto exit;
4214         }
4215
4216 0         globus_soap_message_handle_set_attr(
4217             callback_handle->message, 
4218             WSADDR_ACTION_RESPONSE_KEY,
4219             globus_soap_message_attr_copy_string,
4220             globus_libc_free, 
4221             WSADDRESSING_FAULT_NS);
4222     }
4223     else
4224     {
4225 3         result = globus_service_session_begin_response(
4226             callback_handle->message);
4227 3         if(result != GLOBUS_SUCCESS)
4228         {
4229 0             goto exit;
4230         }
4231
4232 3         element_qname.local = "createCounterResponse";
4233 3         element_qname.Namespace = "http://counter.com";
4234
4235 3         result = createCounterResponseType_serialize(
4236             &element_qname,
4237             &createCounterResponse,
4238             callback_handle->message,
4239             GLOBUS_XSD_ELEMENT_SET_DEFAULT_NS);
4240 3         if(result != GLOBUS_SUCCESS)
4241         {
4242 0             goto exit;
4243         }
4244
4245 3         result = globus_service_session_end_response(
4246             callback_handle->message);
4247 3         if(result != GLOBUS_SUCCESS)
4248         {
4249 0             goto exit;
4250         }
4251
4252 3         createCounterResponseType_destroy_contents(
4253             &createCounterResponse);
4254
4255 3         globus_soap_message_handle_set_attr(
4256             callback_handle->message, 
4257             WSADDR_ACTION_RESPONSE_KEY,
4258             globus_soap_message_attr_copy_string,
4259             globus_libc_free, 
4260             "http://counter.com/CounterPortType/createCounterResponse");
4261     }
4262
4263  exit:
4264
4265 3     callback_handle->callback(
4266         result,
4267         callback_handle->args);
4268
4269 3     globus_libc_free(callback_handle);
4270
4271 3     CounterServiceDebugExit();
4272 }
4273
4274 static
4275 globus_result_t
4276 createCounter_invoke(
4277     globus_service_engine_t                 engine,
4278     globus_soap_message_handle_t            message,
4279     globus_service_response_t *             response,
4280     globus_operation_invoke_callback_func_t invoke_callback,
4281     void *                                  args)
4282 3 {
4283 3     createCounter_callback_handle_t * callback_handle;
4284 3     globus_result_t                    result = GLOBUS_SUCCESS;
4285 3     GlobusFuncName(CounterPortType_createCounter);
4286 3     CounterServiceDebugEnter();
4287
4288 3     callback_handle = malloc(sizeof(createCounter_callback_handle_t));
4289 3     if(!callback_handle)
4290     {
4291 0         result = GlobusSoapMessageErrorOutOfMemory;
4292 0         goto exit;
4293     }
4294 3     callback_handle->engine = engine;
4295 3     callback_handle->message = message;
4296 3     callback_handle->callback = invoke_callback;
4297 3     callback_handle->args = args;
4298
4299 3     result = globus_callback_register_oneshot(
4300         NULL,
4301         &globus_i_reltime_zero,
4302         createCounter_invoke_callback,
4303         callback_handle);
4304
4305  exit:
4306 3     CounterServiceDebugExit();
4307 3     return result;
4308 }
4309
4310
4311 static
4312 globus_result_t
4313 createCounter_fault_to_type(
4314     const char *                            fault_type_name,
4315     int *                                   fault_type,
4316     globus_xsd_type_info_t *                fault_type_info)
4317 0 {
4318 0     globus_result_t                         result = GLOBUS_SUCCESS;
4319
4320 0     *fault_type_info = NULL;
4321
4322 0     *fault_type = createCounter_lookup_fault_type(fault_type_name);
4323
4324 0     switch (*fault_type)
4325     {
4326         default:
4327 0             result = CounterServiceErrorReturnedUnknownFault("createCounter");
4328 0             goto exit;
4329     }
4330
4331 exit:
4332 0     return result;
4333 }
4334
4335
4336 static
4337 globus_service_operation_descriptor_t 
4338 createCounter_operation_descriptor =
4339 {
4340     createCounter_deserialize,
4341     createCounter_invoke,
4342
4343     createCounter_fault_to_type
4344
4345 };
4346
4347 static
4348 globus_operation_provider_descriptor_t createCounter_descriptor =
4349 {
4350     &CounterPortType_createCounter_op_qname,
4351     "createCounter",
4352     (void *)CounterPortType_createCounter_impl,
4353     NULL
4354 };
4355
4356
4357
4358 static xsd_QName CounterService_l_wsrp_GetResourceProperty_qname;
4359 static xsd_QName CounterService_l_wsrp_GetMultipleResourceProperties_qname;
4360 static xsd_QName CounterService_l_wsrp_SetResourceProperties_qname;
4361 static xsd_QName CounterService_l_wsrp_QueryResourceProperties_qname;
4362 static xsd_QName CounterService_l_wsrl_Destroy_qname;
4363 static xsd_QName CounterService_l_wsrl_SetTerminationTime_qname;
4364 static xsd_QName CounterService_l_wsnt_Subscribe_qname;
4365 static xsd_QName CounterService_l_wsnt_GetCurrentMessage_qname;
4366
4367 static
4368 int
4369 CounterService_activate()
4370 3 {
4371 3     globus_result_t                     result = GLOBUS_SUCCESS;
4372 3     int                                 rc = 0;
4373 3     GlobusFuncName(CounterService_activate);
4374
4375 3     rc = globus_module_activate(GLOBUS_COMMON_MODULE);
4376 3     if(rc != GLOBUS_SUCCESS)
4377     {
4378 0         return rc;
4379     }
4380
4381 3     GlobusDebugInit(COUNTERSERVICE, INFO DEBUG TRACE WARN ERROR);
4382
4383 3     rc = globus_module_activate(GLOBUS_SOAP_MESSAGE_MODULE);
4384 3     if(rc != GLOBUS_SUCCESS)
4385     {
4386 0         return rc;
4387     }
4388
4389 3     CounterServiceDebugEnter();
4390
4391 3     result = globus_module_activate(GLOBUS_WSRF_RESOURCE_MODULE);
4392 3     if (result != GLOBUS_SUCCESS)
4393     {
4394 0         rc = (int) result;
4395 0         goto exit;
4396     }
4397
4398 3     rc = globus_extension_activate(
4399         "globus_wsrp_GetResourceProperty_provider");
4400 3     if(rc != GLOBUS_SUCCESS)
4401     {
4402 0         goto deactivate_resource_out;
4403     }
4404
4405 3     rc = globus_extension_activate(
4406             "globus_wsrp_GetMultipleResourceProperties_provider");
4407 3     if (rc != GLOBUS_SUCCESS)
4408     {
4409 0         goto deactivate_getrp;
4410     }
4411
4412 3     rc = globus_extension_activate(
4413             "globus_wsrp_SetResourceProperties_provider");
4414 3     if (rc != GLOBUS_SUCCESS)
4415     {
4416 0         goto deactivate_getmrp;
4417     }
4418
4419 3     rc = globus_extension_activate(
4420             "globus_wsrp_QueryResourceProperties_provider");
4421 3     if (rc != GLOBUS_SUCCESS)
4422     {
4423 0         goto deactivate_setrp;
4424     }
4425
4426 3     rc = globus_extension_activate(
4427             "globus_wsrl_ImmediateResourceTermination_provider");
4428 3     if (rc != GLOBUS_SUCCESS)
4429     {
4430 0         goto deactivate_queryrp;
4431     }
4432
4433 3     rc = globus_extension_activate(
4434             "globus_wsrl_ScheduledResourceTermination_provider");
4435 3     if (rc != GLOBUS_SUCCESS)
4436     {
4437 0         goto deactivate_irt;
4438     }
4439
4440 3     rc = globus_extension_activate(
4441             "globus_wsnt_NotificationProducer_provider");
4442 3     if (rc != GLOBUS_SUCCESS)
4443     {
4444 0         goto deactivate_srt;
4445     }
4446
4447 3     if(GLOBUS_GLOBAL_TYPE_REGISTRY != NULL)
4448     {
4449 3         result = CounterService_registry_add_types(
4450             GLOBUS_GLOBAL_TYPE_REGISTRY);
4451 3         if(result != GLOBUS_SUCCESS)
4452         {
4453 0             rc = (int) result;
4454 0             goto deactivate_nrt;
4455         }
4456     }
4457
4458 3     rc = globus_hashtable_init(
4459         &CounterService_descriptor.op_mapper, 
4460         10, 
4461         xsd_QName_hash, 
4462         xsd_QName_keyeq);
4463 3     if(rc != GLOBUS_SUCCESS)
4464     {
4465 0         goto clear_global_registry;
4466     }
4467
4468 3     result = globus_xsd_type_registry_init(
4469         &CounterService_descriptor.registry);
4470 3     if(result != GLOBUS_SUCCESS)
4471     {
4472 0         rc = (int) result;
4473 0         goto destroy_op_mapper;
4474     }
4475
4476 3     result = CounterService_registry_add_types(
4477         CounterService_descriptor.registry);
4478 3     if(result != GLOBUS_SUCCESS)
4479     {
4480 0         rc = (int) result;
4481 0         goto destroy_service_registry;
4482     }
4483
4484 3     globus_mutex_init(&CounterService_descriptor.mutex, NULL);
4485
4486 3     rc = globus_hashtable_insert(
4487         &CounterService_descriptor.op_mapper,
4488         (void *)&CounterPortType_GetCurrentMessage_input_qname,
4489         (void *)&GetCurrentMessage_operation_descriptor);
4490 3     if(rc != GLOBUS_SUCCESS)
4491     {
4492 0         goto remove_GetCurrentMessage_op;
4493     }
4494
4495 3     rc = globus_hashtable_insert(
4496         &CounterService_descriptor.op_mapper,
4497         (void *)&CounterPortType_Subscribe_input_qname,
4498         (void *)&Subscribe_operation_descriptor);
4499 3     if(rc != GLOBUS_SUCCESS)
4500     {
4501 0         goto remove_Subscribe_op;
4502     }
4503
4504 3     rc = globus_hashtable_insert(
4505         &CounterService_descriptor.op_mapper,
4506         (void *)&CounterPortType_GetResourceProperty_input_qname,
4507         (void *)&GetResourceProperty_operation_descriptor);
4508 3     if(rc != GLOBUS_SUCCESS)
4509     {
4510 0         goto remove_GetResourceProperty_op;
4511     }
4512
4513 3     rc = globus_hashtable_insert(
4514         &CounterService_descriptor.op_mapper,
4515         (void *)&CounterPortType_GetMultipleResourceProperties_input_qname,
4516         (void *)&GetMultipleResourceProperties_operation_descriptor);
4517 3     if(rc != GLOBUS_SUCCESS)
4518     {
4519 0         goto remove_GetMultipleResourceProperties_op;
4520     }
4521
4522 3     rc = globus_hashtable_insert(
4523         &CounterService_descriptor.op_mapper,
4524         (void *)&CounterPortType_QueryResourceProperties_input_qname,
4525         (void *)&QueryResourceProperties_operation_descriptor);
4526 3     if(rc != GLOBUS_SUCCESS)
4527     {
4528 0         goto remove_QueryResourceProperties_op;
4529     }
4530
4531 3     rc = globus_hashtable_insert(
4532         &CounterService_descriptor.op_mapper,
4533         (void *)&CounterPortType_Destroy_input_qname,
4534         (void *)&Destroy_operation_descriptor);
4535 3     if(rc != GLOBUS_SUCCESS)
4536     {
4537 0         goto remove_Destroy_op;
4538     }
4539
4540 3     rc = globus_hashtable_insert(
4541         &CounterService_descriptor.op_mapper,
4542         (void *)&CounterPortType_SetTerminationTime_input_qname,
4543         (void *)&SetTerminationTime_operation_descriptor);
4544 3     if(rc != GLOBUS_SUCCESS)
4545     {
4546 0         goto remove_SetTerminationTime_op;
4547     }
4548
4549 3     rc = globus_hashtable_insert(
4550         &CounterService_descriptor.op_mapper,
4551         (void *)&CounterPortType_add_input_qname,
4552         (void *)&add_operation_descriptor);
4553 3     if(rc != GLOBUS_SUCCESS)
4554     {
4555 0         goto remove_add_op;
4556     }
4557
4558 3     rc = globus_hashtable_insert(
4559         &CounterService_descriptor.op_mapper,
4560         (void *)&CounterPortType_createCounter_input_qname,
4561         (void *)&createCounter_operation_descriptor);
4562 3     if(rc != GLOBUS_SUCCESS)
4563     {
4564 0         goto remove_createCounter_op;
4565     }
4566
4567
4568 3     result = globus_operation_table_init(
4569         &CounterService_descriptor.operations,
4570         CounterService_service_qname.Namespace);
4571 3     if(result != GLOBUS_SUCCESS)
4572     {
4573 0         rc = (int) result;
4574 0         goto remove_all_ops;
4575     }
4576
4577
4578 3     result = globus_extension_registry_add(
4579         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4580         (void *)&CounterPortType_GetCurrentMessage_op_qname,
4581         GlobusExtensionMyModule(CounterService),
4582         (void *)&GetCurrentMessage_descriptor);
4583 3     if(result != GLOBUS_SUCCESS)
4584     {
4585 0         rc = (int) result;
4586 0         goto remove_GetCurrentMessage_op_provider;
4587     }
4588
4589 3     result = globus_operation_table_add_default_provider(
4590         CounterService_descriptor.operations,
4591         &CounterPortType_GetCurrentMessage_op_qname,
4592         &GetCurrentMessage_descriptor);
4593 3     if(result != GLOBUS_SUCCESS)
4594     {
4595 0         rc = (int) result;
4596 0         goto remove_GetCurrentMessage_op_provider;
4597     }
4598
4599 3     result = globus_extension_registry_add(
4600         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4601         (void *)&CounterPortType_Subscribe_op_qname,
4602         GlobusExtensionMyModule(CounterService),
4603         (void *)&Subscribe_descriptor);
4604 3     if(result != GLOBUS_SUCCESS)
4605     {
4606 0         rc = (int) result;
4607 0         goto remove_Subscribe_op_provider;
4608     }
4609
4610 3     result = globus_operation_table_add_default_provider(
4611         CounterService_descriptor.operations,
4612         &CounterPortType_Subscribe_op_qname,
4613         &Subscribe_descriptor);
4614 3     if(result != GLOBUS_SUCCESS)
4615     {
4616 0         rc = (int) result;
4617 0         goto remove_Subscribe_op_provider;
4618     }
4619
4620 3     result = globus_extension_registry_add(
4621         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4622         (void *)&CounterPortType_GetResourceProperty_op_qname,
4623         GlobusExtensionMyModule(CounterService),
4624         (void *)&GetResourceProperty_descriptor);
4625 3     if(result != GLOBUS_SUCCESS)
4626     {
4627 0         rc = (int) result;
4628 0         goto remove_GetResourceProperty_op_provider;
4629     }
4630
4631 3     result = globus_operation_table_add_default_provider(
4632         CounterService_descriptor.operations,
4633         &CounterPortType_GetResourceProperty_op_qname,
4634         &GetResourceProperty_descriptor);
4635 3     if(result != GLOBUS_SUCCESS)
4636     {
4637 0         rc = (int) result;
4638 0         goto remove_GetResourceProperty_op_provider;
4639     }
4640
4641 3     result = globus_extension_registry_add(
4642         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4643         (void *)&CounterPortType_GetMultipleResourceProperties_op_qname,
4644         GlobusExtensionMyModule(CounterService),
4645         (void *)&GetMultipleResourceProperties_descriptor);
4646 3     if(result != GLOBUS_SUCCESS)
4647     {
4648 0         rc = (int) result;
4649 0         goto remove_GetMultipleResourceProperties_op_provider;
4650     }
4651
4652 3     result = globus_operation_table_add_default_provider(
4653         CounterService_descriptor.operations,
4654         &CounterPortType_GetMultipleResourceProperties_op_qname,
4655         &GetMultipleResourceProperties_descriptor);
4656 3     if(result != GLOBUS_SUCCESS)
4657     {
4658 0         rc = (int) result;
4659 0         goto remove_GetMultipleResourceProperties_op_provider;
4660     }
4661
4662 3     result = globus_extension_registry_add(
4663         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4664         (void *)&CounterPortType_QueryResourceProperties_op_qname,
4665         GlobusExtensionMyModule(CounterService),
4666         (void *)&QueryResourceProperties_descriptor);
4667 3     if(result != GLOBUS_SUCCESS)
4668     {
4669 0         rc = (int) result;
4670 0         goto remove_QueryResourceProperties_op_provider;
4671     }
4672
4673 3     result = globus_operation_table_add_default_provider(
4674         CounterService_descriptor.operations,
4675         &CounterPortType_QueryResourceProperties_op_qname,
4676         &QueryResourceProperties_descriptor);
4677 3     if(result != GLOBUS_SUCCESS)
4678     {
4679 0         rc = (int) result;
4680 0         goto remove_QueryResourceProperties_op_provider;
4681     }
4682
4683 3     result = globus_extension_registry_add(
4684         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4685         (void *)&CounterPortType_Destroy_op_qname,
4686         GlobusExtensionMyModule(CounterService),
4687         (void *)&Destroy_descriptor);
4688 3     if(result != GLOBUS_SUCCESS)
4689     {
4690 0         rc = (int) result;
4691 0         goto remove_Destroy_op_provider;
4692     }
4693
4694 3     result = globus_operation_table_add_default_provider(
4695         CounterService_descriptor.operations,
4696         &CounterPortType_Destroy_op_qname,
4697         &Destroy_descriptor);
4698 3     if(result != GLOBUS_SUCCESS)
4699     {
4700 0         rc = (int) result;
4701 0         goto remove_Destroy_op_provider;
4702     }
4703
4704 3     result = globus_extension_registry_add(
4705         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4706         (void *)&CounterPortType_SetTerminationTime_op_qname,
4707         GlobusExtensionMyModule(CounterService),
4708         (void *)&SetTerminationTime_descriptor);
4709 3     if(result != GLOBUS_SUCCESS)
4710     {
4711 0         rc = (int) result;
4712 0         goto remove_SetTerminationTime_op_provider;
4713     }
4714
4715 3     result = globus_operation_table_add_default_provider(
4716         CounterService_descriptor.operations,
4717         &CounterPortType_SetTerminationTime_op_qname,
4718         &SetTerminationTime_descriptor);
4719 3     if(result != GLOBUS_SUCCESS)
4720     {
4721 0         rc = (int) result;
4722 0         goto remove_SetTerminationTime_op_provider;
4723     }
4724
4725 3     result = globus_extension_registry_add(
4726         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4727         (void *)&CounterPortType_add_op_qname,
4728         GlobusExtensionMyModule(CounterService),
4729         (void *)&add_descriptor);
4730 3     if(result != GLOBUS_SUCCESS)
4731     {
4732 0         rc = (int) result;
4733 0         goto remove_add_op_provider;
4734     }
4735
4736 3     result = globus_operation_table_add_default_provider(
4737         CounterService_descriptor.operations,
4738         &CounterPortType_add_op_qname,
4739         &add_descriptor);
4740 3     if(result != GLOBUS_SUCCESS)
4741     {
4742 0         rc = (int) result;
4743 0         goto remove_add_op_provider;
4744     }
4745
4746 3     result = globus_extension_registry_add(
4747         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4748         (void *)&CounterPortType_createCounter_op_qname,
4749         GlobusExtensionMyModule(CounterService),
4750         (void *)&createCounter_descriptor);
4751 3     if(result != GLOBUS_SUCCESS)
4752     {
4753 0         rc = (int) result;
4754 0         goto remove_createCounter_op_provider;
4755     }
4756
4757 3     result = globus_operation_table_add_default_provider(
4758         CounterService_descriptor.operations,
4759         &CounterPortType_createCounter_op_qname,
4760         &createCounter_descriptor);
4761 3     if(result != GLOBUS_SUCCESS)
4762     {
4763 0         rc = (int) result;
4764 0         goto remove_createCounter_op_provider;
4765     }
4766
4767 3     result = globus_operation_table_add_provider(
4768         CounterService_descriptor.operations,
4769         &CounterService_l_wsrp_GetResourceProperty_qname);
4770 3     if (result != GLOBUS_SUCCESS)
4771     {
4772 0         rc = (int) result;
4773 0         goto remove_op_providers;
4774     }
4775
4776 3     result = globus_operation_table_add_provider(
4777         CounterService_descriptor.operations,
4778         &CounterService_l_wsrp_GetMultipleResourceProperties_qname);
4779 3     if (result != GLOBUS_SUCCESS)
4780     {
4781 0         rc = (int) result;
4782
4783 0         goto remove_op_providers;
4784     }
4785
4786 3     result = globus_operation_table_add_provider(
4787         CounterService_descriptor.operations,
4788         &CounterService_l_wsrp_SetResourceProperties_qname);
4789 3     if (result != GLOBUS_SUCCESS)
4790     {
4791 0         rc = (int) result;
4792
4793 0         goto remove_op_providers;
4794     }
4795
4796 3     result = globus_operation_table_add_provider(
4797         CounterService_descriptor.operations,
4798         &CounterService_l_wsrp_QueryResourceProperties_qname);
4799 3     if (result != GLOBUS_SUCCESS)
4800     {
4801 0         rc = (int) result;
4802
4803 0         goto remove_op_providers;
4804     }
4805
4806 3     result = globus_operation_table_add_provider(
4807         CounterService_descriptor.operations,
4808         &CounterService_l_wsrl_Destroy_qname);
4809 3     if (result != GLOBUS_SUCCESS)
4810     {
4811 0         rc = (int) result;
4812
4813 0         goto remove_op_providers;
4814     }
4815
4816 3     result = globus_operation_table_add_provider(
4817         CounterService_descriptor.operations,
4818         &CounterService_l_wsrl_SetTerminationTime_qname);
4819 3     if (result != GLOBUS_SUCCESS)
4820     {
4821 0         rc = (int) result;
4822
4823 0         goto remove_op_providers;
4824     }
4825
4826 3     result = globus_operation_table_add_provider(
4827         CounterService_descriptor.operations,
4828         &CounterService_l_wsnt_Subscribe_qname);
4829 3     if (result != GLOBUS_SUCCESS)
4830     {
4831 0         rc = (int) result;
4832
4833 0         goto remove_op_providers;
4834     }
4835
4836 3     result = globus_operation_table_add_provider(
4837         CounterService_descriptor.operations,
4838         &CounterService_l_wsnt_GetCurrentMessage_qname);
4839 3     if (result != GLOBUS_SUCCESS)
4840     {
4841 0         rc = (int) result;
4842
4843 0         goto remove_op_providers;
4844     }
4845
4846 3     rc = globus_extension_registry_add(
4847         GLOBUS_SERVICE_REGISTRY,
4848         (void *)CounterService_descriptor.path,
4849         GlobusExtensionMyModule(CounterService),
4850         &CounterService_descriptor);
4851 3     if(rc != GLOBUS_SUCCESS)
4852     {
4853 0         goto remove_op_providers;
4854     }
4855
4856 3     result = CounterService_init(&CounterService_descriptor);
4857 3     if(result != GLOBUS_SUCCESS)
4858     {
4859 0         rc = (int) result;
4860         goto service_extension_remove;
4861     }
4862
4863 0     goto exit;
4864
4865 service_extension_remove:
4866 0     globus_extension_registry_remove(
4867         GLOBUS_SERVICE_REGISTRY,
4868         (void *)CounterService_descriptor.path);
4869 remove_op_providers:
4870
4871 0     globus_extension_registry_remove(
4872         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4873         (void *)&CounterPortType_GetCurrentMessage_op_qname);
4874 remove_GetCurrentMessage_op_provider:
4875
4876 0     globus_extension_registry_remove(
4877         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4878         (void *)&CounterPortType_Subscribe_op_qname);
4879 remove_Subscribe_op_provider:
4880
4881 0     globus_extension_registry_remove(
4882         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4883         (void *)&CounterPortType_GetResourceProperty_op_qname);
4884 remove_GetResourceProperty_op_provider:
4885
4886 0     globus_extension_registry_remove(
4887         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4888         (void *)&CounterPortType_GetMultipleResourceProperties_op_qname);
4889 remove_GetMultipleResourceProperties_op_provider:
4890
4891 0     globus_extension_registry_remove(
4892         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4893         (void *)&CounterPortType_QueryResourceProperties_op_qname);
4894 remove_QueryResourceProperties_op_provider:
4895
4896 0     globus_extension_registry_remove(
4897         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4898         (void *)&CounterPortType_Destroy_op_qname);
4899 remove_Destroy_op_provider:
4900
4901 0     globus_extension_registry_remove(
4902         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4903         (void *)&CounterPortType_SetTerminationTime_op_qname);
4904 remove_SetTerminationTime_op_provider:
4905
4906 0     globus_extension_registry_remove(
4907         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4908         (void *)&CounterPortType_add_op_qname);
4909 remove_add_op_provider:
4910
4911 0     globus_extension_registry_remove(
4912         GLOBUS_OPERATION_PROVIDER_REGISTRY,
4913         (void *)&CounterPortType_createCounter_op_qname);
4914 remove_createCounter_op_provider:
4915
4916 destroy_op_table:
4917 0     globus_operation_table_destroy(CounterService_descriptor.operations);
4918 remove_all_ops:
4919
4920 0     globus_hashtable_remove(
4921         &CounterService_descriptor.op_mapper,
4922         (void *)&CounterPortType_GetCurrentMessage_input_qname);
4923 remove_GetCurrentMessage_op:
4924
4925 0     globus_hashtable_remove(
4926         &CounterService_descriptor.op_mapper,
4927         (void *)&CounterPortType_Subscribe_input_qname);
4928 remove_Subscribe_op:
4929
4930 0     globus_hashtable_remove(
4931         &CounterService_descriptor.op_mapper,
4932         (void *)&CounterPortType_GetResourceProperty_input_qname);
4933 remove_GetResourceProperty_op:
4934
4935 0     globus_hashtable_remove(
4936         &CounterService_descriptor.op_mapper,
4937         (void *)&CounterPortType_GetMultipleResourceProperties_input_qname);
4938 remove_GetMultipleResourceProperties_op:
4939
4940 0     globus_hashtable_remove(
4941         &CounterService_descriptor.op_mapper,
4942         (void *)&CounterPortType_QueryResourceProperties_input_qname);
4943 remove_QueryResourceProperties_op:
4944
4945 0     globus_hashtable_remove(
4946         &CounterService_descriptor.op_mapper,
4947         (void *)&CounterPortType_Destroy_input_qname);
4948 remove_Destroy_op:
4949
4950 0     globus_hashtable_remove(
4951         &CounterService_descriptor.op_mapper,
4952         (void *)&CounterPortType_SetTerminationTime_input_qname);
4953 remove_SetTerminationTime_op:
4954
4955 0     globus_hashtable_remove(
4956         &CounterService_descriptor.op_mapper,
4957         (void *)&CounterPortType_add_input_qname);
4958 remove_add_op:
4959
4960 0     globus_hashtable_remove(
4961         &CounterService_descriptor.op_mapper,
4962         (void *)&CounterPortType_createCounter_input_qname);
4963 remove_createCounter_op:
4964
4965 destroy_mutex:
4966 0     globus_mutex_destroy(&CounterService_descriptor.mutex);
4967 clear_service_registry:
4968 0     CounterService_registry_remove_types(
4969         CounterService_descriptor.registry);
4970 destroy_service_registry:
4971 0     globus_xsd_type_registry_destroy(CounterService_descriptor.registry);
4972 destroy_op_mapper:
4973 0     globus_hashtable_destroy(&CounterService_descriptor.op_mapper);
4974 clear_global_registry:
4975 0     if(GLOBUS_GLOBAL_TYPE_REGISTRY != NULL)
4976     {
4977 0         CounterService_registry_remove_types(
4978             GLOBUS_GLOBAL_TYPE_REGISTRY);
4979     }
4980 deactivate_nrt:
4981 0     globus_extension_deactivate(
4982             "globus_wsnt_NotificationProducer_provider");
4983 deactivate_srt:
4984 0     globus_extension_deactivate(
4985             "globus_wsrl_ScheduledResourceTermination_provider");
4986 deactivate_irt:
4987 0     globus_extension_deactivate(
4988             "globus_wsrl_ImmediateResourceTermination_provider");
4989 deactivate_queryrp:
4990 0     globus_extension_deactivate(
4991             "globus_wsrp_QueryResourceProperties_provider");
4992 deactivate_setrp:
4993 0     globus_extension_deactivate("globus_wsrp_SetResourceProperties_provider");
4994 deactivate_getmrp:
4995 0     globus_extension_deactivate("globus_wsrp_GetMultipleResourceProperties_provider");
4996 deactivate_getrp:
4997 0     globus_extension_deactivate("globus_wsrp_GetResourceProperty_provider");
4998 deactivate_resource_out:
4999 0     globus_module_deactivate(GLOBUS_WSRF_RESOURCE_MODULE);
5000
5001  exit:
5002 3     CounterServiceDebugExit();
5003 3     return rc;
5004 }
5005
5006 static
5007 int
5008 CounterService_deactivate()
5009 0 {
5010 0     globus_result_t                     result = GLOBUS_SUCCESS;
5011 0     int                                 rc = 0;
5012
5013 0     result = CounterService_finalize(&CounterService_descriptor);
5014 0     if(result != GLOBUS_SUCCESS)
5015     {
5016 0         return GLOBUS_FAILURE;
5017     }
5018
5019 0     globus_extension_registry_remove(
5020         GLOBUS_SERVICE_REGISTRY,
5021         (void *)CounterService_descriptor.path);
5022
5023 0     globus_extension_registry_remove(
5024         GLOBUS_OPERATION_PROVIDER_REGISTRY,
5025         (void *)&CounterPortType_GetCurrentMessage_op_qname);
5026
5027 0     globus_extension_registry_remove(
5028         GLOBUS_OPERATION_PROVIDER_REGISTRY,
5029         (void *)&CounterPortType_Subscribe_op_qname);
5030
5031 0     globus_extension_registry_remove(
5032         GLOBUS_OPERATION_PROVIDER_REGISTRY,
5033         (void *)&CounterPortType_GetResourceProperty_op_qname);
5034
5035 0     globus_extension_registry_remove(
5036         GLOBUS_OPERATION_PROVIDER_REGISTRY,
5037         (void *)&CounterPortType_GetMultipleResourceProperties_op_qname);
5038
5039 0     globus_extension_registry_remove(
5040         GLOBUS_OPERATION_PROVIDER_REGISTRY,
5041         (void *)&CounterPortType_QueryResourceProperties_op_qname);
5042
5043 0     globus_extension_registry_remove(
5044         GLOBUS_OPERATION_PROVIDER_REGISTRY,
5045         (void *)&CounterPortType_Destroy_op_qname);
5046
5047 0     globus_extension_registry_remove(
5048         GLOBUS_OPERATION_PROVIDER_REGISTRY,
5049         (void *)&CounterPortType_SetTerminationTime_op_qname);
5050
5051 0     globus_extension_registry_remove(
5052         GLOBUS_OPERATION_PROVIDER_REGISTRY,
5053         (void *)&CounterPortType_add_op_qname);
5054
5055 0     globus_extension_registry_remove(
5056         GLOBUS_OPERATION_PROVIDER_REGISTRY,
5057         (void *)&CounterPortType_createCounter_op_qname);
5058
5059 0     globus_operation_table_destroy(CounterService_descriptor.operations);
5060
5061
5062 0     globus_hashtable_remove(
5063         &CounterService_descriptor.op_mapper,
5064         (void *)&CounterPortType_GetCurrentMessage_input_qname);
5065
5066 0     globus_hashtable_remove(
5067         &CounterService_descriptor.op_mapper,
5068         (void *)&CounterPortType_Subscribe_input_qname);
5069
5070 0     globus_hashtable_remove(
5071         &CounterService_descriptor.op_mapper,
5072         (void *)&CounterPortType_GetResourceProperty_input_qname);
5073
5074 0     globus_hashtable_remove(
5075         &CounterService_descriptor.op_mapper,
5076         (void *)&CounterPortType_GetMultipleResourceProperties_input_qname);
5077
5078 0     globus_hashtable_remove(
5079         &CounterService_descriptor.op_mapper,
5080         (void *)&CounterPortType_QueryResourceProperties_input_qname);
5081
5082 0     globus_hashtable_remove(
5083         &CounterService_descriptor.op_mapper,
5084         (void *)&CounterPortType_Destroy_input_qname);
5085
5086 0     globus_hashtable_remove(
5087         &CounterService_descriptor.op_mapper,
5088         (void *)&CounterPortType_SetTerminationTime_input_qname);
5089
5090 0     globus_hashtable_remove(
5091         &CounterService_descriptor.op_mapper,
5092         (void *)&CounterPortType_add_input_qname);
5093
5094 0     globus_hashtable_remove(
5095         &CounterService_descriptor.op_mapper,
5096         (void *)&CounterPortType_createCounter_input_qname);
5097
5098
5099 0     globus_mutex_destroy(&CounterService_descriptor.mutex);
5100
5101 0     CounterService_registry_remove_types(
5102         CounterService_descriptor.registry);
5103
5104 0     globus_xsd_type_registry_destroy(CounterService_descriptor.registry);
5105
5106 0     globus_hashtable_destroy(&CounterService_descriptor.op_mapper);
5107
5108 0     if(GLOBUS_GLOBAL_TYPE_REGISTRY != NULL)
5109     {
5110 0         CounterService_registry_remove_types(
5111             GLOBUS_GLOBAL_TYPE_REGISTRY);
5112     }
5113
5114 0     globus_extension_deactivate(
5115             "globus_wsnt_NotificationProducer_provider");
5116 0     globus_extension_deactivate(
5117             "globus_wsrl_ScheduledResourceTermination_provider");
5118 0     globus_extension_deactivate(
5119             "globus_wsrl_ImmediateResourceTermination_provider");
5120 0     globus_extension_deactivate(
5121             "globus_wsrp_QueryResourceProperties_provider");
5122 0     globus_extension_deactivate("globus_wsrp_SetResourceProperties_provider");
5123 0     globus_extension_deactivate(
5124         "globus_wsrp_GetMultipleResourceProperties_provider");
5125 0     globus_extension_deactivate("globus_wsrp_GetResourceProperty_provider");
5126 0     globus_module_deactivate(GLOBUS_WSRF_RESOURCE_MODULE);
5127
5128 0     rc = globus_module_deactivate(GLOBUS_SOAP_MESSAGE_MODULE);
5129 0     if(rc != GLOBUS_SUCCESS)
5130     {
5131 0         return rc;
5132     }
5133
5134 0     GlobusDebugDestroy(COUNTERSERVICE);
5135
5136 0     rc = globus_module_deactivate(GLOBUS_COMMON_MODULE);
5137 0     if(rc != GLOBUS_SUCCESS)
5138     {
5139 0         return rc;
5140     }
5141
5142 0     return rc;
5143 }
5144
5145 #define WSRP_NS "http://www.globus.org/docs.oasis-open.org" \
5146                 "/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl"
5147
5148 static xsd_QName CounterService_l_wsrp_GetResourceProperty_qname =
5149 {
5150     WSRP_NS,
5151     "GetResourceProperty"
5152 };
5153
5154 static xsd_QName CounterService_l_wsrp_GetMultipleResourceProperties_qname =
5155 {
5156     WSRP_NS,
5157     "GetMultipleResourceProperties"
5158 };
5159
5160 static xsd_QName CounterService_l_wsrp_SetResourceProperties_qname =
5161 {
5162     WSRP_NS,
5163     "SetResourceProperties"
5164 };
5165
5166 static xsd_QName CounterService_l_wsrp_QueryResourceProperties_qname =
5167 {
5168     WSRP_NS,
5169     "QueryResourceProperties"
5170 };
5171
5172 static xsd_QName CounterService_l_wsrl_Destroy_qname =
5173 {
5174     "http://www.globus.org/docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.wsdl",
5175     "Destroy"
5176 };
5177
5178 static xsd_QName CounterService_l_wsrl_SetTerminationTime_qname =
5179 {
5180     "http://www.globus.org/docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.wsdl",
5181     "SetTerminationTime"
5182 };
5183
5184 static xsd_QName CounterService_l_wsnt_Subscribe_qname =
5185 {
5186     "http://www.globus.org/docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.wsdl",
5187     "Subscribe"
5188 };
5189
5190 static xsd_QName CounterService_l_wsnt_GetCurrentMessage_qname =
5191 {
5192     "http://www.globus.org/docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.wsdl",
5193     "GetCurrentMessage"