Salome HOME
original file names are kept, v2
[tools/simanio.git] / src / GetFileResponse.cpp
1
2
3         /**
4          * GetFileResponse.cpp
5          *
6          * This file was auto-generated from WSDL
7          * by the Apache Axis2/C version: SNAPSHOT  Built on : Mar 10, 2008 (08:35:52 GMT+00:00)
8          */
9
10         #include "GetFileResponse.h"
11         #include <Environment.h>
12         #include <WSFError.h>
13
14
15         using namespace wso2wsf;
16         using namespace std;
17         
18         using namespace org_splat_ws_server_service_salome;
19         
20                /*
21                 * Implementation of the getFileResponse|http://salome.service.ws_server.splat.org Element
22                 */
23            org_splat_ws_server_service_salome::GetFileResponse::GetFileResponse()
24         {
25
26         
27             qname = NULL;
28         
29                 property__return  = NULL;
30               
31             isValid_return  = false;
32         
33                   qname =  axutil_qname_create (Environment::getEnv(),
34                         "getFileResponse",
35                         "http://salome.service.ws_server.splat.org",
36                         NULL);
37                 
38         }
39
40        org_splat_ws_server_service_salome::GetFileResponse::GetFileResponse(axutil_base64_binary_t* arg__return)
41         {
42              
43                    qname = NULL;
44              
45                property__return  = NULL;
46              
47             isValid_return  = true;
48             
49                  qname =  axutil_qname_create (Environment::getEnv(),
50                        "getFileResponse",
51                        "http://salome.service.ws_server.splat.org",
52                        NULL);
53                
54                     property__return = arg__return;
55             
56         }
57         org_splat_ws_server_service_salome::GetFileResponse::~GetFileResponse()
58         {
59
60         }
61
62         
63
64         bool WSF_CALL
65         org_splat_ws_server_service_salome::GetFileResponse::deserialize(axiom_node_t** dp_parent,bool *dp_is_early_node_valid, bool dont_care_minoccurs)
66         {
67           axiom_node_t *parent = *dp_parent;
68           
69           bool status = AXIS2_SUCCESS;
70            
71          const axis2_char_t* text_value = NULL;
72          axutil_qname_t *mqname = NULL;
73           
74             axutil_qname_t *element_qname = NULL; 
75             
76                axiom_node_t *first_node = NULL;
77                bool is_early_node_valid = true;
78                axiom_node_t *current_node = NULL;
79                axiom_element_t *current_element = NULL;
80             
81               
82               while(parent && axiom_node_get_node_type(parent, Environment::getEnv()) != AXIOM_ELEMENT)
83               {
84                   parent = axiom_node_get_next_sibling(parent, Environment::getEnv());
85               }
86               if (NULL == parent)
87               {   
88                 return AXIS2_FAILURE;
89               }
90               
91
92                     current_element = (axiom_element_t *)axiom_node_get_data_element(parent, Environment::getEnv());
93                     mqname = axiom_element_get_qname(current_element, Environment::getEnv(), parent);
94                     if (axutil_qname_equals(mqname, Environment::getEnv(), this->qname))
95                     {
96                         
97                           first_node = axiom_node_get_first_child(parent, Environment::getEnv());
98                           
99                     }
100                     else
101                     {
102                         WSF_LOG_ERROR_MSG(Environment::getEnv()->log, WSF_LOG_SI,
103                               "Failed in building adb object for getFileResponse : "
104                               "Expected %s but returned %s",
105                               axutil_qname_to_string(qname, Environment::getEnv()),
106                               axutil_qname_to_string(mqname, Environment::getEnv()));
107                         
108                         return AXIS2_FAILURE;
109                     }
110                     
111
112                      
113                      /*
114                       * building return element
115                       */
116                      
117                      
118                      
119                                    current_node = first_node;
120                                    is_early_node_valid = false;
121                                    
122                                    
123                                     while(current_node && axiom_node_get_node_type(current_node, Environment::getEnv()) != AXIOM_ELEMENT)
124                                     {
125                                         current_node = axiom_node_get_next_sibling(current_node, Environment::getEnv());
126                                     }
127                                     if(current_node != NULL)
128                                     {
129                                         current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, Environment::getEnv());
130                                         mqname = axiom_element_get_qname(current_element, Environment::getEnv(), current_node);
131                                     }
132                                    
133                                  element_qname = axutil_qname_create(Environment::getEnv(), "return", "http://salome.service.ws_server.splat.org", NULL);
134                                  
135
136                            if ( 
137                                 (current_node   && current_element && (axutil_qname_equals(element_qname, Environment::getEnv(), mqname))))
138                            {
139                               if( current_node   && current_element && (axutil_qname_equals(element_qname, Environment::getEnv(), mqname)))
140                               {
141                                 is_early_node_valid = true;
142                               }
143                               
144                                  
145                                       text_value = axiom_element_get_text(current_element, Environment::getEnv(), current_node);
146                                       if(text_value != NULL)
147                                       {
148                                           axutil_base64_binary_t* element = axutil_base64_binary_create(Environment::getEnv());
149                                           status = axutil_base64_binary_set_encoded_binary((axutil_base64_binary_t*)element, Environment::getEnv(),
150                                                                           text_value);
151                                           if(AXIS2_FAILURE ==  status)
152                                           {
153                                               if(element != NULL)
154                                               {
155                                                  axutil_base64_binary_free(element, Environment::getEnv());
156                                               }
157                                                                   WSF_LOG_ERROR_MSG(Environment::getEnv()->log,WSF_LOG_SI, "failed in building element return ");
158                                           }
159                                           else
160                                           {
161                                             status = set_return(element);
162                                           }
163                                       }
164                                       
165                                  if(AXIS2_FAILURE ==  status)
166                                  {
167                                      WSF_LOG_ERROR_MSG( Environment::getEnv()->log,WSF_LOG_SI,"failed in setting the value for return ");
168                                      if(element_qname)
169                                      {
170                                          axutil_qname_free(element_qname, Environment::getEnv());
171                                      }
172                                      return AXIS2_FAILURE;
173                                  }
174                               }
175                            
176                   if(element_qname)
177                   {
178                      axutil_qname_free(element_qname, Environment::getEnv());
179                      element_qname = NULL;
180                   }
181                  
182           return status;
183        }
184
185           bool WSF_CALL
186           org_splat_ws_server_service_salome::GetFileResponse::isParticle()
187           {
188             
189                  return false;
190               
191           }
192
193
194           void WSF_CALL
195           org_splat_ws_server_service_salome::GetFileResponse::declareParentNamespaces(
196                     axiom_element_t *parent_element,
197                     axutil_hash_t *namespaces, int *next_ns_index)
198           {
199             
200                   /* Here this is an empty function, Nothing to declare */
201                  
202           }
203
204         
205         
206         axiom_node_t* WSF_CALL
207         org_splat_ws_server_service_salome::GetFileResponse::serialize(axiom_node_t *parent, 
208                         axiom_element_t *parent_element, 
209                         int parent_tag_closed, 
210                         axutil_hash_t *namespaces, 
211                         int *next_ns_index)
212         {
213             
214             
215          
216          axiom_node_t *current_node = NULL;
217          int tag_closed = 0;
218
219          
220          
221                 axiom_namespace_t *ns1 = NULL;
222
223                 axis2_char_t *qname_uri = NULL;
224                 axis2_char_t *qname_prefix = NULL;
225                 axis2_char_t *p_prefix = NULL;
226             
227                     axis2_char_t *text_value_1;
228                     axis2_char_t *text_value_1_temp;
229                     
230                axis2_char_t *start_input_str = NULL;
231                axis2_char_t *end_input_str = NULL;
232                unsigned int start_input_str_len = 0;
233                unsigned int end_input_str_len = 0;
234             
235             
236                axiom_data_source_t *data_source = NULL;
237                axutil_stream_t *stream = NULL;
238
239              
240                 int next_ns_index_value = 0;
241              
242                     namespaces = axutil_hash_make(Environment::getEnv());
243                     next_ns_index = &next_ns_index_value;
244                      
245                            ns1 = axiom_namespace_create (Environment::getEnv(),
246                                              "http://salome.service.ws_server.splat.org",
247                                              "n"); 
248                            axutil_hash_set(namespaces, "http://salome.service.ws_server.splat.org", AXIS2_HASH_KEY_STRING, axutil_strdup(Environment::getEnv(), "n"));
249                        
250                      
251                     parent_element = axiom_element_create (Environment::getEnv(), NULL, "getFileResponse", ns1 , &parent);
252                     
253                     
254                     axiom_element_set_namespace(parent_element, Environment::getEnv(), ns1, parent);
255
256
257             
258                     data_source = axiom_data_source_create(Environment::getEnv(), parent, &current_node);
259                     stream = axiom_data_source_get_stream(data_source, Environment::getEnv());
260                   
261                        if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://salome.service.ws_server.splat.org", AXIS2_HASH_KEY_STRING)))
262                        {
263                            p_prefix = (axis2_char_t*)AXIS2_MALLOC(Environment::getEnv()->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT);
264                            sprintf(p_prefix, "n%d", (*next_ns_index)++);
265                            axutil_hash_set(namespaces, "http://salome.service.ws_server.splat.org", AXIS2_HASH_KEY_STRING, p_prefix);
266                            
267                            axiom_element_declare_namespace_assume_param_ownership(parent_element, Environment::getEnv(), axiom_namespace_create (Environment::getEnv(),
268                                             "http://salome.service.ws_server.splat.org", p_prefix));
269                        }
270                       
271
272                    if (!isValid_return)
273                    {
274                       
275                            /* no need to complain for minoccurs=0 element */
276                             
277                           
278                    }
279                    else
280                    {
281                      start_input_str = (axis2_char_t*)AXIS2_MALLOC(Environment::getEnv()->allocator, sizeof(axis2_char_t) *
282                                  (4 + axutil_strlen(p_prefix) + 
283                                   axutil_strlen("return"))); 
284                                  
285                                  /* axutil_strlen("<:>") + 1 = 4 */
286                      end_input_str = (axis2_char_t*)AXIS2_MALLOC(Environment::getEnv()->allocator, sizeof(axis2_char_t) *
287                                  (5 + axutil_strlen(p_prefix) + axutil_strlen("return")));
288                                   /* axutil_strlen("</:>") + 1 = 5 */
289                                   
290                      
291
292                    
293                    
294                      
295                      /*
296                       * parsing return element
297                       */
298
299                     
300                     
301                             sprintf(start_input_str, "<%s%sreturn>",
302                                  p_prefix?p_prefix:"",
303                                  (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
304                             
305                         start_input_str_len = axutil_strlen(start_input_str);
306                         sprintf(end_input_str, "</%s%sreturn>",
307                                  p_prefix?p_prefix:"",
308                                  (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
309                         end_input_str_len = axutil_strlen(end_input_str);
310                     
311                           text_value_1 =axutil_base64_binary_get_encoded_binary(property__return, Environment::getEnv());
312                            
313                            axutil_stream_write(stream, Environment::getEnv(), start_input_str, start_input_str_len);
314                            
315                            axutil_stream_write(stream, Environment::getEnv(), text_value_1, axutil_strlen(text_value_1));
316                            
317                            axutil_stream_write(stream, Environment::getEnv(), end_input_str, end_input_str_len);
318                            
319                      
320                      AXIS2_FREE(Environment::getEnv()->allocator,start_input_str);
321                      AXIS2_FREE(Environment::getEnv()->allocator,end_input_str);
322                  } 
323
324                  
325                    if(namespaces)
326                    {
327                        axutil_hash_index_t *hi;
328                        void *val;
329                        for (hi = axutil_hash_first(namespaces, Environment::getEnv()); hi; hi = axutil_hash_next(Environment::getEnv(), hi))
330                        {
331                            axutil_hash_this(hi, NULL, NULL, &val);
332                            AXIS2_FREE(Environment::getEnv()->allocator, val);
333                        }
334                        axutil_hash_free(namespaces, Environment::getEnv());
335                    }
336                 
337
338             return parent;
339         }
340
341
342         
343
344             /**
345              * Getter for return by  Property Number 1
346              */
347             axutil_base64_binary_t* WSF_CALL
348             org_splat_ws_server_service_salome::GetFileResponse::getProperty1()
349             {
350                 return get_return();
351             }
352
353             /**
354              * getter for return.
355              */
356             axutil_base64_binary_t* WSF_CALL
357             org_splat_ws_server_service_salome::GetFileResponse::get_return()
358              {
359                 return property__return;
360              }
361
362             /**
363              * setter for return
364              */
365             bool WSF_CALL
366             org_splat_ws_server_service_salome::GetFileResponse::set_return(
367                     axutil_base64_binary_t*  arg__return)
368              {
369                 
370
371                 if(isValid_return &&
372                         arg__return == property__return)
373                 {
374                     
375                     return true;
376                 }
377
378                 
379
380                 
381                 reset_return();
382
383                 
384                     if(NULL == arg__return)
385                          
386                 {
387                     /* We are already done */
388                     return true;
389                 }
390                 
391                         property__return = arg__return;
392                         isValid_return = true;
393                     
394                 return true;
395              }
396
397              
398
399            /**
400             * resetter for return
401             */
402            bool WSF_CALL
403            org_splat_ws_server_service_salome::GetFileResponse::reset_return()
404            {
405                int i = 0;
406                int count = 0;
407
408
409                
410             
411                 
412
413                 if(property__return != NULL)
414                 {
415                    
416                    
417                          axutil_base64_binary_free (property__return, Environment::getEnv());
418                          property__return = NULL;
419                      
420
421                    }
422
423                 
424                 
425                 
426                isValid_return = false; 
427                return true;
428            }
429
430            /**
431             * Check whether return is nill
432             */
433            bool WSF_CALL
434            org_splat_ws_server_service_salome::GetFileResponse::is_returnNil()
435            {
436                return !isValid_return;
437            }
438
439            /**
440             * Set return to nill (currently the same as reset)
441             */
442            bool WSF_CALL
443            org_splat_ws_server_service_salome::GetFileResponse::set_returnNil()
444            {
445                return reset_return();
446            }
447
448            
449