You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by na...@apache.org on 2006/05/15 05:11:32 UTC

svn commit: r406511 - in /webservices/axis/trunk/c: src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ tests/auto_build/testcases/client/c/ tests/auto_build/testcases/client/cpp/ tests/auto_build/testcases/tests/

Author: nadiramra
Date: Sun May 14 20:11:32 2006
New Revision: 406511

URL: http://svn.apache.org/viewcvs?rev=406511&view=rev
Log:
C support fixes/enhancements.

Added:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/c/ManyTypeRefRootClient.c
    webservices/axis/trunk/c/tests/auto_build/testcases/tests/ManyTypeRefRootC.xml
Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubWriter.java
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ManyTypeRefRootClient.cpp

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubWriter.java?rev=406511&r1=406510&r2=406511&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubWriter.java Sun May 14 20:11:32 2006
@@ -329,8 +329,16 @@
             writer.write("\t");
             
             if (returntypeisarray)
-            {
-                writer.write(outparamType + " *RetArray = (" + outparamType + " *)axiscAxisNew(XSDC_ARRAY, 0);\n");
+            {   
+                QName qname = null;
+                if (WrapperUtils.getArrayType (retType) != null)
+                    qname = WrapperUtils.getArrayType (retType).getName ();
+                else
+                    qname = retType.getName ();
+                if (CUtils.isSimpleType (qname))               
+                    writer.write(outparamType + " *RetArray = (" + outparamType + " *)axiscAxisNew(XSDC_ARRAY, 0);\n");
+                else
+                    writer.write(outparamType + " *RetArray = (" + outparamType + " *)Axis_Create_" + outparamType + "(0);\n");
             }
             else if (!returntypeissimple)
             {

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/ManyTypeRefRootClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/ManyTypeRefRootClient.c?rev=406511&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/ManyTypeRefRootClient.c (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/ManyTypeRefRootClient.c Sun May 14 20:11:32 2006
@@ -0,0 +1,87 @@
+// Copyright 2003-2004 The Apache Software Foundation.
+// (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved
+// 
+// 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 <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+#include "CommonClientTestCode.h"
+#include "ManyTypeRefRoot.h" 
+
+#define WSDL_DEFAULT_ENDPOINT "http://localhost:9080/ManyTypeRefRoot/services/sampleWS"
+
+
+int main(int argc, char* argv[])
+{
+    AXISCHANDLE ws;    
+
+    char *endpoint = WSDL_DEFAULT_ENDPOINT;
+    int returnValue = 1; // Assume Failure
+
+    Type1_Array input;
+    Type1_Array* result;
+    Type1 *types[10];
+
+    int i, outputSize=0;
+    Type1 **arrayResult;
+ 
+    axiscAxisRegisterExceptionHandler(exceptionHandler);
+ 
+    if (argc>2 && strcmp(argv[1], "-e") == 0)
+        endpoint = argv[2]; 
+ 
+    ws = get_ManyTypeRefRoot_stub(endpoint);
+        
+    for ( i = 0; i < 10; i++ )
+    {
+        types[i] = Axis_Create_Type1(0);
+        
+        types[i]->kind  = axiscAxisNew(XSDC_STRING, 10);
+        strcpy(types[i]->kind, "Test type");
+        
+        types[i]->index = axiscAxisNew(XSDC_INT, 0);
+        *(types[i]->index) = i;
+    }
+
+    input.m_Array = types;
+    input.m_Size  = 10;
+    input.m_Type  = C_USER_TYPE;
+
+    result = getInput(ws, &input);
+    
+    printf("Success \n");
+
+    if (result)
+    {        
+        arrayResult = result->m_Array;
+        outputSize  = result->m_Size;
+    }
+    
+    for ( i = 0; i < outputSize; i++) 
+        printf(" Result %d : %s\n", *arrayResult[i]->index, arrayResult[i]->kind);
+
+    returnValue = 0; // Success
+
+    // Clear up
+    for (i = 0 ; i < 10 ; i++ )
+        Axis_Delete_Type1(types[i],0);
+    Axis_Delete_Type1_Array(result, 0);
+
+    destroy_ManyTypeRefRoot_stub(ws);
+        
+    printf("---------------------- TEST COMPLETE -----------------------------\n");
+    
+    return returnValue;
+}

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ManyTypeRefRootClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ManyTypeRefRootClient.cpp?rev=406511&r1=406510&r2=406511&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ManyTypeRefRootClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ManyTypeRefRootClient.cpp Sun May 14 20:11:32 2006
@@ -13,6 +13,16 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+/* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE   */
+/* ----------------------------------------------------------------   */
+/* CHANGES TO THIS FILE MAY ALSO REQUIRE CHANGES TO THE               */
+/* C-EQUIVALENT FILE. PLEASE ENSURE THAT IT IS DONE.                  */
+/* ----------------------------------------------------------------   */
+/* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE   */
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+
+
 #include "ManyTypeRefRoot.hpp" 
 #include <stdlib.h> // For malloc(), calloc(), strdup() and free()
 #include <iostream>
@@ -32,7 +42,7 @@
 
 int main(int argc, char* argv[])
 {
-    ManyTypeRefRoot *ws;
+    ManyTypeRefRoot *ws;    
 
     char *endpoint = WSDL_DEFAULT_ENDPOINT;
     bool endpoint_set = false;
@@ -40,79 +50,91 @@
 
     endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
 
-                bool bSuccess = false;
-                int     iRetryIterationCount = 3;
+    bool bSuccess = false;
+    int     iRetryIterationCount = 3;
 
-                do
-                {
-    try {
-        if(endpoint_set) {
-            ws = new ManyTypeRefRoot(endpoint, APTHTTP1_1);
-            free(endpoint);
-            endpoint_set = false;
-        } else
-            ws = new ManyTypeRefRoot();
-
-        Type1_Array input;
-        Type1_Array* result;
-        Type1 ** types = new Type1*[10];
-        
-        int i;
+    do
+    {
+        try
+        {
+            if(endpoint_set)
+            {
+                ws = new ManyTypeRefRoot(endpoint, APTHTTP1_1);
+                free(endpoint);
+                endpoint_set = false;
+            }
+            else
+                ws = new ManyTypeRefRoot();
+
+
+            Type1_Array input;
+            Type1_Array* result;
+            Type1 *types[10];
+
+            int i, outputSize=0;
+            Type1 **arrayResult;
+            
+            for ( i = 0; i < 10; i++ )
+            {
+                types[i] = new Type1 ();
+                NEWCOPY(types[i]->kind, "Test type");
+                types[i]->index = new xsd__int(i);
+            }
+
+            input.set(types,10);
+
+            result = ws->getInput(&input);
+            
+            cout << "Success " << endl;
+
+            if (result)
+                arrayResult = result->get(outputSize);
+            
+            for ( i = 0; i < outputSize; i++) 
+                cout << " Result " << *arrayResult[i]->index << " : " << arrayResult[i]->kind << endl;
+
+            returnValue = 0; // Success
+
+            // Clear up
+            for (i = 0 ; i < 10 ; i++ )
+                delete types[i];
+            delete result;
+
+            bSuccess = true;
+            
+            delete ws;
 
-        for ( i = 0; i < 10; i++ ) {
-            types[i] = new Type1 ();
-            NEWCOPY(types[i]->kind, "Test type");
-            types[i]->index = new xsd__int(i);           
         }
+        catch(AxisException &e)
+        {
+            bool bSilent = false;
 
-        input.set(types,10);     
+            if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+            {
+                if( iRetryIterationCount > 0)
+                    bSilent = true;
+            }
+            else
+                iRetryIterationCount = 0;
 
-        result = ws->getInput(&input);
-        cout << "Success " << endl;
-                int outputSize=0;
-        Type1 **arrayResult = result->get(outputSize);
-        for ( i = 0; i < 10; i++) {
-            cout << " Result " << *arrayResult[i]->index << " : " << arrayResult[i]->kind << endl;
+            if( !bSilent)
+                cout << e.what() << endl;
         }
-        returnValue = 0; // Success
-
-                 // Clear up input array        
-        for (int deleteIndex = 0 ; deleteIndex < 10 ; deleteIndex++ )
+        catch(...)
         {
-            delete types[deleteIndex];
+            cout << "Unknown Exception occured." << endl;
         }
-        delete [] types;
-
-
-                bSuccess = true;
-
-    } catch(AxisException &e) {
-                        bool bSilent = false;
-
-                        if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
-                        {
-                                if( iRetryIterationCount > 0)
-                                {
-                                        bSilent = true;
-                                }
-                        }
-                        else
-                        {
-                                iRetryIterationCount = 0;
-                        }
-
-            if( !bSilent)
-                        {
-        cout << e.what() << endl;
-                        }
-    } catch(...) {
-        cout << "Unknown Exception occured." << endl;
+        
+        iRetryIterationCount--;
+        
     }
-                iRetryIterationCount--;
-                } while( iRetryIterationCount > 0 && !bSuccess);
-        if(endpoint_set)
-            free(endpoint);
-        cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
+    while( iRetryIterationCount > 0 && !bSuccess);
+    
+    if(endpoint_set)
+        free(endpoint);
+    
+    cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
+    
     return returnValue;
 }
 

Added: webservices/axis/trunk/c/tests/auto_build/testcases/tests/ManyTypeRefRootC.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/tests/ManyTypeRefRootC.xml?rev=406511&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/tests/ManyTypeRefRootC.xml (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/tests/ManyTypeRefRootC.xml Sun May 14 20:11:32 2006
@@ -0,0 +1,14 @@
+<test>
+    <name>ManyTypeRefRootC</name>
+    <description>ManyTypeRefRootC</description>
+    <clientLang>c</clientLang>
+    <clientCode>ManyTypeRefRootClient.c</clientCode>
+    <wsdl>ManyTypeRefRoot.wsdl</wsdl>
+    <expected>
+        <output>
+            ManyTypeRefRoot.cpp.out
+        </output>
+		<serverResponse>ManyTypeRefRoot_ServerResponse.expected</serverResponse>
+    </expected>
+	<endpoint>-e http://localhost:80/axis/ManyTypeRefRoot</endpoint>
+</test>