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 du...@apache.org on 2006/12/19 07:22:56 UTC

svn commit: r488546 - in /webservices/axis2/trunk/c/samples/codegen/databinding: ./ Calculator/ Calculator/client/ Calculator/server/ StockQuoteService/ StockQuoteService/client/ StockQuoteService/server/

Author: dushshantha
Date: Mon Dec 18 22:22:55 2006
New Revision: 488546

URL: http://svn.apache.org/viewvc?view=rev&rev=488546
Log:
added data binding codegen samples

Added:
    webservices/axis2/trunk/c/samples/codegen/databinding/
    webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/
    webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/Calculator.wsdl
    webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/client/
    webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/client/CalculatorAdd.c
    webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/server/
    webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/server/axis2_skel_Calculator.c
    webservices/axis2/trunk/c/samples/codegen/databinding/READEME.txt
    webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/
    webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/StockQuote.xsd
    webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/StockQuoteService.wsdl
    webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/client/
    webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/client/stock_quote_client.c
    webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/server/
    webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/server/axis2_skel_StockQuoteService.c

Added: webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/Calculator.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/Calculator.wsdl?view=auto&rev=488546
==============================================================================
--- webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/Calculator.wsdl (added)
+++ webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/Calculator.wsdl Mon Dec 18 22:22:55 2006
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright 2003-2004 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.                                           -->
+
+<wsdl:definitions targetNamespace="http://localhost/axis/Calculator" 
+xmlns="http://schemas.xmlsoap.org/wsdl/" 
+xmlns:apachesoap="http://xml.apache.org/xml-soap"
+xmlns:impl="http://localhost/axis/Calculator"
+xmlns:intf="http://localhost/axis/Calculator"
+xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
+xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <wsdl:message name="addRequest">
+    <wsdl:part name="in0" type="xsd:int"/>
+    <wsdl:part name="in1" type="xsd:int"/>
+  </wsdl:message>
+  <wsdl:message name="addResponse">
+    <wsdl:part name="addReturn" type="xsd:int"/>
+  </wsdl:message>
+  <wsdl:message name="subResponse">
+    <wsdl:part name="subReturn" type="xsd:int"/>
+  </wsdl:message>
+  <wsdl:message name="subRequest">
+    <wsdl:part name="in0" type="xsd:int"/>
+    <wsdl:part name="in1" type="xsd:int"/>
+  </wsdl:message>
+  <wsdl:message name="mulRequest">
+    <wsdl:part name="in0" type="xsd:int"/>
+    <wsdl:part name="in1" type="xsd:int"/>
+  </wsdl:message>
+  <wsdl:message name="mulResponse">
+    <wsdl:part name="addReturn" type="xsd:int"/>
+  </wsdl:message>
+  <wsdl:message name="divRequest">
+    <wsdl:part name="in0" type="xsd:int"/>
+    <wsdl:part name="in1" type="xsd:int"/>
+  </wsdl:message>
+  <wsdl:message name="divResponse">
+    <wsdl:part name="addReturn" type="xsd:int"/>
+  </wsdl:message>
+  <wsdl:portType name="Calculator">
+    <wsdl:operation name="add" parameterOrder="in0 in1">
+      <wsdl:input message="intf:addRequest" name="addRequest"/>
+      <wsdl:output message="intf:addResponse" name="addResponse"/>
+    </wsdl:operation>
+    <wsdl:operation name="sub" parameterOrder="in0 in1">
+      <wsdl:input message="intf:subRequest" name="subRequest"/>
+      <wsdl:output message="intf:subResponse" name="subResponse"/>
+    </wsdl:operation>
+    <wsdl:operation name="mul" parameterOrder="in0 in1">
+      <wsdl:input message="intf:mulRequest" name="mulRequest"/>
+      <wsdl:output message="intf:mulResponse" name="mulResponse"/>
+    </wsdl:operation>
+    <wsdl:operation name="div" parameterOrder="in0 in1">
+      <wsdl:input message="intf:divRequest" name="divRequest"/>
+      <wsdl:output message="intf:divResponse" name="divResponse"/>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="CalculatorSoapBinding" type="intf:Calculator">
+    <wsdlsoap:binding style="rpc" 
+    transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="add">
+      <wsdlsoap:operation soapAction="Calculator#add"/>
+      <wsdl:input name="addRequest">
+        <wsdlsoap:body 
+        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
+        namespace="http://localhost/axis/Calculator" 
+        use="encoded"/>
+      </wsdl:input>
+      <wsdl:output name="addResponse">
+        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
+        namespace="http://localhost/axis/Calculator" 
+        use="encoded"/>
+      </wsdl:output>
+    </wsdl:operation>
+    <wsdl:operation name="sub">
+      <wsdlsoap:operation soapAction="Calculator#sub"/>
+      <wsdl:input name="subRequest">
+        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
+        namespace="http://localhost/axis/Calculator" 
+        use="encoded"/>
+      </wsdl:input>
+      <wsdl:output name="subResponse">
+        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
+        namespace="http://localhost/axis/Calculator" 
+        use="encoded"/>
+      </wsdl:output>
+    </wsdl:operation>
+    <wsdl:operation name="mul">
+      <wsdlsoap:operation soapAction="Calculator#mul"/>
+      <wsdl:input name="mulRequest">
+        <wsdlsoap:body 
+        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
+        namespace="http://localhost/axis/Calculator" 
+        use="encoded"/>
+      </wsdl:input>
+      <wsdl:output name="mulResponse">
+        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
+        namespace="http://localhost/axis/Calculator" 
+        use="encoded"/>
+      </wsdl:output>
+    </wsdl:operation>
+    <wsdl:operation name="div">
+      <wsdlsoap:operation soapAction="Calculator#div"/>
+      <wsdl:input name="divRequest">
+        <wsdlsoap:body 
+        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
+        namespace="http://localhost/axis/Calculator" 
+        use="encoded"/>
+      </wsdl:input>
+      <wsdl:output name="divResponse">
+        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
+        namespace="http://localhost/axis/Calculator" 
+        use="encoded"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>  
+  <wsdl:service name="Calculator">
+    <wsdl:port binding="intf:CalculatorSoapBinding" name="Calculator">
+      <wsdlsoap:address location="http://localhost/axis/Calculator"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>

Added: webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/client/CalculatorAdd.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/client/CalculatorAdd.c?view=auto&rev=488546
==============================================================================
--- webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/client/CalculatorAdd.c (added)
+++ webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/client/CalculatorAdd.c Mon Dec 18 22:22:55 2006
@@ -0,0 +1,46 @@
+#include "axis2_stub_Calculator.h"
+
+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;
+
+    axis2_addResponse_t *add_res = NULL;
+    axis2_add_t *add_in = NULL;
+
+    int res_val = 0;
+    endpoint_uri = "http://localhost:9090/axis2/services/Calculator";
+
+    env = axis2_env_create_all("alltest.log", AXIS2_LOG_LEVEL_TRACE);
+
+    /* Set up deploy folder.*/
+    client_home = AXIS2_GETENV("AXIS2C_HOME");
+    if (!client_home)
+        client_home = "../../../deploy";
+
+    stub = axis2_stub_Calculator_create(env, client_home , endpoint_uri);
+
+    add_in = axis2_add_create(env);
+
+    AXIS2_ADD_SET_IN0(add_in, env, 10);
+    AXIS2_ADD_SET_IN1(add_in, env, 10);
+
+    add_res =  axis2_stub_Calculator_add(stub, env, add_in);
+
+    if(!add_res)
+    {
+        printf("Error: response NULL\n");
+        return -1;
+    }
+
+    res_val = AXIS2_ADDRESPONSE_GET_ADDRETURN(add_res, env);
+
+    printf("ADD Result:%d ", res_val);
+
+    return 0;
+}
+

Added: webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/server/axis2_skel_Calculator.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/server/axis2_skel_Calculator.c?view=auto&rev=488546
==============================================================================
--- webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/server/axis2_skel_Calculator.c (added)
+++ webservices/axis2/trunk/c/samples/codegen/databinding/Calculator/server/axis2_skel_Calculator.c Mon Dec 18 22:22:55 2006
@@ -0,0 +1,127 @@
+
+
+/**
+ * axis2_skel_Calculator.c
+ *
+ * This file was auto-generated from WSDL for "Calculator|http://localhost/axis/Calculator" service
+ * by the Apache Axis2/C version: #axisVersion# #today#
+ * axis2_skel_Calculator Axis2/C skeleton for the axisService
+ */
+
+ #include "axis2_skel_Calculator.h"
+
+
+
+ 
+/**
+ * auto generated function definition signature
+ * for "add|" operation.
+ 
+ * @param add
+ */
+axis2_addResponse_t* axis2_skel_Calculator_add (const axis2_env_t *env  ,
+                                      axis2_add_t* add )
+{
+    axis2_addResponse_t* add_res = NULL;
+
+    int ret_val = 0;
+
+    int val1 = 0;
+    int val2 = 0;
+
+    val1 = AXIS2_ADD_GET_IN0(add, env);
+    val2 = AXIS2_ADD_GET_IN1(add, env);
+
+    ret_val = val1 + val2;
+
+    add_res = axis2_addResponse_create(env);
+    AXIS2_ADDRESPONSE_SET_ADDRETURN(add_res, env, ret_val);
+
+    return add_res; 
+}
+ 
+/**
+ * auto generated function definition signature
+ * for "div|" operation.
+ 
+ * @param div
+ */
+axis2_divResponse_t* axis2_skel_Calculator_div (const axis2_env_t *env  ,
+                                      axis2_div_t* div )
+{
+    axis2_divResponse_t *div_res = NULL;
+
+    int ret_val = 0;
+
+    int val1 = 0;
+    int val2 = 0;
+
+    val1 = AXIS2_DIV_GET_IN0(div, env);
+    val2 = AXIS2_DIV_GET_IN1(div, env);
+
+    ret_val = val1/val2;
+
+    div_res = axis2_divResponse_create(env);
+    AXIS2_DIVRESPONSE_SET_ADDRETURN(div_res, env, ret_val);
+
+    return div_res;
+}
+
+
+ 
+/**
+ * auto generated function definition signature
+ * for "sub|" operation.
+ 
+ * @param sub
+ */
+axis2_subResponse_t* axis2_skel_Calculator_sub (const axis2_env_t *env  ,
+                                      axis2_sub_t* sub )
+{
+    axis2_subResponse_t *sub_res = NULL;
+
+    int ret_val = 0;
+
+    int val1 = 0;
+    int val2 = 0;
+
+    val1 = AXIS2_SUB_GET_IN0(sub, env);
+    val2 = AXIS2_SUB_GET_IN1(sub, env);
+    
+    ret_val = val1 - val2;
+
+    sub_res = axis2_subResponse_create(env);
+    AXIS2_SUBRESPONSE_SET_SUBRETURN(sub_res, env, ret_val);
+
+    return sub_res;
+}
+
+
+ 
+/**
+ * auto generated function definition signature
+ * for "mul|" operation.
+ 
+ * @param mul
+ */
+axis2_mulResponse_t* axis2_skel_Calculator_mul (const axis2_env_t *env  ,
+                                      axis2_mul_t* mul )
+{
+    axis2_mulResponse_t *mul_res = NULL;
+
+    int ret_val = 0;
+
+    int val1 = 0;
+    int val2 = 0;
+
+    val1 = AXIS2_MUL_GET_IN0(mul, env);
+    val2 = AXIS2_MUL_GET_IN1(mul, env);
+
+    ret_val = val1*val2;
+
+    mul_res = axis2_mulResponse_create(env);
+    AXIS2_MULRESPONSE_SET_ADDRETURN(mul_res, env, ret_val);
+
+    return mul_res;
+
+}

Added: webservices/axis2/trunk/c/samples/codegen/databinding/READEME.txt
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/codegen/databinding/READEME.txt?view=auto&rev=488546
==============================================================================
--- webservices/axis2/trunk/c/samples/codegen/databinding/READEME.txt (added)
+++ webservices/axis2/trunk/c/samples/codegen/databinding/READEME.txt Mon Dec 18 22:22:55 2006
@@ -0,0 +1,65 @@
+Sample: Data Binding
+====================
+
+Introduction
+------------
+
+These samples demonstrate the use of code generation using Axis2/Java WSDL2Java 
+(http://svn.apache.org/repos/asf/webservices/axis2/trunk/java)tool with Axis Data Binding.
+
+
+Files
+-----
+
+-StockQuoteService
+	Client source       ./StockQuoteService/stock_quote_client.c
+	Service Source		./StockQuoteService/axis2_skel_StockQuoteService.c
+	wsdl				./StockQuoteService/StockQuoteService.wsdl
+
+-Calculator
+	Client source       ./Calculator/CalculatorAdd.c
+	Service Source		./Calculator/axis2_skel_Calculator.c
+	wsdl				./Calculator/Calculator.wsdl
+
+
+Code Generation
+---------------
+
+Use the shell script or batch file available in the ../../../tools/bin directory to generate
+code using following options.(Reade the READEME.txt at ../../../tools/bin directory to learn how to use scripts)
+
+Client side stub generation with Axis Data Binding:
+	Linux: WSDL2C.sh -uri <wsdl path> -g -d adb -u -f -o <output directory> 
+	Win32: WSDL2C.bat -uri <wsdl path> -g -d adb -u -f -o <output directory> 
+
+Server side skeleton generation with Axis Data Binding:
+	Linux: WSDL2C.sh -uri <wsdl path> -sd -ss -d adb -u -f -o <output directory>
+	Win32: WSDL2C.bat -uri <wsdl path> -sd -ss -d adb -u -f -o <output directory>
+
+Description of Options used:
+	
+	-o <output Location> : output file location
+    -ss : Generate server side code (i.e. skeletons). Default is off
+    -sd : Generate service descriptor (i.e. services.xml). Default is off. Valid with -ss
+    -d <databinding> : valid databinding(s) are adb, xmlbeans and jaxme. Default is adb
+    -g : Generates all the classes. valid only with the -ss (This will generate client and server codes)
+    -u : unpacks the databinding classes
+	-f : Generate the source output folder without the src directory
+
+Please refer to the http://ws.apache.org/axis2/tools/1_1/CodegenToolReference.html for further details.
+
+Deploying the Service
+---------------------
+You need to generate the required server side code using command described above and replace 
+the axis2_skel_<service name>.c with given implementation. After building the lib<service name>.so, 
+put it inside $AXIS2C_HOME/services/<service name>/ directory.
+
+You need to then startup the server to deploy the service.
+
+Running the Client
+------------------
+You need to generate the required client side code using command described above and put them inside 
+where client implementations resides. And then build the client and run it.
+
+
+ 

Added: webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/StockQuote.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/StockQuote.xsd?view=auto&rev=488546
==============================================================================
--- webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/StockQuote.xsd (added)
+++ webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/StockQuote.xsd Mon Dec 18 22:22:55 2006
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema
+        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+        targetNamespace="http://w3.ibm.com/schemas/services/2002/11/15/stockquote"
+        xmlns="http://w3.ibm.com/schemas/services/2002/11/15/stockquote">
+
+    <xsd:complexType name="quote">
+        <xsd:sequence>
+            <xsd:element name="symbol" type="xsd:string"/>
+            <xsd:element name="volume" type="xsd:integer"/>
+            <xsd:element name="lastTrade" type="lastTradeType"/>
+            <xsd:element name="change" type="changeType"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:complexType name="changeType">
+        <xsd:sequence>
+            <xsd:element name="dollar" type="xsd:float"/>
+            <xsd:element name="percent" type="xsd:float"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:complexType name="lastTradeType">
+        <xsd:sequence>
+            <xsd:element name="price" type="xsd:float"/>
+            <xsd:element name="date" type="xsd:long"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <!-- Methods signatures -->
+    <xsd:element name="getStockQuote">
+        <xsd:complexType>
+            <xsd:sequence>
+                <xsd:element name="symbol" type="xsd:string"/>
+            </xsd:sequence>
+        </xsd:complexType>
+    </xsd:element>
+    <xsd:element name="getStockQuoteResponse">
+        <xsd:complexType>
+            <xsd:sequence>
+                <xsd:element name="returnQuote" type="quote"/>
+            </xsd:sequence>
+        </xsd:complexType>
+    </xsd:element>
+
+</xsd:schema>

Added: webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/StockQuoteService.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/StockQuoteService.wsdl?view=auto&rev=488546
==============================================================================
--- webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/StockQuoteService.wsdl (added)
+++ webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/StockQuoteService.wsdl Mon Dec 18 22:22:55 2006
@@ -0,0 +1,44 @@
+<definitions targetNamespace="http://w3.ibm.com/schemas/services/2002/11/15/stockquote/wsdl"
+	xmlns="http://schemas.xmlsoap.org/wsdl/" 
+	xmlns:tns="http://w3.ibm.com/schemas/services/2002/11/15/stockquote/wsdl" 
+	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+	xmlns:types="http://w3.ibm.com/schemas/services/2002/11/15/stockquote">
+
+	<import namespace="http://w3.ibm.com/schemas/services/2002/11/15/stockquote" location="StockQuote.xsd" />
+
+	<message name="getStockQuoteReq">
+		<part name="parameters" element="types:getStockQuote" />
+	</message>
+
+	<message name="getStockQuoteResp">
+		<part name="parameters" element="types:getStockQuoteResponse" />
+	</message>
+
+	<portType name="StockQuotePortType">
+		<operation name="getStockQuote">
+			<input message="tns:getStockQuoteReq" />
+			<output message="tns:getStockQuoteResp" />
+		</operation>
+	</portType>
+
+	<binding name="StockQuoteSOAPBinding" type="tns:StockQuotePortType">
+		<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+		<operation name="getStockQuote">
+			<soap:operation style="document" soapAction="getStockQuote" />
+			<input>
+				<soap:body use="literal" />
+			</input>
+			<output>
+				<soap:body use="literal" />
+			</output>
+		</operation>
+	</binding>
+
+	<service name="StockQuoteService">
+		<port name="StockQuoteSOAPPort" binding="tns:StockQuoteSOAPBinding">
+			<soap:address location="http://localhost:8080/axis2/services/StockQuoteService" />
+		</port>
+	</service>
+
+</definitions>

Added: webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/client/stock_quote_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/client/stock_quote_client.c?view=auto&rev=488546
==============================================================================
--- webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/client/stock_quote_client.c (added)
+++ webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/client/stock_quote_client.c Mon Dec 18 22:22:55 2006
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed
+ * with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 "axis2_stub_StockQuoteService.h"
+#include <stdio.h>
+
+void
+handle_response(axis2_getStockQuoteResponse_t *res, axis2_env_t *env);
+
+int
+main(int argc, char *argv[])
+{
+	axis2_env_t *env = NULL;
+	axis2_char_t *client_home = NULL;
+	axis2_char_t *endpoint_uri = NULL;
+	axis2_stub_t *stub = NULL;
+	axis2_char_t *symbol = NULL;
+
+	axis2_getStockQuote_t *req = NULL;
+
+	axis2_getStockQuoteResponse_t *res = NULL;
+    
+	if(argc > 1)
+	{
+		symbol = argv[1];		
+	}
+	else
+	{
+		printf("\nEnter Symbol Name!");
+		return -1;
+	}
+
+	endpoint_uri = "http://localhost:9090/axis2/services/StockQuoteService";
+	env = axis2_env_create_all("codegen_sample_stock_quote.log", AXIS2_LOG_LEVEL_TRACE);
+	/* Set up deploy folder.*/
+	client_home = AXIS2_GETENV("AXIS2C_HOME");
+	if (!client_home)
+		client_home = "../../../deploy";
+	
+	stub = axis2_stub_StockQuoteService_create(env, client_home, endpoint_uri);
+
+	/* Create the struct */
+	req = axis2_getStockQuote_create(env);
+	AXIS2_GETSTOCKQUOTE_SET_SYMBOL(req, env, symbol);
+
+	res = axis2_stub_StockQuoteService_getStockQuote(stub, env, req);
+    
+	if(!res)
+	{
+		printf("Error: response NULL!\n");
+		return -1;
+    }
+	
+	handle_response(res, env); /*Handle Response */
+
+	return 0;
+}
+
+void
+handle_response(axis2_getStockQuoteResponse_t *res, axis2_env_t *env)
+{
+	
+	axis2_quote_t *quote = NULL;
+
+	axis2_changeType_t *change = NULL;
+	axis2_lastTradeType_t *last_trade = NULL;
+	
+	/*Attributes of Quote*/
+	axis2_char_t *symbol_res = NULL;
+	int volume = 0;
+	
+	/*Attributes of Last Trade */
+	float price = 0;
+	long date = 0;
+
+	/*Attributes of Change*/
+	float dollar = 0;
+	float precent = 0;
+		
+	quote = AXIS2_GETSTOCKQUOTERESPONSE_GET_RETURNQUOTE(res, env);
+    
+    if(!quote)
+    {
+        printf("Error: Quote response NULL!\n");
+        return;
+    }
+    
+	last_trade = AXIS2_QUOTE_GET_LASTTRADE(quote, env);
+	change = AXIS2_QUOTE_GET_CHANGE(quote, env);
+	symbol_res = AXIS2_QUOTE_GET_SYMBOL(quote, env);
+	volume = AXIS2_QUOTE_GET_VOLUME(quote, env);
+
+	price = AXIS2_LASTTRADETYPE_GET_PRICE(last_trade, env);
+	date = AXIS2_LASTTRADETYPE_GET_DATE(last_trade, env);
+
+	dollar = AXIS2_CHANGETYPE_GET_DOLLAR(change, env);
+	precent = AXIS2_CHANGETYPE_GET_PERCENT(change, env);
+	
+	printf("\nSTOCK QUOTERESPONSE\n");
+	printf("\tSYMBOL\t\t: %s\n", symbol_res);
+	printf("\tVOLUME\t\t: %d\n", volume);
+	printf("\tPRICE\t\t: %f\n", price);
+	printf("\tDATE\t\t: %l\n", date);
+	printf("\tDOLLAR\t\t: %f\n", dollar);
+	printf("\tPRECENT\t\t: %f\n", precent);
+	
+}	
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Added: webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/server/axis2_skel_StockQuoteService.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/server/axis2_skel_StockQuoteService.c?view=auto&rev=488546
==============================================================================
--- webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/server/axis2_skel_StockQuoteService.c (added)
+++ webservices/axis2/trunk/c/samples/codegen/databinding/StockQuoteService/server/axis2_skel_StockQuoteService.c Mon Dec 18 22:22:55 2006
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+/**
+ * axis2_skel_StockQuoteService.c
+ *
+ * This file was auto-generated from WSDL for "StockQuoteService|http://w3.ibm.com/schemas/services/2002/11/15/stockquote/wsdl" service
+ * by the Apache Axis2/C version: #axisVersion# #today#
+ * axis2_skel_StockQuoteService Axis2/C skeleton for the axisService
+ */
+
+#include "axis2_skel_StockQuoteService.h"
+
+/**
+ * auto generated function definition signature
+ * for "getStockQuote|" operation.
+         
+ * @param getStockQuote
+ */
+axis2_getStockQuoteResponse_t* axis2_skel_StockQuoteService_getStockQuote (const axis2_env_t *env, 
+																		   axis2_getStockQuote_t* getStockQuote )
+{
+	/* TODO fill this with the necessary business logic */
+	axis2_char_t *symbol_in = NULL;
+
+	axis2_getStockQuoteResponse_t *response = NULL;
+	axis2_quote_t *res_quote = NULL;
+	axis2_changeType_t *res_change = NULL;
+	axis2_lastTradeType_t *res_last_trade = NULL;
+	
+	symbol_in = AXIS2_GETSTOCKQUOTE_GET_SYMBOL(getStockQuote, env);
+	if(!symbol_in)
+	{
+		AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL, AXIS2_FAILURE);
+        printf("StockQuoteService client request ERROR: input parameter NULL\n");
+        return NULL;
+	}
+	
+	res_quote = axis2_quote_create(env);
+	AXIS2_QUOTE_SET_SYMBOL(res_quote, env, symbol_in);
+	AXIS2_QUOTE_SET_VOLUME(res_quote, env, 1000);
+
+	res_change = axis2_changeType_create(env);
+	AXIS2_CHANGETYPE_SET_PERCENT(res_change, env, 10);
+	AXIS2_CHANGETYPE_SET_DOLLAR(res_change, env, 98);
+	
+	AXIS2_QUOTE_SET_CHANGE(res_quote, env, res_change);
+
+	res_last_trade = axis2_lastTradeType_create(env);
+	AXIS2_LASTTRADETYPE_SET_PRICE(res_last_trade, env, 23);
+	AXIS2_LASTTRADETYPE_SET_DATE(res_last_trade, env, 1165997291);
+	
+	AXIS2_QUOTE_SET_LASTTRADE(res_quote, env, res_last_trade);
+
+	response = axis2_getStockQuoteResponse_create(env);
+	AXIS2_GETSTOCKQUOTERESPONSE_SET_RETURNQUOTE(response, env, res_quote);
+
+	return response;
+}
+     
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+



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