You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by na...@apache.org on 2006/09/01 14:46:04 UTC

svn commit: r439295 [9/15] - in /webservices/axis2/trunk/c: tools/ tools/codegen/ tools/codegen/include/ tools/codegen/samples/ tools/codegen/samples/client/ tools/codegen/samples/client/calculator/ tools/codegen/samples/client/interop_test_svc/ tools/...

Added: webservices/axis2/trunk/c/tools/codegen/src/schema/writer/schema_writer.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/schema/writer/schema_writer.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/schema/writer/schema_writer.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/schema/writer/schema_writer.c Fri Sep  1 05:45:57 2006
@@ -0,0 +1,767 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <w2c_schema_writer.h>
+#include <w2c_schema_writer_meta_info.h>
+#include <w2c_schema_compiler_options.h>
+#include <w2c_messages.h>
+#include <w2c_schema_property_loader.h>
+
+/**
+ * @brief
+ */
+#define W2C_SCHEMA_WRITER_WRAPPED_DATABINDING_CLASS_NAME  "WrappedDatabinder"
+#define W2C_SCHEMA_WRITER_DEFAULT_PACKAGE "adb"
+#define W2C_SCHEMA_WRITER_EXTENSION_MAPPER_CLASSNAME "ExtensionMapper"
+
+typedef struct w2c_schema_writer_impl
+{
+    w2c_schema_writer_t writer;
+
+    axis2_char_t *template_name;
+    axis2_bool_t template_loaded;
+    axis2_array_list_t *names_list;
+    int count;
+    axis2_bool_t *wrap_classes;
+    axis2_bool_t *writeClasses;
+    axis2_char_t *package_name;
+    axis2_char_t *root_dir;
+    axis2_node_t *global_wrapped_source_node;
+    axis2_node_t *global_wrapped_header_node;
+    axis2_hash_t *model_map;
+    
+    w2c_typemapper_t *base_type_map;
+    axis2_hash_t *ns2packagename_map;
+    axis2_bool_t is_helper_mode;
+    /**
+     * package for the mapping class
+     */
+    axis2_char_t *mapping_class_package;
+
+    w2c_schema_property_loader_t *loader;
+
+} w2c_schema_writer_impl_t;
+
+axis2_status_t AXIS2_CALL
+w2c_schema_writer_free (w2c_schema_writer_t *schema_writer,
+                                    const axis2_env_t *env);
+
+axis2_char_t*AXIS2_CALL
+w2c_schema_writer_get_output_location( w2c_schema_writer_t *writer,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_writer_set_output_location( w2c_schema_writer_t *writer,
+        const axis2_env_t *env,
+        axis2_char_t *output_location);
+
+axis2_char_t* AXIS2_CALL
+w2c_schema_writer_get_package_name( w2c_schema_writer_t *writer,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_writer_set_package_name( w2c_schema_writer_t *writer,
+        const axis2_env_t *env,
+        axis2_char_t *package_name);
+
+axis2_bool_t AXIS2_CALL
+w2c_schema_writer_get_helper_mode( w2c_schema_writer_t *writer,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_writer_set_elper_mode( w2c_schema_writer_t *writer,
+        const axis2_env_t *env,
+        axis2_bool_t helper_mode);
+
+axis2_bool_t AXIS2_CALL
+w2c_schema_writer_get_write_out( w2c_schema_writer_t *writer,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_writer_set_write_out( w2c_schema_writer_t *writer,
+        const axis2_env_t *env,
+        axis2_bool_t write_out);
+
+axis2_bool_t AXIS2_CALL
+w2c_schema_writer_get_wrap_classes( w2c_schema_writer_t *writer,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_writer_set_wrap_classes( w2c_schema_writer_t *writer,
+        const axis2_env_t *env,
+        axis2_bool_t wrap_classes);
+
+axis2_hash_t* AXIS2_CALLL
+w2c_schema_writer_get_ns2package_map( w2c_schema_writer_t *writer,
+        const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+w2c_schema_writer_set_ns2package_map( w2c_schema_writer_t *writer,
+        const axis2_env_t *env,
+        axis2_hash_t *ns2package_map);
+
+AXIS2_EXTERN w2c_schema_writer_t * AXIS2_CALL
+w2c_schema_writer_create (const axis2_env_t *env)
+{
+    w2c_schema_writer_impl_t *writer_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    writer_impl = (w2c_schema_writer_impl_t *) AXIS2_MALLOC(env->
+               allocator, sizeof(w2c_schema_writer_impl_t));
+
+    if(NULL == writer_impl)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    writer_impl->type = NULL;
+    writer_impl->values_arr = NULL;
+    writer_impl->output_location = NULL;
+    writer_impl->package_name = NULL;
+    writer_impl->helper_mode = AXIS2_FALSE;
+    writer_impl->write_out = AXIS2_FALSE;
+    writer_impl->wrap_classes = AXIS2_FALSE;
+    writer_impl->ns2package_map = NULL;
+
+
+    writer_impl->writer.ops =
+    AXIS2_MALLOC (env->allocator, sizeof(w2c_schema_writer_ops_t));
+    if(NULL == writer_impl->writer.ops)
+    {
+        w2c_schema_writer_free(&(writer_impl->writer), env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+    writer_impl->writer.ops->free = w2c_schema_writer_free;
+    
+    writer_impl->writer.ops->get_output_location =
+                            w2c_schema_writer_get_output_location;
+    writer_impl->writer.ops->set_output_location =
+                            w2c_schema_writer_set_output_location;
+    writer_impl->compiler_option.ops->get_package_name =
+                            w2c_schema_writer_get_package_name;
+    writer_impl->compiler_option.ops->set_package_name =
+                            w2c_schema_writer_set_package_name;
+    writer_impl->compiler_option.ops->get_helper_mode =
+                            w2c_schema_writer_get_helper_mode;
+    writer_impl->compiler_option.ops->set_helper_mode =
+                            w2c_schema_writer_set_helper_mode;
+    writer_impl->compiler_option.ops->get_write_out =
+                            w2c_schema_writer_get_write_out;
+    writer_impl->compiler_option.ops->set_write_out =
+                            w2c_schema_writer_set_write_out;
+    writer_impl->compiler_option.ops->get_wrap_classes =
+                            w2c_schema_writer_get_wrap_classes;
+    writer_impl->compiler_option.ops->set_wrap_classes =
+                            w2c_schema_writer_set_wrap_classes;
+    writer_impl->compiler_option.ops->get_ns2package_map =
+                            w2c_schema_writer_get_ns2package_map;
+    writer_impl->compiler_option.ops->set_ns2package_map =
+                            w2c_schema_writer_set_ns2package_map;
+
+    return &(writer_impl->writer);
+}
+
+axis2_status_t AXIS2_CALL 
+w2c_schema_writer_free (w2c_schema_writer_t *schema_writer, 
+                            const axis2_env_t *env)
+{
+    w2c_schema_writer_impl_t *schema_writer_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    schema_writer_impl = W2C_INTF_TO_IMPL(schema_writer);
+    
+    if (schema_writer_impl-> output_location)
+    {
+        AXIS2_FREE(env-> allocator, schema_writer_impl-> output_location);
+    }
+    if (schema_writer_impl-> package_name)
+    {
+        AXIS2_FREE(env-> allocator, schema_writer_impl-> package_name);
+    }
+    if (schema_writer_impl-> ns2package_map)
+    {
+        axis2_hash_free(schema_writer_impl-> ns2package_map, env);
+    }
+    if(schema_writer->ops)
+    {
+        AXIS2_FREE(env->allocator, schema_writer->ops);
+        schema_writer->ops = NULL;
+    }
+    if(schema_writer_impl)
+    {
+        AXIS2_FREE(env->allocator, schema_writer_impl);
+        schema_writer_impl = NULL;
+    }
+    
+    return AXIS2_SUCCESS;
+}
+
+
+
+
+axis2_hash_t* AXIS2_CALL
+w2c_schema_writer_get_model_map( w2c_schema_writer_t *writer,
+        const axis2_env_t *env)
+{
+    w2c_schema_writer_t *writer_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    writer_impl = W2C_INTF_TO_IMPL(writer);
+
+    return writer_impl-> model_map;
+}
+
+axis2_status_t AXIS2_CALL
+w2c_schema_writer_init( w2c_schema_writer_t *writer,
+         const axis2_env_t *env,
+         w2c_schema_compler_options_t *options)
+{
+    w2c_schema_writer_t *writer_impl = NULL;
+    axis2_char_t *output = NULL;
+    axis2_bool_t write_classes = AXIS2_FALSE;
+    axis2_char_t *temp_package = NULL;
+    int length = 0;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    writer_impl = W2C_INTF_TO_IMPL(writer);
+
+    output = W2C_SCHEMA_COMPILER_OPTIONS_GET_OUTPUT_LOCATION( options, env);
+    W2C_SCHEMA_WRITER_INIT_WITH_FILE( writer_impl, env, output);
+    writer_impl-> package_name = 
+        W2C_SCHEMA_COMPILER_OPTIONS_GET_PACKAGE_NAME( options, env);
+    write_classes = W2C_SCHEMA_COMPILER_OPTIONS_GET_WRITE_OUT( options, env);
+    if( !write_classes)
+    {
+        writer_impl-> wrap_classes = AXIS2_FALSE;
+    }
+    else
+    {
+        writer_impl-> wrap_classes =
+            W2C_SCHEMA_COMPILER_OPTIONS_GET_WRAP_CLASSES( options, env);
+    }
+    /* if the wrap mode is set then create a global document to keep the
+     * wrapped
+     * element models
+     */
+    if( !wrap_classes)
+    {
+        writer_impl-> global_wrapped_source_node = 
+                 w2c_xslt_utils_add_child_node( env, "bean", NULL);
+        w2c_xslt_utils_add_attribute (env, writer_impl-> global_wrapped_source_node,
+                "name", W2C_SCHEMA_WRITER_WRAPPED_DATABINDING_CLASS_NAME);
+        if ( writer_impl-> package_name != NULL)
+        {
+            length = AXIS2_STRLEN( writer_impl-> package_name);
+            if ( writer_impl-> package_name[length-1] == '.' )
+            {
+                writer_impl-> package_name[length-1] == '\0';
+                temp_package = writer_impl-> package_name;
+            }
+        }
+        if ( temp_package == NULL )
+        {
+            temp_package = W2C_SCHEMA_WRITER_DEFAULT_PACKAGE;
+        }
+        w2c_xslt_utils_add_attribute (env, writer_impl-> global_wrapped_source_node,
+                "package", temp_package);
+
+        writer_impl-> global_wrapped_header_node = 
+                 w2c_xslt_utils_add_child_node( env, "bean", NULL);
+        w2c_xslt_utils_add_attribute (env, writer_impl-> global_wrapped_header_node,
+                "name", W2C_SCHEMA_WRITER_WRAPPED_DATABINDING_CLASS_NAME);
+        if ( writer_impl-> package_name != NULL)
+        {
+            length = AXIS2_STRLEN( writer_impl-> package_name);
+            if ( writer_impl-> package_name[length-1] == '.' )
+            {
+                writer_impl-> package_name[length-1] == '\0';
+                temp_package = writer_impl-> package_name;
+            }
+        }
+        if ( temp_package == NULL )
+        {
+            temp_package = W2C_SCHEMA_WRITER_DEFAULT_PACKAGE;
+        }
+        w2c_xslt_utils_add_attribute (env, writer_impl-> global_wrapped_header_node,
+                "package", temp_package);
+    }
+    writer_impl-> ns2packagename_map = 
+        W2C_SCHEMA_COMPILER_OPTIONS_GET_NS2PACKAGE_MAP( options, env);
+    writer_impl-> is_helper_mode = 
+        W2C_SCHEMA_COMPILER_OPTIONS_GET_HELPER_MODE( options, env);
+    if ( W2C_SCHEMA_COMPILER_OPTIONS_GET_MAPPER_CLASS_PACKAGE( options, env)!= NULL)
+    {
+        writer_impl-> mapping_class_package =
+              W2C_SCHEMA_COMPILER_OPTIONS_GET_MAPPER_CLASS_PACKAGE( options, env);
+    }
+
+    return AXIS2_SUCCESS;
+}
+
+
+axis2_char_t* AXIS2_CALL
+w2c_schema_writer_write_element( w2c_schema_writer_t *writer,
+         const axis2_env_t *env,
+         xml_schema_element_t *element,
+         axis2_hash_t *typemap,
+         w2c_schema_writer_meta_info_t *meta_info)
+{
+    axis2_qname_t *qname;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    qname = XML_SCHEMA_ELEMENT_GET_QNAME( element, env);
+    return process( writer, env, qname, meta_info, typemap, AXIS2_TRUE);
+}
+
+axis2_char_t* AXIS2_CALL
+w2c_schema_writer_write_complex_type( w2c_schema_writer_t *writer,
+         const axis2_env_t *env,
+         xml_schema_complex_type_t *type,
+         axis2_hash_t *typemap,
+         w2c_schema_writer_meta_info_t *meta_info)
+{
+    axis2_qname_t *qname;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    qname = XML_SCHEMA_ELEMENT_GET_QNAME( element, env);
+    return process( writer, env, qname, meta_info, typemap, AXIS2_FALSE);
+}
+
+axis2_status_t AXIS2_CALL
+w2c_schema_writer_write_batch( w2c_schema_writer_t *writer,
+                 const axis2_env_t *env)
+{
+    w2c_schema_writer_impl_t *writer_impl = NULL;
+    axis2_char_t *temp_package = NULL;
+    FILE *out = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    writer_impl = W2C_INTF_TO_IMPL(writer);
+    if( writer_impl-> wrap_classes)
+    {
+        if ( NULL == writer_impl-> package_name)
+        {
+            temp_package = W2C_SCHEMA_WRITER_DEFAULT_PACKAGE;
+        }
+        else
+        {
+            temp_package = writer_impl-> package_name;
+        }
+        out = w2c_schema_writer_create_out_file( writer_impl, env, 
+                      temp_package, W2C_SCHEMA_WRITER_WRAPPED_DATABINDING_CLASS_NAME, ".c");
+        /* parse with the template and create the files */
+        w2c_schema_writer_parse( writer_impl, env,
+                      writer_impl-> global_wrapped_source_node, out);
+        out = w2c_schema_writer_create_out_file( writer_impl, env, 
+                      temp_package, W2C_SCHEMA_WRITER_WRAPPED_DATABINDING_CLASS_NAME, ".h");
+        /* parse with the template and create the files */
+        w2c_schema_writer_parse( writer_impl, env,
+                      writer_impl-> global_wrapped_header_node, out);
+    }
+    return AXIS2_SUCCESS;
+}
+
+axis2_char_t*
+w2c_schema_writer_write_simple_type( w2c_schema_writer_impl_t *writer_impl,
+         const axis2_env_t *env,
+         xml_schema_complex_type_t *type,
+         axis2_hash_t *typemap,
+         w2c_schema_writer_meta_info_t *meta_info)
+{
+    AXIS2_ENV_CHECK(env, NULL);
+    w2c_messages_print_n_log_error( env, "schema.notImplemented");
+    return AXIS2_FAILURE;
+}
+
+axis2_status_t
+w2c_schema_writer_init_with_file( w2c_schema_writer_impl_t *writer_impl,
+         const axis2_env_t *env,
+         axis2_char_t *root_dir)
+{
+    AXIS2_ENV_CHECK(env, NULL);
+    if( root_dir == NULL )
+    {
+        root_dir = AXIS2_STRDUP(".", env);
+    }
+
+    writer_impl-> root_dir = root_dir;
+    writer_impl-> names_list = axis2_array_list_create(env);
+    writer_impl-> template_name = 
+        W2C_SCHEMA_PROPERTY_LOADER_GET_TEMPLATE_NAME( writer_impl-> loader, env);
+
+    return AXIS2_SUCCESS;
+}
+
+/**TODO: this should be moved to laguage specific writer */
+axis2_char_t*
+w2c_schema_writer_make_fully_qualified_class_name( w2c_schema_writer_impl_t *writer_impl,
+        const axis2_env_t *env,
+        axis2_qname_t *qname)
+{
+    axis2_char_t *ns_uri = NULL;
+    axis2_char_t *base_package_name = NULL;
+    axis2_char_t *package_name = NULL;
+    axis2_char_t *class_name = NULL;
+    axis2_char_t *original_name = NULL;
+    axis2_char_t *package_prefix = NULL;
+    axis2_char_t *fully_qualified_class_name = NULL;
+    int length = 0;
+
+    ns_uri = AXIS2_QNAME_GET_URI( qname, env);
+    package_name = w2c_schema_writer_get_package(writer, env, ns_uri );
+    class_name = w2c_schema_writer_make_unique_class_name( writer, env,
+            writer_impl-> names_list, original_name);
+    if( writer_impl-> wrapped_class)
+    {
+        package_prefix = 
+            (writer_impl-> package_name == NULL)? 
+                        (W2C_SCHEMA_WRITER_DEFAULT_PACKAGE "."):writer_impl-> package_name;
+        package_prefix = w2c_string_add_string( package_prefix, 
+                        W2C_SCHEMA_WRAPPED_DATABINDING_CLASS_NAME, env);
+    }
+    else if ( writer_impl-> write_classes)
+    {
+        package_prefix = package_name;
+    }
+    if( package_prefix != NULL)
+    {
+        length = AXIS2_STRLEN( fully_qualifed_class_name);
+        fully_qualifed_class_name = axis2_stracat(package_prefix,
+                (package_prefix[length-1]=='.')?"":".");
+        fully_qualifed_class_name = axis2_add_string(fully_qualified_class_name,
+                class_name );
+    }
+    else
+    {
+        fully_qualified_class_name = class_name;
+    }
+    return fully_qualified_class_name;
+}
+
+axis2_char_t*
+w2c_schema_writer_get_package( w2c_schema_writer_impl_t *writer_impl,
+                        const axis2_env_t *env,
+                        axis2_char_t *namespace_uri)
+{
+    axis2_char_t *base_package_name = NULL;
+    axis2_char_t *package_name = NULL;
+
+    base_package_name = (axis2_char_t*)axis2_hash_get( writer_impl-> ns2packagename_map, qname_str,
+             AXIS2_HASH_KEY_STRING);
+    if ( NULL == base_package_name)
+    {
+        base_package_name = w2c_url_processor_make_package_name( env, namespace_uri);
+    }
+    if( NULL == writer_impl-> package_name)
+    {
+        package_name = AXIS2_STRDUP( base_package_name, env);
+    }
+    else
+    {
+        package_name = axis2_stracat(writer_impl-> package_name, base_package_name, env);
+    }
+    return package_name;
+}
+
+axis2_char_t*
+w2c_schema_writer_process( w2c_schema_writer_impl_t *writer_impl,
+                        const axis2_env_t *env,
+                        axis2_qname_t *qname,
+                        w2c_schema_writer_meta_info_t *meta_info,
+                        axis2_hash_t *typemap,
+                        axis2_bool_t is_element)
+{
+    axis2_char_t *fully_qualified_class_name = NULL;
+    int length = 0;
+    axis2_char_t *original_name = NULL;
+    axis2_char_t *class_name = NULL;
+    axis2_array_list_t *property_names = NULL;
+    axiom_node_t *model_source_node = NULL;
+    axiom_node_t *model_header_node = NULL;
+    FILE *out = NULL;
+    axis2_char_t *model_name = NULL;
+
+    fully_qualified_class_name = W2C_SCHEMA_WRITER_META_INFO_GET_OWN_CLASSNAME( meta_info, env);
+    if( NULL == fully_qualified_class_name )
+    {
+        w2c_schema_writer_make_fully_qualified_class_name( writer_impl, env, qname);
+    }
+    length = AXIS2_STRLEN( fully_qualified_class_name);
+    for ( ; lenght>=0 && fully_qualified_class_name[length]!= '.'; length -- )
+    class_name = fully_quailified_class_name+length;
+
+    original_name = AXIS2_QNAME_TO_STRING( qname, env);
+    property_names = axis2_array_list_create( env, 10);
+
+    if( writer_impl-> templated_loaded)
+    {
+        w2c_schema_writer_load_template( writer_impl, env);
+    }
+    /* for wrapped class, if it already created childs will be added */
+    if( wrapped_classes)
+    {
+        w2c_schema_writer_make_element( writer_impl, env, writer_impl-> global_wrapped_source_document,
+           class_name, original_name, qname, is_element, meta_info, property_names, typemap); 
+        w2c_schema_writer_make_element( writer_impl, env, writer_impl-> global_wrapped_header_document,
+           class_name, original_name, qname, is_element, meta_info, property_names, typemap);
+    }
+    else
+    {
+        w2c_schema_writer_make_element( writer_impl, env, model_source_node,
+           class_name, original_name, qname, is_element, meta_info, property_names, typemap); 
+        w2c_schema_writer_make_element( writer_impl, env, model_header_node,
+           class_name, original_name, qname, is_element, meta_info, property_names, typemap);
+        if(write_classes)
+        {
+            out = w2c_schema_writer_create_out_file( writer_impl, env, 
+                          "", W2C_SCHEMA_WRITER_WRAPPED_DATABINDING_CLASS_NAME, ".c");
+            /* parse with the template and create the files */
+            w2c_schema_writer_parse( writer_impl, env,
+                          model_source_node, out);
+            out = w2c_schema_writer_create_out_file( writer_impl, env, 
+                          "", W2C_SCHEMA_WRITER_WRAPPED_DATABINDING_CLASS_NAME, ".h");
+            /* parse with the template and create the files */
+            w2c_schema_writer_parse( writer_impl, env,
+                          model_header_node, out);
+        }
+        model_name = axis2_stracat( class_name, "|", env);
+        model_name = axis2_add_string( model_name, namespace_uri, env);
+        axis2_hash_set( writer_impl-> model_map,  model_source, AXIS2_HASH_KEY_STRING, model_source_node);
+    }
+    return fully_qualified_class_name;
+}
+
+axiom_node_t 
+w2c_schema_writer_process( w2c_schema_writer_impl_t *writer_impl,
+                        const axis2_env_t *env,
+                        axiom_node_t *model,
+                        axis2_char_t *class_name,
+                        axis2_char_t *original_name,
+                        axis2_qname_t *qname,
+                        axis2_bool_t is_element,
+                        w2c_schema_writer_meta_info_t *meta_info,
+                        axis2_array_list_t *property_names,
+                        axis2_hash_t *typemap)
+{
+    axis2_char_t *ns_uri = NULL;
+    axis2_char_t *prefix = NULL;
+    axis2_char_t *caps_name = NULL;
+
+    if ( model == NULL)
+    {
+       model =  w2c_xslt_utils_add_child_node( env, "bean", NULL);
+    }
+    ns_uri = AXIS2_QNAME_GET_URI( qname, env);
+    prefix = AXIS2_QNAME_GET_PREFIX( qname, env);
+
+    prefix = w2c_schema_writer_get_prefix4uri( ns_uri, prefix);
+
+    w2c_xslt_utils_add_attribute( env, model, "name", class_name);
+    w2c_xslt_utils_add_attribute( env, model, "originalName", original_name);
+    w2c_xslt_utils_add_attribute( env, model, "nsuri", ns_uri);
+    w2c_xslt_utils_add_attribute( env, model, "nsprefix", ns_uri);
+    
+    caps_name = axis2_string_toupper( class_name);
+    w2c_xslt_utils_add_attribute( env, model, "caps-name", caps_name);
+
+    if(!writer_impl-> wrap_classes)
+        w2c_xslt_utils_add_attribute( env, model, "unwrapped", "yes");
+    if(!writer_impl-> skip_write)
+        w2c_xslt_utils_add_attribute( env, model, "skip-write", "yes");
+    if(!writer_impl-> is_element)
+        w2c_xslt_utils_add_attribute( env, model, "type", "yes");
+
+    if(W2C_SCHEMA_WRITER_META_INFO_GET_ANONYMOUS( meta_info, env))
+        w2c_xslt_utils_add_attribute( env, model, "anon", "yes");
+    if(W2C_SCHEMA_WRITER_META_INFO_IS_EXTENSION( meta_info, env))
+        w2c_xslt_utils_add_attribute( env, model, "extension",
+                W2C_SCHEMA_WRITER_META_INFO_GET_EXTENSION_CLASS_NAME( meta_info, env));
+
+    if(W2C_SCHEMA_WRITER_META_INFO_IS_CHOICE( meta_info, env))
+        w2c_xslt_utils_add_attribute( env, model, "choise", "yes");
+    if(W2C_SCHEMA_WRITER_META_INFO_IS_ORDERED( meta_info, env))
+        w2c_xslt_utils_add_attribute( env, model, "ordered", "yes");
+    
+    if(writer_impl-> is_element && 
+            W2C_SCHEMA_WRITER_META_INFO_IS_NILLABLE( meta_info, env, qname))
+        w2c_xslt_utils_add_attribute( env, model, "nillable", "yes");
+
+    /* populate all the information */
+    w2c_schema_writer_populate_info( writer_impl, env, 
+            meta_info, model, property_names, typemap, AXIS2_FALSE);
+    return model;
+}
+
+axis2_status_t 
+w2c_schema_writer_populate_info( w2c_schema_writer_impl_t *writer_impl,
+                        const axis2_env_t *env,
+                        w2c_schema_writer_meta_info_t *meta_info,
+                        axiom_node_t *model,
+                        axis2_array_list_t *property_names,
+                        axis2_hash_t *typemap,
+                        axis2_bool_t is_inherited)
+{
+    w2c_schema_writer_meta_info_t *parent_meta_info = NULL;
+    parent_meta_info = W2C_SCHEMA_WRITER_META_INFO_GET_PARENT( meta_info, env);
+    if( parent_meta_info != NULL)
+    {
+        /* recursively do for all the parents */
+        w2c_schema_writer_populate_info( writer_impl, env, 
+            parent_meta_info, model, property_names, typemap, AXIS2_TRUE);
+    }
+    w2c_schema_writer_add_property_entries( writer_impl, env, 
+        meta_info, model, property_names, typemap, is_inherited);
+    return AXIS2_SUCCESS;
+}
+
+axis2_status_t 
+w2c_schema_writer_add_property_entries( w2c_schema_writer_impl_t *writer_impl,
+                        const axis2_env_t *env,
+                        w2c_schema_writer_meta_info_t *meta_info,
+                        axiom_node_t *model,
+                        axis2_array_list_t *property_names,
+                        axis2_hash_t *typemap,
+                        axis2_bool_t is_inherited)
+{
+    axis2_array_list_t *qnames = NULL;
+    int i = 0;
+    int size = 0;
+    axis2_qname_t *qname = NULL;
+    axis2_node_t *property = NULL;
+    axis2_char_t *localpart = NULL;
+    axis2_char_t *unique_name = NULL;
+    axis2_char_t *nsuri = NULL;
+    axis2_char_t *classname= NULL;
+    axis2_char_t *caps_name = NULL;
+    axis2_char_t *caps_type = NULL;
+    axis2_bool_t is_primitive = AXIS2_FALSE;
+    axis2_bool_t is_default = AXIS2_FALSE;
+    axis2_char_t *short_type_name = NULL;
+
+    if ( W2C_SCHEMA_WRITER_META_INFO_GET_ORDERED( meta_info, env) )
+    {
+        qnames = W2C_SCHEMA_WRITER_META_INFO_GET_ORDERED_QNAMES_ARRAY( meta_info, env);
+    }
+    else
+    {
+        qnames = W2C_SCHEMA_WRITER_META_INFO_GET_QNAMES_ARRAY( meta_info, env);
+    }
+    size = AXIS2_ARRAY_LIST_SIZE( qnames, env);
+    for( i = 0; i < size; i ++)
+    {
+        qname = AXIS2_ARRAY_LIST_GET( qnames, env, i);
+        property = w2c_xslt_utils_add_child_node( env, "property", model);
+        localpart = AXIS2_QNAME_GET_LOCALPART( qname, env);
+        nsuri = AXIS2_QNAME_GET_URI( qname, env);
+        unique_name = w2c_schema_writer_make_unique_struct_name( localpart, env);
+
+        w2c_xslt_utils_add_attribute( env, property, "name", localpart);
+        w2c_xslt_utils_add_attribute( env, property, "cname", unique_name);
+        w2c_xslt_utils_add_attribute( env, property, "nsuri", nsuri);
+       
+        classname =  
+          W2C_SCHEMA_WRITER_META_INFO_GET_CLASSNAME4QNAME( meta_info, env, qname);
+        if( NULL == classname )
+        {
+            return AXIS2_FAILURE;
+        }
+        caps_name = AXIS2_STRDUP( name, env);
+        caps_type = AXIS2_STRDUP( classname, env);
+
+        caps_name = axis2_string_toupper( caps_name);
+        caps_type = axis2_string_toupper( caps_type);
+        w2c_xslt_utils_add_attribute( env, property, "caps-name", caps_name);
+        w2c_xslt_utils_add_attribute( env, property, "caps-type", caps_type);
+
+        is_primitive = w2c_schema_writer_is_primitive( classname, env);
+        if ( is_primitive)
+        {
+            w2c_xslt_utils_add_attribute( env, property, "primitive", "yes");
+        }
+        /* add an attribute that says the type is default */
+        is_default = w2c_schema_writer_is_default( classname, env);
+        if ( is_default)
+        {
+            w2c_xslt_utils_add_attribute( env, property, "default", "yes");
+        }
+        schema_qname = W2C_SCHEMA_WRITER_META_INFO_GET_SCHEMA_QNAME4QNAME( meta_info, env, qname);
+        qname_str = AXIS2_QNAME_TO_STRING( schema_qname, env);
+        schema_type = axis2_hash_get( writer_impl-> typemap, qname_str, AXIS2_HASH_KEY_STRING);
+
+        if ( schema_type != NULL)
+        {
+            w2c_xslt_utils_add_attribute( env, property, "ours", "yes");
+        }
+        if ( W2C_SCHEMA_WRITER_META_INFO_GET_ATTRI_STATUS4QNAME( meta_info, env, qname))
+        {
+            w2c_xslt_utils_add_attribute( env, property, "attribute", "yes");
+        }
+        if( W2C_SCHEMA_WRITER_META_INFO_IS_NILLABLE( meta_info, env, name,))
+        {
+            w2c_xslt_utils_add_attribute( env, property, "nillable", "yes");
+        }
+        schema_type = axis2_hash_get( writer_impl-> base_typemap, qname_str, AXIS2_HASH_KEY_STRING);
+        if ( schema_qname != NULL && schema_type != NULL)
+        {
+            short_type_name = AXIS2_QNAME_GET_LOCALPART( schema_qname, env);
+        }
+        else
+        {
+            short_type_qname = w2c_schema_writer_get_short_typename( schema_qname, env);
+        }
+
+        if( is_inherited)
+        {
+            w2c_xslt_utils_add_attribute( env, property, "inherited", "yes");
+        }
+
+        if( W2C_SCHEMA_WRITER_META_INFO_IS_GET_ANYSTATUS4QNAME( meta_info, env, qname))
+        {
+            w2c_xslt_utils_add_attribute( env, property, "any", "yes");
+        }
+        if( W2C_SCHEMA_WRITER_META_INFO_IS_GET_BINARYSTATUS4QNAME( meta_info, env, qname))
+        {
+            w2c_xslt_utils_add_attribute( env, property, "binary", "yes");
+        }
+
+        minoccurs = W2C_SCHEMA_WRITER_META_INFO_IS_GET_MINOCCURS( meta_info, env, qname);
+        sprintf(number_str, "%d", minoccurs);
+        w2c_xslt_utils_add_attribute( env, property, "minOccurs", number_str);
+
+        if ( W2C_SCHEMA_WRITER_META_INFO_IS_GET_ARRAY_STATUS4QNAME( meta_info, env, qname) )
+        {
+            w2c_xslt_utils_add_attribute( env, property, "isarray", "yes");
+            w2c_xslt_utils_add_attribute( env, property, "arrayBaseType", "classname");
+        }
+        max_occurs = W2C_SCHEMA_WRITER_META_INFO_GET_MAX_OCCURS( meta_info, env, qname);
+        if ( max_occurs == LONG_MIN )
+        {
+            w2c_xslt_utils_add_attribute( env, property, "unbound", "yes");
+        }
+        sprintf(number_str, "%d", maxoccurs);
+        w2c_xslt_utils_add_attribute( env, property, "maxOccurs", number_str);
+    }
+    return AXIS2_SUCCESS;
+} 

Added: webservices/axis2/trunk/c/tools/codegen/src/schema2code.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/schema2code.c?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/schema2code.c (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/schema2code.c Fri Sep  1 05:45:57 2006
@@ -0,0 +1,102 @@
+#include <w2c_messages.h>
+#include <axis2_util.h>
+#include <axiom_xml_reader.h>
+#include <axiom_stax_builder.h>
+#include <axiom_document.h>
+#include <xml_schema_collection.h>
+#include <xml_schema_current_schema.h>
+#include <w2c_schema_compiler_options.h>
+#include <w2c_schema_compiler.h>
+
+static void
+w2c_schema_print_message( const axis2_env_t *env, axis2_properties_t *messageh,
+                   axis2_char_t *key);
+
+static void 
+w2c_schema_print_usage( const axis2_env_t *env );
+
+static void
+w2c_schema_compile( const axis2_env_t *env, axis2_char_t *schema_name,
+        axis2_char_t *output);
+
+int main(int argc, char **argv )
+{
+    const axis2_env_t *env = NULL;
+    axis2_allocator_t *allocator = NULL;
+    axis2_char_t *ouput_location
+
+    allocator = axis2_allocator_init(NULL);
+    env = axis2_env_create(allocator);
+
+    if ( argc == 3 )
+    {
+        w2c_schema_compile( env, argv[1], argv[2]);
+    }
+    else if ( argc == 2 )
+    {
+        w2c_schema_compile( env, argv[1], ".");
+    }
+    else
+    {
+        w2c_schema_print_usage( env);
+    }
+
+    axis2_allocator_free(allocator);
+    axis2_env_free ( env );
+    return 0;
+}
+
+static void
+w2c_schema_compile( const axis2_env_t *env, axis2_char_t *schema_name,
+        axis2_char_t *output)
+{
+    axiom_xml_reader_t *reader = NULL;
+    axiom_stax_builder_t *om_builder = NULL;
+    axiom_document_t *doc   = NULL;
+    xml_schema_collection_t *collection = NULL;
+    xml_schema current_schema_t *current_schema = NULL;
+    w2c_schema_compiler_options_t *compiler_options = NULL;
+    w2c_schema_compiler_t *compiler = NULL;
+
+    reader = axiom_xml_reader_create_for_file(env, schema_name, NULL);
+    if ( NULL == reader )
+    {
+        return NULL;
+    }
+    om_builder = axiom_stax_builder_create(env, reader);
+    doc = axiom_document_create(env, NULL, om_builder);
+    AXIOM_DOCUMENT_BUILD_ALL(doc, env);
+
+    collection = xml_schema_collection_create( env);
+    current_schema = XML_SCHEMA_COLLECTION_READ_DOCUMENT( collection, env, doc);
+
+    compiler_options = w2c_schema_compiler_options_create( env);
+    W2C_SCHEMA_COMPILER_OPTIONS_SET_OUTPUT_LOCATION( compiler_options, output);
+    W2C_SCHEMA_COMPILER_OPTIONS_SET_WRAP_CLASSES( compiler_options, AXIS2_TRUE);
+    W2C_SCHEMA_COMPILER_OPTIONS_SET_WRITE_OUT( compiler_options, AXIS2_TRUE);
+
+    compiler = w2c_schema_compiler_create( env, compiler_options);
+    w2c_schema_compiler_compile( compiler, env, current_schema);
+}
+ 
+static void 
+w2c_schema_print_usage( const axis2_env_t *env )
+{
+    axis2_properties_t *props = NULL:
+   
+    prop = w2c_messages_get_message_properties( env );
+    w2c_print_message ( env, env,"schema2code.arg1");
+    w2c_print_message ( env, env,"schema2code.arg2");
+    
+    AXIS2_PROPERTIES_FREE( props, env);
+}
+
+static void
+w2c_schema_print_message( const axis2_env_t *env,
+        axis2_properties_t *messagep, axis2_char_t *key)
+{
+   axis2_char_t *message = NULL;
+   message = (axis2_char_t *)
+                AXIS2_PROPERTIES_GET_PROPERTY(messagep, env, key); 
+   printf ( "%s\n", message );
+}

Added: webservices/axis2/trunk/c/tools/codegen/src/templates/c/ServiceSkeleton.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/templates/c/ServiceSkeleton.xsl?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/templates/c/ServiceSkeleton.xsl (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/templates/c/ServiceSkeleton.xsl Fri Sep  1 05:45:57 2006
@@ -0,0 +1,221 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="text"/>
+
+      <!--Template for in out message receiver -->
+      <xsl:template match="/interface">
+        <xsl:variable name="skeletonname"><xsl:value-of select="@name"/></xsl:variable>
+        <xsl:variable name="qname"><xsl:value-of select="@qname"/></xsl:variable>
+        <xsl:variable name="method-prefix"><xsl:value-of select="@prefix"/></xsl:variable>
+        <xsl:variable name="svcop-prefix"><xsl:value-of select="@svcop_prefix"/></xsl:variable>
+        <xsl:variable name="svcname"><xsl:value-of select="@svcname"/></xsl:variable>
+        <xsl:variable name="soapVersion"><xsl:value-of select="@soap-version"/></xsl:variable>
+
+        /**
+         * <xsl:value-of select="@name"/>.c
+         *
+         * This file was auto-generated from WSDL for "<xsl:value-of select="$qname"/>" service
+         * by the Apache Axis2 version: #axisVersion# #today#
+         *  <xsl:value-of select="$skeletonname"/>
+         */
+
+        #include "<xsl:value-of select="$svcop-prefix"/>.h"
+        #include &lt;axis2_svc_skeleton.h&gt;
+        #include &lt;axis2_array_list.h&gt;
+        #include &lt;stdio.h&gt;
+
+        /**
+         * functions prototypes
+         */
+
+        /* On fault, handle the fault */
+        axiom_node_t* AXIS2_CALL
+        <xsl:value-of select="$method-prefix"/>_on_fault(axis2_svc_skeleton_t *svc_skeleton,
+                  const axis2_env_t *env, axiom_node_t *node);
+
+        /* Free the service */
+        int AXIS2_CALL
+        <xsl:value-of select="$method-prefix"/>_free(axis2_svc_skeleton_t *svc_skeleton,
+                  const axis2_env_t *env);
+
+        /* This method invokes the right service method */
+        axiom_node_t* AXIS2_CALL
+        <xsl:value-of select="$method-prefix"/>_invoke(axis2_svc_skeleton_t *svc_skeleton,
+                    const axis2_env_t *env,
+                    axiom_node_t *node,
+                    axis2_msg_ctx_t *msg_ctx);
+
+        /* Initializing the environment  */
+        int AXIS2_CALL
+        <xsl:value-of select="$method-prefix"/>_init(axis2_svc_skeleton_t *svc_skeleton,
+                        const axis2_env_t *env);
+
+        /* Create the service  */
+        axis2_svc_skeleton_t* AXIS2_CALL
+        <xsl:value-of select="$method-prefix"/>_create(const axis2_env_t *env);
+
+        /**
+         * Implementations for the functions
+         */
+
+	axis2_svc_skeleton_t* AXIS2_CALL
+	<xsl:value-of select="$method-prefix"/>_create(const axis2_env_t *env)
+	{
+	    axis2_svc_skeleton_t *svc_skeleton = NULL;
+	    svc_skeleton = AXIS2_MALLOC(env->allocator,
+	        sizeof(axis2_svc_skeleton_t));
+
+
+	    svc_skeleton->ops = AXIS2_MALLOC(
+	        env->allocator, sizeof(axis2_svc_skeleton_ops_t));
+
+	    svc_skeleton->func_array = NULL;
+
+	    svc_skeleton->ops->free = <xsl:value-of select="$method-prefix"/>_free;
+	    svc_skeleton->ops->init = <xsl:value-of select="$method-prefix"/>_init;
+	    svc_skeleton->ops->invoke = <xsl:value-of select="$method-prefix"/>_invoke;
+	    svc_skeleton->ops->on_fault = <xsl:value-of select="$method-prefix"/>_on_fault;
+
+	    return svc_skeleton;
+	}
+
+
+	int AXIS2_CALL
+	<xsl:value-of select="$method-prefix"/>_init(axis2_svc_skeleton_t *svc_skeleton,
+	                        const axis2_env_t *env)
+	{
+	    svc_skeleton->func_array = axis2_array_list_create(env, 10);
+        <xsl:for-each select="method">
+	      AXIS2_ARRAY_LIST_ADD(svc_skeleton->func_array, env, "<xsl:value-of select="@localpart"/>");
+        </xsl:for-each>
+
+	    /* Any initialization stuff of <xsl:value-of select="$svcname"/> goes here */
+	    return AXIS2_SUCCESS;
+	}
+
+	int AXIS2_CALL
+	<xsl:value-of select="$method-prefix"/>_free(axis2_svc_skeleton_t *svc_skeleton,
+				 const axis2_env_t *env)
+	{
+          if(svc_skeleton->func_array)
+          {
+            AXIS2_ARRAY_LIST_FREE(svc_skeleton->func_array, env);
+            svc_skeleton->func_array = NULL;
+          }
+
+          if(svc_skeleton->ops)
+          {
+            AXIS2_FREE(env->allocator, svc_skeleton->ops);
+            svc_skeleton->ops = NULL;
+          }
+
+          if(svc_skeleton)
+          {
+            AXIS2_FREE(env->allocator, svc_skeleton);
+            svc_skeleton = NULL;
+          }
+          return AXIS2_SUCCESS;
+	}
+
+
+	/*
+	 * This method invokes the right service method
+	 */
+	axiom_node_t* AXIS2_CALL
+	<xsl:value-of select="$method-prefix"/>_invoke(axis2_svc_skeleton_t *svc_skeleton,
+				const axis2_env_t *env,
+				axiom_node_t *content_node,
+				axis2_msg_ctx_t *msg_ctx)
+	{
+         /* depending on the function name invoke the
+          * corresponding  method
+          */
+          <!--here the databinding support code is removed-->
+          axiom_element_t *element = NULL;
+
+          if (content_node)
+	      {
+            if (AXIOM_NODE_GET_NODE_TYPE(content_node, env) == AXIOM_ELEMENT)
+            {
+               element = (axiom_element_t *)AXIOM_NODE_GET_DATA_ELEMENT(content_node, env);
+               if (element)
+               {
+                  axis2_char_t *op_name = AXIOM_ELEMENT_GET_LOCALNAME(element, env);
+                  if (op_name)
+                  {
+                    <xsl:for-each select="method">
+
+                    <xsl:variable name="soapAction"><xsl:value-of select="@soapaction"></xsl:value-of></xsl:variable>
+                    <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
+                    <xsl:variable name="style"><xsl:value-of select="@style"/></xsl:variable>
+                    <xsl:variable name="method-name"><xsl:value-of select="@name"/></xsl:variable>
+                    <xsl:variable name="method-ns"><xsl:value-of select="@namespace"/> </xsl:variable>
+                    <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
+
+                    if ( AXIS2_STRCMP(op_name, "<xsl:value-of select="@localpart"/>") == 0 )
+                    {
+                         <!--TODO:remove the hard coded parameters -->
+                         <xsl:if test="$outputtype!=''">return </xsl:if>
+                         <xsl:text> </xsl:text>
+                         <xsl:value-of select="$svcop-prefix"/>_<xsl:value-of select="$method-name"/>(env <xsl:for-each select="input/param[@type!='']"> ,
+                                              content_node </xsl:for-each>);
+                         <xsl:if test="$outputtype=''">return NULL;</xsl:if>
+                    
+                    }
+                    </xsl:for-each>
+                  }
+                }
+             }
+          }
+          printf("<xsl:value-of select="$skeletonname"/> service ERROR: invalid OM parameters in request\n");
+          return content_node;
+        }
+
+    axiom_node_t* AXIS2_CALL
+    <xsl:value-of select="$method-prefix"/>_on_fault(axis2_svc_skeleton_t *svc_skeleton,
+                  const axis2_env_t *env, axiom_node_t *node)
+	{
+		axiom_node_t *error_node = NULL;
+		    axiom_node_t* text_node = NULL;
+		axiom_element_t *error_ele = NULL;
+		error_ele = axiom_element_create(env, node, "<xsl:value-of select="$skeletonname"/>Error", NULL,
+    					&amp;error_node);
+		AXIOM_ELEMENT_SET_TEXT(error_ele, env, "<xsl:value-of select="$skeletonname"/>failed",
+    					text_node);
+		return error_node;
+	}
+
+
+	/**
+	 * Following block distinguish the exposed part of the dll.
+ 	 */
+
+    AXIS2_EXTERN int AXIS2_CALL
+    axis2_get_instance(struct axis2_svc_skeleton **inst,
+	                        const axis2_env_t *env)
+	{
+		*inst = <xsl:value-of select="$method-prefix"/>_create(env);
+		
+        if(!(*inst))
+        {
+            return AXIS2_FAILURE;
+        }
+
+  		return AXIS2_SUCCESS;
+	}
+
+	AXIS2_EXTERN int AXIS2_CALL
+    axis2_remove_instance(axis2_svc_skeleton_t *inst,
+                            const axis2_env_t *env)
+	{
+        axis2_status_t status = AXIS2_FAILURE;
+       	if (inst)
+        {
+            status = AXIS2_SVC_SKELETON_FREE(inst, env);
+        }
+    	return status;
+	}
+
+
+    </xsl:template>
+
+</xsl:stylesheet>

Propchange: webservices/axis2/trunk/c/tools/codegen/src/templates/c/ServiceSkeleton.xsl
------------------------------------------------------------------------------
    svn:executable = *

Added: webservices/axis2/trunk/c/tools/codegen/src/templates/c/ServiceXMLTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/templates/c/ServiceXMLTemplate.xsl?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/templates/c/ServiceXMLTemplate.xsl (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/templates/c/ServiceXMLTemplate.xsl Fri Sep  1 05:45:57 2006
@@ -0,0 +1,25 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
+
+    <xsl:template match="/">
+        <xsl:comment> This file was auto-generated from WSDL </xsl:comment>
+        <xsl:comment> by the Apache Axis2 version: #axisVersion# #today# </xsl:comment>
+        <xsl:apply-templates/>
+    </xsl:template>
+
+    <xsl:template match="interface">
+
+        <service>
+            <xsl:attribute name="name"><xsl:value-of select="@servicename"/></xsl:attribute>
+
+            <parameter name="ServiceClass" locked="false">
+                        <xsl:value-of select="@servicename"/>
+            </parameter>
+			<xsl:for-each select="method">
+				<operation>
+					<xsl:attribute name="name"><xsl:value-of select="@localpart"/></xsl:attribute>
+				</operation>
+			</xsl:for-each>
+        </service>
+    </xsl:template>
+</xsl:stylesheet>

Propchange: webservices/axis2/trunk/c/tools/codegen/src/templates/c/ServiceXMLTemplate.xsl
------------------------------------------------------------------------------
    svn:executable = *

Added: webservices/axis2/trunk/c/tools/codegen/src/templates/c/SkelHeaderTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/templates/c/SkelHeaderTemplate.xsl?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/templates/c/SkelHeaderTemplate.xsl (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/templates/c/SkelHeaderTemplate.xsl Fri Sep  1 05:45:57 2006
@@ -0,0 +1,62 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="text"/>
+    <xsl:template match="/interface">
+    <xsl:variable name="svc_name"><xsl:value-of select="@name"/></xsl:variable>
+    <xsl:variable name="method-prefix"><xsl:value-of select="@prefix"/></xsl:variable>
+    <xsl:variable name="qname"><xsl:value-of select="@qname"/></xsl:variable>
+
+    /**
+     * <xsl:value-of select="@name"/>.h
+     *
+     * This file was auto-generated from WSDL for "<xsl:value-of select="$qname"/>" service
+     * by the Apache Axis2/C version: #axisVersion# #today#
+     * <xsl:value-of select="@name"/> Axis2/C skeleton for the axisService- Header file
+     */
+
+	
+	#include &lt;axis2_svc_skeleton.h&gt;
+	#include &lt;axis2_log_default.h&gt;
+	#include &lt;axis2_error_default.h&gt;
+	#include &lt;axiom_text.h&gt;
+	#include &lt;axiom_node.h&gt;
+	#include &lt;axiom_element.h&gt;
+    #include &lt;stdio.h&gt;
+
+
+   <xsl:for-each select="method">
+    <xsl:if test="output/param[@ours and @type!='']">
+     <xsl:variable name="outputtype">axis2_<xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
+     #include  "<xsl:value-of select="$outputtype"/>.h"
+    </xsl:if>
+    <xsl:for-each select="input/param[@type!='' and @ours]">
+     <xsl:variable name="inputtype">axis2_<xsl:value-of select="@type"></xsl:value-of></xsl:variable>
+     #include "<xsl:value-of select="$inputtype"/>.h"
+    </xsl:for-each>
+   </xsl:for-each>
+
+
+     <xsl:for-each select="method">
+         <xsl:variable name="outputours"><xsl:value-of select="output/param/@ours"></xsl:value-of></xsl:variable>
+         <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
+         <xsl:variable name="count"><xsl:value-of select="count(output/param)"/></xsl:variable>
+
+		 <!-- regardless of the sync or async status, the generated method signature would be just a usual
+	           c function-->
+        /**
+         * auto generated function declaration
+         * for "<xsl:value-of select="@qname"/>" operation.
+         <!--  select only the body parameters  -->
+         <xsl:for-each select="input/param[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
+         */
+        <xsl:choose>
+        <xsl:when test="$outputtype=''">axis2_status_t </xsl:when>
+        <xsl:when test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:when>
+        </xsl:choose>
+        <xsl:text> </xsl:text>
+        <xsl:value-of select="$method-prefix"/>_<xsl:value-of select="@name"/> (const axis2_env_t *env <xsl:for-each select="input/param[@type!='']"> ,
+                                          <xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+                                          </xsl:for-each> );
+     </xsl:for-each>
+
+    </xsl:template>
+ </xsl:stylesheet>

Propchange: webservices/axis2/trunk/c/tools/codegen/src/templates/c/SkelHeaderTemplate.xsl
------------------------------------------------------------------------------
    svn:executable = *

Added: webservices/axis2/trunk/c/tools/codegen/src/templates/c/SkelSourceTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/templates/c/SkelSourceTemplate.xsl?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/templates/c/SkelSourceTemplate.xsl (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/templates/c/SkelSourceTemplate.xsl Fri Sep  1 05:45:57 2006
@@ -0,0 +1,47 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="text"/>
+    <xsl:template match="/interface">
+    <xsl:variable name="svc_name"><xsl:value-of select="@name"/></xsl:variable>
+    <xsl:variable name="method-prefix"><xsl:value-of select="@prefix"/></xsl:variable>
+    <xsl:variable name="qname"><xsl:value-of select="@qname"/></xsl:variable>
+
+    /**
+     * <xsl:value-of select="@name"/>.c 
+     *
+     * This file was auto-generated from WSDL for "<xsl:value-of select="$qname"/>" service
+     * by the Apache Axis2/C version: #axisVersion# #today#
+     * <xsl:value-of select="@name"/> Axis2/C skeleton for the axisService
+     */
+
+     #include "<xsl:value-of select="@name"/>.h"
+
+     <xsl:for-each select="method">
+         <xsl:variable name="outputours"><xsl:value-of select="output/param/@ours"></xsl:value-of></xsl:variable>
+         <xsl:variable name="count"><xsl:value-of select="count(output/param)"/></xsl:variable>
+         <xsl:variable name="outputtype"><xsl:choose><xsl:when test="output/param/@type='org.apache.axiom.om.OMElement'">axiom_node_t*</xsl:when><xsl:otherwise><xsl:if test="output/param/@ours">axis2_</xsl:if><xsl:value-of select="output/param/@type"></xsl:value-of><xsl:if test="output/param/@ours">_t*</xsl:if></xsl:otherwise></xsl:choose></xsl:variable>
+
+		 <!-- regardless of the sync or async status, the generated method signature would be just a usual
+	           c function-->
+        /**
+         * auto generated function definition signature
+         * for "<xsl:value-of select="@qname"/>" operation.
+         <!--  select only the body parameters  -->
+         <xsl:for-each select="input/param[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
+         */
+        <xsl:choose>
+        <xsl:when test="$outputtype=''">axis2_status_t </xsl:when>
+        <xsl:when test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:when>
+        </xsl:choose>
+        <xsl:text> </xsl:text>
+        <xsl:value-of select="$method-prefix"/>_<xsl:value-of select="@name"/> (const axis2_env_t *env <xsl:for-each select="input/param[@type!='']"> ,
+                                          <xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+                                          </xsl:for-each> )
+        {
+          /* TODO fill this with the necessary business logic */
+          <xsl:if test="$outputtype!=''">return NULL;</xsl:if>
+          <xsl:if test="$outputtype=''">return AXIS2_SUCCESS;</xsl:if>
+        }
+     </xsl:for-each>
+
+    </xsl:template>
+ </xsl:stylesheet>

Propchange: webservices/axis2/trunk/c/tools/codegen/src/templates/c/SkelSourceTemplate.xsl
------------------------------------------------------------------------------
    svn:executable = *

Added: webservices/axis2/trunk/c/tools/codegen/src/templates/c/StubHeaderTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/templates/c/StubHeaderTemplate.xsl?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/templates/c/StubHeaderTemplate.xsl (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/templates/c/StubHeaderTemplate.xsl Fri Sep  1 05:45:57 2006
@@ -0,0 +1,107 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="text"/>
+
+    <xsl:template match="/class">
+        <xsl:variable name="interfaceName"><xsl:value-of select="@interfaceName"/></xsl:variable>
+        <xsl:variable name="package"><xsl:value-of select="@package"/></xsl:variable>
+        <xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
+        <xsl:variable name="isSync"><xsl:value-of select="@isSync"/></xsl:variable>
+        <xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
+        <xsl:variable name="soapVersion"><xsl:value-of select="@soap-version"/></xsl:variable>
+        <xsl:variable name="method-prefix"><xsl:value-of select="@prefix"/></xsl:variable>
+        <xsl:variable name="qname"><xsl:value-of select="@qname"/></xsl:variable>
+
+        /**
+        * <xsl:value-of select="@name"/>.h
+        *
+        * This file was auto-generated from WSDL for "<xsl:value-of select="$qname"/>" service
+        * by the Apache Axis2/C version: #axisVersion# #today#
+        */
+
+        #include &lt;stdio.h&gt;
+        #include &lt;axiom.h&gt;
+        #include &lt;axis2_util.h&gt;
+        #include &lt;axiom_soap.h&gt;
+        #include &lt;axis2_client.h&gt;
+        #include &lt;axis2_stub.h&gt;
+
+       <xsl:for-each select="method">
+        <xsl:if test="output/param[@ours and @type!='']">
+         <xsl:variable name="outputtype">axis2_<xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
+         #include  "<xsl:value-of select="$outputtype"/>.h"
+        </xsl:if>
+        <xsl:for-each select="input/param[@type!='' and @ours ]">
+         <xsl:variable name="inputtype">axis2_<xsl:value-of select="@type"></xsl:value-of></xsl:variable>
+         #include "<xsl:value-of select="$inputtype"/>.h"
+        </xsl:for-each>
+       </xsl:for-each>
+        /* function prototypes - for header file*/
+        /**
+         * <xsl:value-of select="$method-prefix"/>_create
+         * create and return the stub with services populated
+         * params - env : environment ( mandatory)
+         *        - client_home : Axis2/C home ( mandatory )
+         *        - endpoint_uri : service endpoint uri( optional ) - if NULL default picked from wsdl used
+         */
+        axis2_stub_t*
+        <xsl:value-of select="$method-prefix"/>_create (const axis2_env_t *env,
+                                        axis2_char_t *client_home,
+                                        axis2_char_t *endpoint_uri);
+        /**
+         * <xsl:value-of select="$method-prefix"/>_populate_services
+         * populate the svc in stub with the service and operations
+         */
+        void <xsl:value-of select="$method-prefix"/>_populate_services( axis2_stub_t *stub, const axis2_env_t *env);
+        /**
+         * <xsl:value-of select="$method-prefix"/>_get_endpoint_uri_from_wsdl
+         * return the endpoint URI picked from wsdl
+         */
+        axis2_char_t *<xsl:value-of select="$method-prefix"/>_get_endpoint_uri_from_wsdl ( const axis2_env_t *env );
+
+        <xsl:if test="$isSync='1'">
+        <xsl:for-each select="method">
+        /**
+         * auto generated function declaration
+         * for "<xsl:value-of select="@qname"/>" operation.
+         <!--  select only the body parameters  -->
+         <xsl:for-each select="input/param[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
+         */
+
+        <xsl:variable name="outputours"><xsl:value-of select="output/param/@ours"></xsl:value-of></xsl:variable>
+        <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
+        <xsl:choose>
+        <xsl:when test="$outputtype=''">axis2_status_t</xsl:when>
+        <xsl:when test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:when>
+        </xsl:choose>
+        <xsl:text> </xsl:text>
+        <xsl:value-of select="$method-prefix"/>_<xsl:value-of select="@name"/>( axis2_stub_t *stub, const axis2_env_t *env <xsl:for-each select="input/param[@type!='']"> ,
+                                                <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+                                                </xsl:for-each>);
+        </xsl:for-each>
+        </xsl:if>  <!--close for  test="$isSync='1'-->
+
+        <!-- Async method prototype generation -->
+        <xsl:if test="$isAsync='1'">
+        <xsl:for-each select="method">
+        /**
+         * auto generated function declaration
+         * for "<xsl:value-of select="@qname"/>" operation.
+         <!--  select only the body parameters  -->
+         <xsl:for-each select="input/param[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
+         * @param on_complete callback to handle on complete
+         * @param on_error callback to handle on error 
+         */
+
+        <xsl:variable name="mep"><xsl:value-of select="@mep"/></xsl:variable>
+        <xsl:if test="$mep='12'">
+        void <xsl:value-of select="$method-prefix"/>_<xsl:value-of select="@name"/>_start( axis2_stub_t *stub, const axis2_env_t *env, <xsl:for-each select="input/param[@type!='']">
+                                                    <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+                                                    </xsl:for-each>,
+                                                    axis2_status_t ( AXIS2_CALL *on_complete ) (struct axis2_callback *, const axis2_env_t* ) ,
+                                                    axis2_status_t ( AXIS2_CALL *on_error ) (struct axis2_callback *, const axis2_env_t*, int ) );
+
+        </xsl:if>  <!--close for  test="$mep='http://www.w3.org/2004/08/wsdl/in-out'"-->
+        </xsl:for-each>
+        </xsl:if>  <!--close for  test="$isAsync='1'-->
+   </xsl:template>
+</xsl:stylesheet>

Propchange: webservices/axis2/trunk/c/tools/codegen/src/templates/c/StubHeaderTemplate.xsl
------------------------------------------------------------------------------
    svn:executable = *

Added: webservices/axis2/trunk/c/tools/codegen/src/templates/c/StubSourceTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/templates/c/StubSourceTemplate.xsl?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/templates/c/StubSourceTemplate.xsl (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/templates/c/StubSourceTemplate.xsl Fri Sep  1 05:45:57 2006
@@ -0,0 +1,516 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="text"/>
+    
+    <xsl:template match="/class">
+      <xsl:variable name="interfaceName"><xsl:value-of select="@interfaceName"/></xsl:variable>
+      <xsl:variable name="package"><xsl:value-of select="@package"/></xsl:variable>
+      <xsl:variable name="isSync"><xsl:value-of select="@isSync"/></xsl:variable>
+      <xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
+      <xsl:variable name="soapVersion"><xsl:value-of select="@soap-version"/></xsl:variable>
+      <xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
+      <xsl:variable name="method-prefix"><xsl:value-of select="@prefix"/></xsl:variable>
+      <xsl:variable name="qname"><xsl:value-of select="@qname"/></xsl:variable>
+
+      /**
+       * <xsl:value-of select="@name"/>.c
+       *
+       * This file was auto-generated from WSDL for "<xsl:value-of select="$qname"/>" service
+       * by the Apache Axis2/C version: #axisVersion# #today#
+       */
+
+      #include "<xsl:value-of select="@name"/>.h"
+
+      /**
+       * <xsl:value-of select="@name"/> C implementation
+       */
+
+      axis2_stub_t*
+      <xsl:value-of select="$method-prefix"/>_create (const axis2_env_t *env,
+                                      axis2_char_t *client_home,
+                                      axis2_char_t *endpoint_uri)
+      {
+         axis2_stub_t *stub = NULL;
+         axis2_endpoint_ref_t *endpoint_ref = NULL;
+         AXIS2_FUNC_PARAM_CHECK ( client_home, env, NULL)
+
+         if (NULL == endpoint_uri )
+         {
+            endpoint_uri = <xsl:value-of select="$method-prefix"/>_get_endpoint_uri_from_wsdl( env );
+         }
+
+         endpoint_ref = axis2_endpoint_ref_create(env, endpoint_uri);
+
+         stub = axis2_stub_create_with_endpoint_ref_and_client_home ( env, endpoint_ref, client_home );
+         <xsl:value-of select="$method-prefix"/>_populate_services( stub, env );
+         return stub;
+      }
+
+
+      void <xsl:value-of select="$method-prefix"/>_populate_services( axis2_stub_t *stub, const axis2_env_t *env)
+      {
+         axis2_svc_client_t *svc_client = NULL;
+         axis2_qname_t *svc_qname =  NULL;
+         axis2_qname_t *op_qname =  NULL;
+         axis2_svc_t *svc = NULL;
+         axis2_op_t *op = NULL;
+ 
+         /* Modifying the Service */
+         svc_client = AXIS2_STUB_GET_SVC_CLIENT (stub, env );
+         svc = (axis2_svc_t*)AXIS2_SVC_CLIENT_GET_AXIS_SERVICE ( svc_client, env );
+         axis2_qname_create(env,"<xsl:value-of select="@servicename"/>" ,NULL, NULL);
+         AXIS2_SVC_SET_QNAME (svc, env, svc_qname);
+ 
+         /* creating the operations*/
+ 
+         <xsl:for-each select="method">
+
+           op_qname = axis2_qname_create(env,
+                                         "<xsl:value-of select="@localpart"/>" ,
+                                         "<xsl:value-of select="@namespace"/>",
+                                         NULL);
+           op = axis2_op_create_with_qname(env, op_qname);
+           <xsl:choose>
+             <xsl:when test="@mep='10'">
+               AXIS2_OP_SET_MSG_EXCHANGE_PATTERN(op, env, AXIS2_MEP_URI_IN_ONLY);
+             </xsl:when>
+             <xsl:otherwise>
+               AXIS2_OP_SET_MSG_EXCHANGE_PATTERN(op, env, AXIS2_MEP_URI_OUT_IN);
+             </xsl:otherwise>
+           </xsl:choose>
+           AXIS2_SVC_ADD_OP(svc, env, op);
+ 
+         </xsl:for-each>
+      }
+
+      /**
+       *return end point picked from wsdl
+       */
+      axis2_char_t*
+      <xsl:value-of select="$method-prefix"/>_get_endpoint_uri_from_wsdl ( const axis2_env_t *env )
+      {
+        axis2_char_t *endpoint_uri = NULL;
+        /* set the address from here */
+        <xsl:for-each select="endpoint">
+          <xsl:choose>
+            <xsl:when test="position()=1">
+              endpoint_uri = "<xsl:value-of select="."/>";
+            </xsl:when>
+           </xsl:choose>
+        </xsl:for-each>
+        return endpoint_uri;
+      }
+
+
+  <xsl:for-each select="method">
+    <xsl:variable name="outputours"><xsl:value-of select="output/param/@ours"></xsl:value-of></xsl:variable>
+    <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
+    <xsl:variable name="capsoutputtype"><xsl:value-of select="output/param/@caps-type"></xsl:value-of></xsl:variable>
+    <xsl:variable name="style"><xsl:value-of select="@style"></xsl:value-of></xsl:variable>
+    <xsl:variable name="soapAction"><xsl:value-of select="@soapaction"></xsl:value-of></xsl:variable>
+    <xsl:variable name="mep"><xsl:value-of select="@mep"/></xsl:variable>
+
+    <xsl:variable name="method-name"><xsl:value-of select="@name"/></xsl:variable>
+    <xsl:variable name="method-ns"><xsl:value-of select="@namespace"/> </xsl:variable>
+
+    <!-- Code generation for the in-out mep -->
+    <xsl:if test="$mep='12'">
+      <xsl:if test="$isSync='1'">
+         /**
+          * auto generated method signature
+          * for "<xsl:value-of select="@qname"/>" operation.
+          <xsl:for-each select="input/param[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
+          */
+         <xsl:choose>
+         <xsl:when test="$outputtype=''">axis2_status_t</xsl:when>
+         <xsl:when test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:when>
+         </xsl:choose>
+         <xsl:text> </xsl:text>
+         <xsl:value-of select="$method-prefix"/>_<xsl:value-of select="@name"/>( axis2_stub_t *stub, const axis2_env_t *env <xsl:for-each select="input/param[@type!='']"> ,
+                                              <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+                                              </xsl:for-each>)
+         {
+            axis2_svc_client_t *svc_client = NULL;
+            axis2_options_t *options = NULL;
+            axiom_node_t *ret_node = NULL;
+
+            const axis2_char_t *soap_action = NULL;
+            axis2_qname_t *op_qname =  NULL;
+            axiom_node_t *payload = NULL;
+            <xsl:if test="output/param/@ours">
+            	<!-- this means data binding is enable -->
+              <xsl:value-of select="$outputtype"/> ret_val = NULL;
+            </xsl:if>
+
+
+           <xsl:for-each select="input/param[@type!='' and @ours]">
+              <xsl:if test="position()=1"> <!--declare only once-->
+                / *declarations for temp nodes to build input message */
+
+                <xsl:if test="$style='rpc'">
+                 axiom_attribute_t *attri1 = NULL;
+                 axiom_namespace_t *ns1 = NULL;
+                 axiom_namespace_t *xsi = NULL;
+                 axiom_namespace_t *xsd = NULL;
+                 axiom_element_t *payload_ele = NULL;
+                </xsl:if>
+              </xsl:if>
+            </xsl:for-each>
+
+            <xsl:for-each select="input/param[@type!='']">
+            <!-- for service client currently suppported only 1 input param -->
+            <xsl:variable name="paramtype"><xsl:choose><xsl:when test="@type='org.apache.axiom.om.OMElement'">axiom_node_t*</xsl:when><xsl:otherwise><xsl:if test="@ours">axis2_</xsl:if><xsl:value-of select="@type"></xsl:value-of><xsl:if test="@ours">_t*</xsl:if></xsl:otherwise></xsl:choose></xsl:variable>
+            <xsl:variable name="capsparamtype"><xsl:if test="@ours"></xsl:if><xsl:choose><xsl:when test="@type='org.apache.axiom.om.OMElement'">AXIOM_NODE</xsl:when><xsl:otherwise>AXIS2_<xsl:value-of select="@caps-type"></xsl:value-of></xsl:otherwise></xsl:choose></xsl:variable>
+               <xsl:choose>
+                   <xsl:when test="not(@ours)">
+                      <xsl:if test="position()=1">
+                        payload = <xsl:value-of select="@name"/>;
+                      </xsl:if>
+                   </xsl:when>
+                   <xsl:otherwise>
+                     <xsl:if test="position()=1">
+                     </xsl:if>
+                     <xsl:choose>
+                     <xsl:when test="$style='rpc'">
+                     <xsl:if test="position()=1">
+                         payload = <xsl:value-of select="$capsparamtype"/>_BUILD_OM(<xsl:value-of select="@name"/>, env, NULL, xsi, xsd );
+                         payload_ele =    AXIOM_NODE_GET_DATA_ELEMENT ( payload, env );
+                         xsi =
+                          axiom_namespace_create (env,
+                                                     <xsl:choose><xsl:when test="$soapVersion='1.2'">"http://www.w3.org/2001/XMLSchema-instance"</xsl:when><xsl:when test="$soapVersion='1.1'">"http://www.w3.org/1999/XMLSchema-instance"</xsl:when></xsl:choose>,
+                                                     "xsi");
+                         AXIOM_ELEMENT_DECLARE_NAMESPACE (payload_ele, env,
+                                                    payload, xsi);
+                         xsd =
+                          axiom_namespace_create (env,
+                                                     <xsl:choose><xsl:when test="$soapVersion='1.2'">"http://www.w3.org/2001/XMLSchema"</xsl:when><xsl:when test="$soapVersion='1.1'">"http://www.w3.org/1999/XMLSchema"</xsl:when></xsl:choose>,
+                                                     "xsd");
+                         AXIOM_ELEMENT_DECLARE_NAMESPACE (payload_ele, env,
+                                                    payload, xsd);
+                         ns1 =
+                          axiom_namespace_create (env,
+                                                     <xsl:choose><xsl:when test="$soapVersion='1.2'">AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI</xsl:when><xsl:when test="$soapVersion='1.1'">AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI</xsl:when></xsl:choose>,
+                                                     "soapenv");
+                         AXIOM_ELEMENT_DECLARE_NAMESPACE (payload_ele, env,
+                                                    payload, ns1);
+                         attri1 =
+                          axiom_attribute_create (env, "encodingStyle",
+                                                     "http://schemas.xmlsoap.org/soap/encoding/",
+                                                     ns1);
+                         AXIOM_ELEMENT_ADD_ATTRIBUTE (payload_ele, env,
+                                                    attri1, payload );
+                         </xsl:if>
+                     </xsl:when>
+                     <xsl:otherwise>
+                         payload = <xsl:value-of select="$capsparamtype"/>_BUILD_OM(<xsl:value-of select="@name"/>, env, NULL, NULL, NULL );
+
+                     </xsl:otherwise>
+                     </xsl:choose>
+                      <!--should this omit in doclit type?-->
+                      <!--AXIOM_ELEMENT_SET_NAMESPACE ( payload_ele, env, payload_ns, payload );-->
+                   </xsl:otherwise>
+               </xsl:choose>
+            </xsl:for-each>
+
+            options = AXIS2_STUB_GET_OPTIONS( stub, env);
+            if ( NULL == options )
+            {
+              AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "options is null in stub: Error code:"
+                   " %d :: %s", env->error->error_number,
+              AXIS2_ERROR_GET_MESSAGE(env->error));
+              return NULL;
+            }
+            svc_client = AXIS2_STUB_GET_SVC_CLIENT (stub, env );
+            soap_action = AXIS2_OPTIONS_GET_ACTION ( options, env );
+            if ( NULL == soap_action )
+            {
+              soap_action = "<xsl:value-of select="$soapAction"/>";
+              AXIS2_OPTIONS_SET_ACTION( options, env, soap_action );
+            }
+            <xsl:if test="$soapVersion='1.2'">
+            AXIS2_OPTIONS_SET_SOAP_VERSION(options, env, AXIOM_SOAP12 );
+            </xsl:if>
+            <xsl:if test="$soapVersion!='1.1'">
+            AXIS2_OPTIONS_SET_SOAP_VERSION(options, env, AXIOM_SOAP11 );
+            </xsl:if>
+            op_qname = axis2_qname_create(env,
+                                        "<xsl:value-of select="@localpart"/>" ,
+                                        "<xsl:value-of select="@namespace"/>",
+                                        NULL);
+            ret_node =  AXIS2_SVC_CLIENT_SEND_RECEIVE_WITH_OP_QNAME( svc_client, env, op_qname, payload);
+
+
+            <xsl:choose>
+                <xsl:when test="$outputtype=''">
+                 return;
+                </xsl:when>
+                <xsl:when test="output/param/@ours">
+                  if ( NULL == ret_node )
+                    return NULL;
+                  ret_val = axis2_<xsl:value-of select="output/param/@type"/>_create(env);
+
+                  <xsl:value-of select="$capsoutputtype"/>_PARSE_OM(ret_val, env, ret_node );
+                 return ret_val;
+                </xsl:when>
+                <xsl:otherwise>
+                 return ret_node;
+                </xsl:otherwise>
+            </xsl:choose>
+        }
+        </xsl:if>  <!--close for  test="$isSync='1'-->
+        <!-- Async method generation -->
+        <xsl:if test="$isAsync='1'">
+        /**
+          * auto generated method signature for asynchronous invocations
+          * for "<xsl:value-of select="@qname"/>" operation.
+          <!--  select only the body parameters  -->
+          <xsl:for-each select="input/param[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
+          * @param on_complete callback to handle on complete
+          * @param on_error callback to handle on error 
+          */
+         <xsl:variable name="callbackoncomplete"><xsl:value-of select="$callbackname"></xsl:value-of><xsl:text>_on_complete</xsl:text></xsl:variable>
+         <xsl:variable name="callbackonerror"><xsl:value-of select="$callbackname"></xsl:value-of><xsl:text>_on_error</xsl:text></xsl:variable>
+         void <xsl:value-of select="$method-prefix"/>_<xsl:value-of select="@name"/>_start( axis2_stub_t *stub, const axis2_env_t *env, <xsl:for-each select="input/param[@type!='']">
+                                                  <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+                                                  </xsl:for-each>,
+                                                  axis2_status_t ( AXIS2_CALL *on_complete ) (struct axis2_callback *, const axis2_env_t *) ,
+                                                  axis2_status_t ( AXIS2_CALL *on_error ) (struct axis2_callback *, const axis2_env_t *, int ) )
+         {
+
+            axis2_callback_t *callback = NULL;
+
+            axis2_svc_client_t *svc_client = NULL;
+            axis2_options_t *options = NULL;
+
+            const axis2_char_t *soap_action = NULL;
+            axiom_node_t *payload = NULL;
+
+           <xsl:for-each select="input/param[@type!='' and @ours]">
+              <xsl:if test="position()=1"> <!--declare only once-->
+                / *declarations for temp nodes to build input message */
+                <xsl:if test="$style='rpc'">
+                axiom_element_t *payload_ele = NULL;
+                 axiom_attribute_t *attri1 = NULL;
+                 axiom_namespace_t *ns1 = NULL;
+                 axiom_namespace_t *xsi = NULL;
+                 axiom_namespace_t *xsd = NULL;
+                </xsl:if>
+              </xsl:if>
+            </xsl:for-each>
+
+            <xsl:for-each select="input/param[@type!='']">
+            <!-- for service client currently suppported only 1 input param -->
+            <xsl:variable name="paramtype"><xsl:choose><xsl:when test="@type='org.apache.axiom.om.OMElement'">axiom_node_t*</xsl:when><xsl:otherwise><xsl:if test="@ours">axis2_</xsl:if><xsl:value-of select="@type"></xsl:value-of><xsl:if test="@ours">_t*</xsl:if></xsl:otherwise></xsl:choose></xsl:variable>
+            <xsl:variable name="capsparamtype"><xsl:if test="@ours"></xsl:if><xsl:choose><xsl:when test="@type='org.apache.axiom.om.OMElement'">AXIOM_NODE</xsl:when><xsl:otherwise>AXIS2_<xsl:value-of select="@caps-type"></xsl:value-of></xsl:otherwise></xsl:choose></xsl:variable>
+               <xsl:choose>
+                   <xsl:when test="not(@ours)">
+                      <xsl:if test="position()=1">
+                        payload = <xsl:value-of select="@name"/>;
+                      </xsl:if>
+                   </xsl:when>
+                   <xsl:otherwise>
+                     <xsl:if test="position()=1">
+                     </xsl:if>
+                     <xsl:choose>
+                     <xsl:when test="$style='rpc'">
+                     <xsl:if test="position()=1">
+                         payload = <xsl:value-of select="$capsparamtype"/>_BUILD_OM(<xsl:value-of select="@name"/>, env, NULL, xsi, xsd );
+                         payload_ele =    AXIOM_NODE_GET_DATA_ELEMENT ( payload, env );
+                         xsi =
+                          axiom_namespace_create (env,
+                                                     <xsl:choose><xsl:when test="$soapVersion='1.2'">"http://www.w3.org/2001/XMLSchema-instance"</xsl:when><xsl:when test="$soapVersion='1.1'">"http://www.w3.org/1999/XMLSchema-instance"</xsl:when></xsl:choose>,
+                                                     "xsi");
+                         AXIOM_ELEMENT_DECLARE_NAMESPACE (payload_ele, env,
+                                                    payload, xsi);
+                         xsd =
+                          axiom_namespace_create (env,
+                                                     <xsl:choose><xsl:when test="$soapVersion='1.2'">"http://www.w3.org/2001/XMLSchema"</xsl:when><xsl:when test="$soapVersion='1.1'">"http://www.w3.org/1999/XMLSchema"</xsl:when></xsl:choose>,
+                                                     "xsd");
+                         AXIOM_ELEMENT_DECLARE_NAMESPACE (payload_ele, env,
+                                                    payload, xsd);
+                         ns1 =
+                          axiom_namespace_create (env,
+                                                     <xsl:choose><xsl:when test="$soapVersion='1.2'">AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI</xsl:when><xsl:when test="$soapVersion='1.1'">AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI</xsl:when></xsl:choose>,
+                                                     "soapenv");
+                         AXIOM_ELEMENT_DECLARE_NAMESPACE (payload_ele, env,
+                                                    payload, ns1);
+                         attri1 =
+                          axiom_attribute_create (env, "encodingStyle",
+                                                     "http://schemas.xmlsoap.org/soap/encoding/",
+                                                     ns1);
+                         AXIOM_ELEMENT_ADD_ATTRIBUTE (payload_ele, env,
+                                                    attri1, payload );
+                         </xsl:if>
+                     </xsl:when>
+                     <xsl:otherwise>
+                         payload = <xsl:value-of select="$capsparamtype"/>_BUILD_OM(<xsl:value-of select="@name"/>, env, NULL, NULL, NULL );
+
+                     </xsl:otherwise>
+                     </xsl:choose>
+                      <!--should this omit in doclit type?-->
+                      <!--AXIOM_ELEMENT_SET_NAMESPACE ( payload_ele, env, payload_ns, payload );-->
+                   </xsl:otherwise>
+               </xsl:choose>
+            </xsl:for-each>
+
+            options = AXIS2_STUB_GET_OPTIONS( stub, env);
+            if ( NULL == options )
+            {
+              AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "options is null in stub: Error code:"
+                      " %d :: %s", env->error->error_number,
+                      AXIS2_ERROR_GET_MESSAGE(env->error));
+              return;
+            }
+            svc_client = AXIS2_STUB_GET_SVC_CLIENT (stub, env );
+            soap_action = AXIS2_OPTIONS_GET_ACTION ( options, env );
+            if ( NULL == soap_action )
+            {
+              soap_action = "<xsl:value-of select="$soapAction"/>";
+              AXIS2_OPTIONS_SET_ACTION( options, env, soap_action );
+            }
+            <xsl:choose>
+             <xsl:when test="$soapVersion='1.2'">
+            AXIS2_OPTIONS_SET_SOAP_VERSION(options, env, AXIOM_SOAP12 );
+             </xsl:when>
+             <xsl:otherwise>
+            AXIS2_OPTIONS_SET_SOAP_VERSION(options, env, AXIOM_SOAP11 );
+             </xsl:otherwise>
+            </xsl:choose>
+
+            callback = axis2_callback_create(env);
+            /* Set our on_complete fucntion pointer to the callback object */
+            AXIS2_CALLBACK_SET_ON_COMPLETE(callback, on_complete);
+            /* Set our on_error function pointer to the callback object */
+            AXIS2_CALLBACK_SET_ON_ERROR(callback, on_error);
+
+            /* Send request */
+            AXIS2_SVC_CLIENT_SEND_RECEIVE_NON_BLOCKING(svc_client, env, payload, callback);
+         }
+
+         </xsl:if>  <!--close for  test="$isASync='1'-->
+              <!-- End of in-out mep -->
+       </xsl:if> <!-- close for  test="$mep='http://www.w3.org/2004/08/wsdl/in-out' -->
+
+       <xsl:if test="$mep='10'">
+        /**
+         * Auto generated method signature
+         */
+         
+         axis2_status_t
+         <xsl:value-of select="$method-prefix"/>_<xsl:value-of select="@name"/>( axis2_stub_t *stub, const axis2_env_t *env <xsl:for-each select="input/param[@type!='']"> ,<xsl:variable name="paramtype"><xsl:choose><xsl:when test="@type='org.apache.axiom.om.OMElement'">axiom_node_t*</xsl:when><xsl:otherwise><xsl:if test="@ours">axis2_</xsl:if><xsl:value-of select="@type"></xsl:value-of><xsl:if test="@ours">_t*</xsl:if></xsl:otherwise></xsl:choose></xsl:variable>
+                                              <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$paramtype"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+                                              </xsl:for-each>)
+         {
+            axis2_status_t status;
+
+            axis2_svc_client_t *svc_client = NULL;
+            axis2_options_t *options = NULL;
+
+            axis2_char_t *soap_action = NULL;
+            axis2_qname_t *op_qname =  NULL;
+            axiom_node_t *payload = NULL;
+
+           <xsl:for-each select="input/param[@type!='' and @ours]">
+              <xsl:if test="position()=1"> <!--declare only once-->
+                /* declarations for temp nodes to build input message */
+                  
+                <xsl:if test="$style='rpc'">
+                axiom_element_t *payload_ele = NULL;
+                 axiom_attribute_t *attri1 = NULL;
+                 axiom_namespace_t *ns1 = NULL;
+                 axiom_namespace_t *xsi = NULL;
+                 axiom_namespace_t *xsd = NULL;
+                </xsl:if>
+              </xsl:if>
+            </xsl:for-each>
+
+           <xsl:for-each select="input/param[@type!='']">
+           <!-- for service client currently suppported only 1 input param -->
+           <xsl:variable name="paramtype"><xsl:choose><xsl:when test="@type='org.apache.axiom.om.OMElement'">axiom_node_t*</xsl:when><xsl:otherwise><xsl:if test="@ours">axis2_</xsl:if><xsl:value-of select="@type"></xsl:value-of><xsl:if test="@ours">_t*</xsl:if></xsl:otherwise></xsl:choose></xsl:variable>
+           <xsl:variable name="capsparamtype"><xsl:if test="@ours"></xsl:if><xsl:choose><xsl:when test="@type='org.apache.axiom.om.OMElement'">AXIOM_NODE</xsl:when><xsl:otherwise>AXIS2_<xsl:value-of select="@caps-type"></xsl:value-of></xsl:otherwise></xsl:choose></xsl:variable>
+              <xsl:choose>
+                  <xsl:when test="not(@ours)">
+                     <xsl:if test="position()=1">
+                       payload = <xsl:value-of select="@name"/>;
+                     </xsl:if>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:if test="position()=1">
+                    </xsl:if>
+                    <xsl:choose>
+                    <xsl:when test="$style='rpc'">
+                    <xsl:if test="position()=1">
+                        payload = <xsl:value-of select="$capsparamtype"/>_BUILD_OM(<xsl:value-of select="@name"/>, env, NULL, xsi, xsd );
+                        payload_ele =    AXIOM_NODE_GET_DATA_ELEMENT ( payload, env );
+                        xsi =
+                         axiom_namespace_create (env,
+                                                    <xsl:choose><xsl:when test="$soapVersion='1.2'">"http://www.w3.org/2001/XMLSchema-instance"</xsl:when><xsl:when test="$soapVersion='1.1'">"http://www.w3.org/1999/XMLSchema-instance"</xsl:when></xsl:choose>,
+                                                    "xsi");
+                        AXIOM_ELEMENT_DECLARE_NAMESPACE (payload_ele, env,
+                                                   payload, xsi);
+                        xsd =
+                         axiom_namespace_create (env,
+                                                    <xsl:choose><xsl:when test="$soapVersion='1.2'">"http://www.w3.org/2001/XMLSchema"</xsl:when><xsl:when test="$soapVersion='1.1'">"http://www.w3.org/1999/XMLSchema"</xsl:when></xsl:choose>,
+                                                    "xsd");
+                        AXIOM_ELEMENT_DECLARE_NAMESPACE (payload_ele, env,
+                                                   payload, xsd);
+                        ns1 =
+                         axiom_namespace_create (env,
+                                                    <xsl:choose><xsl:when test="$soapVersion='1.2'">AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI</xsl:when><xsl:when test="$soapVersion='1.1'">AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI</xsl:when></xsl:choose>,
+                                                    "soapenv");
+                        AXIOM_ELEMENT_DECLARE_NAMESPACE (payload_ele, env,
+                                                   payload, ns1);
+                        attri1 =
+                         axiom_attribute_create (env, "encodingStyle",
+                                                    "http://schemas.xmlsoap.org/soap/encoding/",
+                                                    ns1);
+                        AXIOM_ELEMENT_ADD_ATTRIBUTE (payload_ele, env,
+                                                   attri1, payload );
+                        </xsl:if>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        payload = <xsl:value-of select="$capsparamtype"/>_BUILD_OM(<xsl:value-of select="@name"/>, env, NULL, NULL, NULL );
+
+                    </xsl:otherwise>
+                    </xsl:choose>
+                     <!--should this omit in doclit type?-->
+                     <!--AXIOM_ELEMENT_SET_NAMESPACE ( payload_ele, env, payload_ns, payload );-->
+                  </xsl:otherwise>
+              </xsl:choose>
+           </xsl:for-each>
+
+
+            options = AXIS2_STUB_GET_OPTIONS( stub, env);
+            if ( NULL == options )
+            {
+              AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "options is null in stub: Error code:"
+                   " %d :: %s", env->error->error_number,
+                      AXIS2_ERROR_GET_MESSAGE(env->error));
+              return AXIS2_FAILURE;
+            }
+            svc_client = AXIS2_STUB_GET_SVC_CLIENT (stub, env );
+            soap_action = AXIS2_OPTIONS_GET_ACTION ( options, env );
+            if ( NULL == soap_action )
+            {
+              soap_action = "<xsl:value-of select="$soapAction"/>";
+              AXIS2_OPTIONS_SET_ACTION( options, env, soap_action );
+            }
+            <xsl:choose>
+             <xsl:when test="$soapVersion='1.2'">
+            AXIS2_OPTIONS_SET_SOAP_VERSION(options, env, AXIOM_SOAP12 );
+             </xsl:when>
+             <xsl:otherwise>
+            AXIS2_OPTIONS_SET_SOAP_VERSION(options, env, AXIOM_SOAP11 );
+             </xsl:otherwise>
+            </xsl:choose>
+            op_qname = axis2_qname_create(env,
+                                        "<xsl:value-of select="@localpart"/>" ,
+                                        "<xsl:value-of select="@namespace"/>",
+                                        NULL);
+            status =  AXIS2_SVC_CLIENT_SEND_ROBUST_WITH_OP_QNAME( svc_client, env, op_qname, payload);
+            return status;
+
+        }
+       </xsl:if> <!-- close for  test="$mep='http://www.w3.org/2004/08/wsdl/in-only' -->
+  </xsl:for-each>   <!-- close of for-each select = "method" -->
+   </xsl:template>
+</xsl:stylesheet>

Propchange: webservices/axis2/trunk/c/tools/codegen/src/templates/c/StubSourceTemplate.xsl
------------------------------------------------------------------------------
    svn:executable = *

Added: webservices/axis2/trunk/c/tools/codegen/src/templates/c/package.html
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/templates/c/package.html?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/templates/c/package.html (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/templates/c/package.html Fri Sep  1 05:45:57 2006
@@ -0,0 +1,6 @@
+<html>
+<body>
+This package is a "non class containing" one that has the xsl templates for the c class generation
+
+</body>
+</html>

Propchange: webservices/axis2/trunk/c/tools/codegen/src/templates/c/package.html
------------------------------------------------------------------------------
    svn:executable = *

Added: webservices/axis2/trunk/c/tools/codegen/src/typemappers/c.default.typemap.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/codegen/src/typemappers/c.default.typemap.xml?rev=439295&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/codegen/src/typemappers/c.default.typemap.xml (added)
+++ webservices/axis2/trunk/c/tools/codegen/src/typemappers/c.default.typemap.xml Fri Sep  1 05:45:57 2006
@@ -0,0 +1,7 @@
+<mappings dbf="c-default">
+    <mapping default="yes">
+        <qname namespace="http://www.w3.org/2001/XMLSchema" prefix="">content</qname>
+        <value>axiom_node_t*</value>
+    </mapping>
+</mappings>
+



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org