axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r417166 - in /webservices/axis2/trunk/c/samples/codegen: client/calc_xml_inout/ server/calc_xml_inout/ server/calculator/
Date Mon, 26 Jun 2006 11:19:35 GMT
Author: samisa
Date: Mon Jun 26 04:19:32 2006
New Revision: 417166

URL: http://svn.apache.org/viewvc?rev=417166&view=rev
Log:
adding xml in/out model samples for codegen

Added:
    webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/
    webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/Makefile.am   (with props)
    webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/readme   (with props)
    webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/test_Calcultor.c   (with
props)
    webservices/axis2/trunk/c/samples/codegen/server/calc_xml_inout/
    webservices/axis2/trunk/c/samples/codegen/server/calc_xml_inout/Makefile.am
    webservices/axis2/trunk/c/samples/codegen/server/calc_xml_inout/axis2_Calculator.c
    webservices/axis2/trunk/c/samples/codegen/server/calc_xml_inout/readme
Modified:
    webservices/axis2/trunk/c/samples/codegen/server/calculator/axis2_Calculator.c

Added: webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/Makefile.am?rev=417166&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/Makefile.am (added)
+++ webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/Makefile.am Mon Jun 26
04:19:32 2006
@@ -0,0 +1,25 @@
+prgbindir=$(prefix)/bin/samples
+prgbin_PROGRAMS = Calculator
+samplesdir=$(prefix)/samples/client/Calculator
+
+Calculator_SOURCES = \
+      test_Calcultor.c \
+      axis2_Calculator_stub.c
+
+
+Calculator_LDADD   = $(LDFLAGS) \
+                    -L$(AXIS2C_HOME)/lib \
+                    -laxis2_util \
+                    -laxis2_axiom \
+                    -laxis2_wsdl \
+                    -laxis2_engine \
+                    -laxis2_parser \
+                    -lpthread \
+                    -laxis2_http_sender \
+                    -laxis2_http_receiver \
+                    $(GUTHTHILA_LIBS) \
+                    $(LIBXML2_LIBS)
+
+INCLUDES = -I$(AXIS2C_HOME)/include \
+			@UTILINC@ \
+			@AXIOMINC@

Propchange: webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/Makefile.am
------------------------------------------------------------------------------
    svn:executable = *

Added: webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/readme
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/readme?rev=417166&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/readme (added)
+++ webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/readme Mon Jun 26 04:19:32
2006
@@ -0,0 +1,9 @@
+This sample demostrates the use of code generation using Axis2/Java WSDL2Java
+tool (Axis2/Java source revision 414253).
+
+sample source        test_Calcultor.c
+wsdl                 $AXIS2C_HOME/test/resources/wsdl/Calculator.wsdl
+
+Command to execute the code generation: 
+WSDL2Code 
+-uri <wsdl> -l  c -d none

Propchange: webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/readme
------------------------------------------------------------------------------
    svn:executable = *

Added: webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/test_Calcultor.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/test_Calcultor.c?rev=417166&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/test_Calcultor.c (added)
+++ webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/test_Calcultor.c Mon Jun
26 04:19:32 2006
@@ -0,0 +1,93 @@
+#include "axis2_Calculator_stub.h"
+
+axiom_node_t* generate_request_xml (const  axis2_env_t* env );
+void handle_respone_xml ( const  axis2_env_t* env, axiom_node_t* res );
+
+int main(int argc, char** argv)
+{
+    axis2_env_t* env = NULL;
+    axis2_char_t* operation = NULL;
+    axis2_char_t* client_home = NULL;
+
+    axis2_char_t* endpoint_uri =NULL;
+
+    axis2_stub_t* stub= NULL;
+
+    axiom_node_t* req = NULL;
+    axiom_node_t* res = NULL;
+
+    endpoint_uri = "http://localhost:9090/axis2/services/Calculator";
+
+    env = axis2_env_create_all( "codegen_utest_blocking.log", AXIS2_LOG_LEVEL_TRACE);
+
+    /* Set up deploy folder.*/
+    client_home = AXIS2_GETENV("AXIS2C_HOME");
+    if (!client_home)
+        client_home = "../../../deploy";
+    
+    stub = axis2_Calculator_stub_create( env, client_home , endpoint_uri); 
+    
+    req =  generate_request_xml (env );
+
+    /* invoke the web service method*/
+    res = axis2_add(  stub, env, req );
+    
+    handle_respone_xml ( env , res );
+
+    return 0;
+}
+
+axiom_node_t* generate_request_xml (const  axis2_env_t* env )
+{
+    axiom_node_t *op_node = NULL;
+    axiom_element_t* op_ele = NULL;
+    axiom_node_t* value_node = NULL;
+    axiom_element_t * value_ele = NULL;
+    axiom_namespace_t *ns1 = NULL;
+    axis2_char_t *om_str = NULL;
+     
+    int value1 =  13;
+    int value2 =  7;
+    char value_str[64];
+
+    ns1 = axiom_namespace_create (env, "http://localhost/axis/Calculator", "ns1");
+    op_ele = axiom_element_create(env, NULL, "add", ns1, &op_node);
+    
+    value_ele = axiom_element_create(env, op_node, "in1", NULL, &value_node);
+    sprintf ( value_str, "%d", value1 );
+    AXIOM_ELEMENT_SET_TEXT(value_ele, env, value_str , value_node);
+ 
+    value_ele = axiom_element_create(env, op_node, "in2", NULL, &value_node);
+    sprintf ( value_str, "%d", value1 );
+    AXIOM_ELEMENT_SET_TEXT(value_ele, env, value_str , value_node);
+
+    printf ("requesting %d  + %d \n", value1, value2 );
+    om_str = AXIOM_NODE_TO_STRING(op_node, env);
+    if (om_str)
+        printf("\nSending OM : %s\n", om_str);
+
+    return op_node;
+    
+}
+
+void handle_respone_xml ( const  axis2_env_t* env, axiom_node_t* res )
+{
+    axiom_node_t* node = NULL;
+    axiom_element_t* ele = NULL;
+    axis2_char_t* text =  NULL;
+ 
+    if ( NULL ==res)
+    {
+        printf ("response null\n" );
+        return;
+    }  
+    node = AXIOM_NODE_GET_FIRST_CHILD ( res, env );
+    if ( node )
+    {
+        ele = AXIOM_NODE_GET_DATA_ELEMENT (node, env );
+        text = AXIOM_ELEMENT_GET_TEXT ( ele,env, node );
+       
+        printf ( "answer = %s\n", text );
+    }
+    
+}

Propchange: webservices/axis2/trunk/c/samples/codegen/client/calc_xml_inout/test_Calcultor.c
------------------------------------------------------------------------------
    svn:executable = *

Added: webservices/axis2/trunk/c/samples/codegen/server/calc_xml_inout/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/codegen/server/calc_xml_inout/Makefile.am?rev=417166&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/codegen/server/calc_xml_inout/Makefile.am (added)
+++ webservices/axis2/trunk/c/samples/codegen/server/calc_xml_inout/Makefile.am Mon Jun 26
04:19:32 2006
@@ -0,0 +1,14 @@
+prglibdir=$(prefix)/services/Calculator
+samplesdir=$(prefix)/samples/server/Calculator
+prglib_LTLIBRARIES = libCalculator.la
+prglib_DATA= services.xml
+EXTRA_DIST = services.xml
+SUBDIRS =
+libCalculator_la_SOURCES =  \
+	axis2_Calculator.c \
+	axis2_Calculator_svc_skeleton.c
+
+libCalculator_la_LIBADD  =
+INCLUDES = -I$(AXIS2C_HOME)/include \
+			@UTILINC@ \
+			@AXIOMINC@

Added: webservices/axis2/trunk/c/samples/codegen/server/calc_xml_inout/axis2_Calculator.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/codegen/server/calc_xml_inout/axis2_Calculator.c?rev=417166&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/codegen/server/calc_xml_inout/axis2_Calculator.c (added)
+++ webservices/axis2/trunk/c/samples/codegen/server/calc_xml_inout/axis2_Calculator.c Mon
Jun 26 04:19:32 2006
@@ -0,0 +1,118 @@
+
+/**
+ * axis2_Calculator.c 
+ *
+ * This file was auto-generated from WSDL 
+ * by the Apache Axis2/Java version: #axisVersion# #today#
+ * axis2_Calculator Axis2/C skeleton for the axisService
+ */
+
+#include "axis2_Calculator.h"
+
+
+
+
+/**
+ * Auto generated function definition
+         
+ * @param param0
+         
+*/
+axiom_node_t *
+axis2_Calculator_add (const axis2_env_t * env, axiom_node_t* param0)
+{
+  /* Todo fill this with the necessary business logic */
+    axiom_node_t* req = param0;
+    axiom_node_t* node = NULL;
+    axiom_element_t* ele = NULL;
+    axis2_char_t* text =  NULL;
+
+    axiom_node_t *op_node = NULL;
+    axiom_element_t* op_ele = NULL;
+    axiom_node_t* value_node = NULL;
+    axiom_element_t * value_ele = NULL;
+    axiom_namespace_t *ns1 = NULL;
+    axis2_char_t *om_str = NULL;
+
+    char value_str[64];
+
+    int result = 0;
+
+    int value1, value2;
+    if (NULL== req)
+    {
+        printf ("response null\n" );
+        return NULL;
+    }
+    else
+    {
+        node = AXIOM_NODE_GET_FIRST_CHILD ( req, env );
+        ele = AXIOM_NODE_GET_DATA_ELEMENT (node, env );
+        text = AXIOM_ELEMENT_GET_TEXT ( ele,env, node );
+        value1 = atoi ( text );
+
+        node = AXIOM_NODE_GET_NEXT_SIBLING( node, env );
+        ele = AXIOM_NODE_GET_DATA_ELEMENT (node, env );
+        text = AXIOM_ELEMENT_GET_TEXT ( ele,env, node );
+        value2 = atoi ( text );
+
+    }
+
+    result = value1 + value2;
+
+
+    ns1 = axiom_namespace_create (env, "http://localhost/axis/Calculator", "ns1");
+    op_ele = axiom_element_create(env, NULL, "addResponse", ns1, &op_node);
+
+    value_ele = axiom_element_create(env, op_node, "in1", NULL, &value_node);
+    sprintf ( value_str, "%d", result);
+    AXIOM_ELEMENT_SET_TEXT(value_ele, env, value_str , value_node);
+
+    return op_node;
+
+}
+
+
+
+/**
+ * Auto generated function definition
+         
+ * @param param2
+         
+*/
+axiom_node_t *
+axis2_Calculator_div (const axis2_env_t * env, axiom_node_t* param2)
+{
+  /* Todo fill this with the necessary business logic */
+  return NULL;
+}
+
+
+
+/**
+ * Auto generated function definition
+         
+ * @param param4
+ 
+*/
+axiom_node_t *
+axis2_Calculator_sub (const axis2_env_t * env, axiom_node_t* param4)
+{
+  /* Todo fill this with the necessary business logic */
+  return NULL;
+}
+
+
+
+/**
+ * Auto generated function definition
+         
+ * @param param6
+         
+*/
+axiom_node_t *
+axis2_Calculator_mul (const axis2_env_t * env, axiom_node_t* param6)
+{
+  /* Todo fill this with the necessary business logic */
+  return NULL;
+}

Added: webservices/axis2/trunk/c/samples/codegen/server/calc_xml_inout/readme
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/codegen/server/calc_xml_inout/readme?rev=417166&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/codegen/server/calc_xml_inout/readme (added)
+++ webservices/axis2/trunk/c/samples/codegen/server/calc_xml_inout/readme Mon Jun 26 04:19:32
2006
@@ -0,0 +1,8 @@
+This sample demonstrates the use of code generation using Axis2/Java WSDL2Java
+tool (Axis2/Java source revision 414253).
+
+wsdl                 $AXIS2C_HOME/test/resources/wsdl/Calculator.wsdl
+
+Command to execute the code generation: 
+WSDL2Code 
+-uri <wsdl> -l  c -d none -u -ss -sd

Modified: webservices/axis2/trunk/c/samples/codegen/server/calculator/axis2_Calculator.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/codegen/server/calculator/axis2_Calculator.c?rev=417166&r1=417165&r2=417166&view=diff
==============================================================================
--- webservices/axis2/trunk/c/samples/codegen/server/calculator/axis2_Calculator.c (original)
+++ webservices/axis2/trunk/c/samples/codegen/server/calculator/axis2_Calculator.c Mon Jun
26 04:19:32 2006
@@ -61,10 +61,10 @@
 
         {
           /* Todo fill this with the necessary business logic */
-          axis2_addResponse_t* add_out = NULL;
-         axis2_add_t* add_in = param2;
-          axis2_addRequest_t* add_req = NULL;
-          axis2_addResponse20_t* add_res = NULL;
+          axis2_divResponse_t* div_out = NULL;
+         axis2_div_t* div_in = param2;
+          axis2_divRequest_t* div_req = NULL;
+          axis2_divResponse16_t* div_res = NULL;
 
           int ret_val = 0;
 
@@ -72,21 +72,21 @@
           int val2 = 0;
 
 
-     add_req = AXIS2_ADD_GET_ADD( add_in, env );
+     div_req = AXIS2_DIV_GET_DIV( div_in, env );
          
-     val1 = AXIS2_ADDREQUEST_GET_IN0 ( add_req, env );
-          val2 = AXIS2_ADDREQUEST_GET_IN1 ( add_req, env );
+     val1 = AXIS2_DIVREQUEST_GET_IN0 ( div_req, env );
+          val2 = AXIS2_DIVREQUEST_GET_IN1 ( div_req, env );
 
 
           ret_val = val1 / val2;
 
-          add_out = axis2_addResponse_create ( env );
-     AXIS2_ADDRESPONSE_SET_ADDRETURN ( add_out, env, ret_val );
+          div_out = axis2_divResponse_create ( env );
+     AXIS2_DIVRESPONSE_SET_ADDRETURN ( div_out, env, ret_val );
           
-     add_res = axis2_addResponse20_create ( env );
-     AXIS2_ADDRESPONSE20_SET_ADDRESPONSE ( add_res, env, add_out );
+     div_res = axis2_divResponse16_create ( env );
+     AXIS2_DIVRESPONSE16_SET_DIVRESPONSE ( div_res, env, div_out );
      
-          return add_res;
+          return div_res;
         }
      
 
@@ -101,10 +101,10 @@
 
         {
           /* Todo fill this with the necessary business logic */
-          axis2_addResponse_t* add_out = NULL;
-         axis2_add_t* add_in = param4;
-          axis2_addRequest_t* add_req = NULL;
-          axis2_addResponse20_t* add_res = NULL;
+          axis2_subResponse_t* sub_out = NULL;
+         axis2_sub_t* sub_in = param4;
+          axis2_subRequest_t* sub_req = NULL;
+          axis2_subResponse12_t* sub_res = NULL;
 
           int ret_val = 0;
 
@@ -112,21 +112,21 @@
           int val2 = 0;
 
 
-     add_req = AXIS2_ADD_GET_ADD( add_in, env );
+     sub_req = AXIS2_SUB_GET_SUB( sub_in, env );
          
-     val1 = AXIS2_ADDREQUEST_GET_IN0 ( add_req, env );
-          val2 = AXIS2_ADDREQUEST_GET_IN1 ( add_req, env );
+     val1 = AXIS2_SUBREQUEST_GET_IN0 ( sub_req, env );
+          val2 = AXIS2_SUBREQUEST_GET_IN1 ( sub_req, env );
 
 
           ret_val = val1 - val2;
 
-          add_out = axis2_addResponse_create ( env );
-     AXIS2_ADDRESPONSE_SET_ADDRETURN ( add_out, env, ret_val );
+          sub_out = axis2_subResponse_create ( env );
+     AXIS2_SUBRESPONSE_SET_SUBRETURN ( sub_out, env, ret_val );
           
-     add_res = axis2_addResponse20_create ( env );
-     AXIS2_ADDRESPONSE20_SET_ADDRESPONSE ( add_res, env, add_out );
+     sub_res = axis2_subResponse12_create ( env );
+     AXIS2_SUBRESPONSE12_SET_SUBRESPONSE ( sub_res, env, sub_out );
      
-          return add_res;
+          return sub_res;
         }
      
 
@@ -141,10 +141,10 @@
 
         {
           /* Todo fill this with the necessary business logic */
-          axis2_addResponse_t* add_out = NULL;
-         axis2_add_t* add_in = param6;
-          axis2_addRequest_t* add_req = NULL;
-          axis2_addResponse20_t* add_res = NULL;
+          axis2_mulResponse_t* mul_out = NULL;
+         axis2_mul_t* mul_in = param6;
+          axis2_mulRequest_t* mul_req = NULL;
+          axis2_mulResponse14_t* mul_res = NULL;
 
           int ret_val = 0;
 
@@ -152,20 +152,20 @@
           int val2 = 0;
 
 
-     add_req = AXIS2_ADD_GET_ADD( add_in, env );
+     mul_req = AXIS2_MUL_GET_MUL( mul_in, env );
          
-     val1 = AXIS2_ADDREQUEST_GET_IN0 ( add_req, env );
-          val2 = AXIS2_ADDREQUEST_GET_IN1 ( add_req, env );
+     val1 = AXIS2_MULREQUEST_GET_IN0 ( mul_req, env );
+          val2 = AXIS2_MULREQUEST_GET_IN1 ( mul_req, env );
 
 
           ret_val = val1 * val2;
 
-          add_out = axis2_addResponse_create ( env );
-     AXIS2_ADDRESPONSE_SET_ADDRETURN ( add_out, env, ret_val );
+          mul_out = axis2_mulResponse_create ( env );
+     AXIS2_MULRESPONSE_SET_ADDRETURN ( mul_out, env, ret_val );
           
-     add_res = axis2_addResponse20_create ( env );
-     AXIS2_ADDRESPONSE20_SET_ADDRESPONSE ( add_res, env, add_out );
+     mul_res = axis2_mulResponse14_create ( env );
+     AXIS2_MULRESPONSE14_SET_MULRESPONSE ( mul_res, env, mul_out );
      
-          return add_res;
+          return mul_res;
         }
      



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


Mime
View raw message