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/05/09 02:27:29 UTC

svn commit: r405243 - in /webservices/axis/trunk/c/tests/auto_build/testcases/client/c: XSD_IDClient.c XSD_NCNameClient.c XSD_NameClient.c XSD_QNameClient.c XSD_shortClient.c XSD_stringClient.c XSD_timeClient.c

Author: nadiramra
Date: Mon May  8 17:27:27 2006
New Revision: 405243

URL: http://svn.apache.org/viewcvs?rev=405243&view=rev
Log:
C support fixes/enhancements. Testcases for C bindings.

Added:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_QNameClient.c
    webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_shortClient.c
    webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_stringClient.c
    webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_timeClient.c
Modified:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_IDClient.c
    webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_NCNameClient.c
    webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_NameClient.c

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_IDClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_IDClient.c?rev=405243&r1=405242&r2=405243&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_IDClient.c (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_IDClient.c Mon May  8 17:27:27 2006
@@ -300,12 +300,11 @@
     // Test array
     {
 #define ARRAY_SIZE 2                    
-        int i;
+        int i, outputSize=0;
         xsdc__ID_Array arrayInput;
         xsdc__ID_Array* arrayResult;
         xsdc__ID array[ARRAY_SIZE];  
-        const xsdc__ID * output;
-        int outputSize=0;
+        xsdc__ID * output;
               
         for (i=0 ; i < ARRAY_SIZE; i++)
         {

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_NCNameClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_NCNameClient.c?rev=405243&r1=405242&r2=405243&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_NCNameClient.c (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_NCNameClient.c Mon May  8 17:27:27 2006
@@ -245,7 +245,7 @@
         xsdc__NCName_Array arrayInput;
         xsdc__NCName_Array* arrayResult;
         xsdc__NCName array[ARRAY_SIZE]; 
-        const xsdc__NCName* output;
+        xsdc__NCName* output;
         int outputSize=0;
                
         for (i=0 ; i < ARRAY_SIZE; i++)

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_NameClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_NameClient.c?rev=405243&r1=405242&r2=405243&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_NameClient.c (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_NameClient.c Mon May  8 17:27:27 2006
@@ -242,7 +242,7 @@
         xsdc__Name_Array arrayInput;
         xsdc__Name_Array* arrayResult;
         xsdc__Name array[ARRAY_SIZE]; 
-        const xsdc__Name* output;
+        xsdc__Name* output;
         int outputSize=0;
                
         for (i=0 ; i < ARRAY_SIZE; i++)

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_QNameClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_QNameClient.c?rev=405243&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_QNameClient.c (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_QNameClient.c Mon May  8 17:27:27 2006
@@ -0,0 +1,316 @@
+// 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 "CommonClientTestCode.h"
+#include "XSD_QName.h"
+
+
+int main(int argc, char* argv[])
+{
+    AXISCHANDLE ws;
+    
+    xsdc__QName input;
+    xsdc__QName result;
+    
+    RequiredAttributeElement requiredAttributeInput;
+    RequiredAttributeElement* requiredAttributeResult;
+    
+    char emptyQName[1] = "";
+    char simpleQName[25] = "A simple test message!";
+    char reservedCharactersQName[] = "<>&\"\'";
+    char whitespaceQName[] = "  \t\r\nsome text \t\r\nmore text \t\r\n";
+    
+    char endpoint[256];
+    const char* url="http://localhost:80/axis/XSD_QName";
+
+
+    axiscAxisRegisterExceptionHandler(exceptionHandler);
+
+    if(argc>1)
+        url = argv[1];
+
+    sprintf(endpoint, "%s", url);
+    ws = get_XSD_QName_stub(endpoint);
+          
+    input =  simpleQName;
+
+    // Test non-nillable element
+    result = asNonNillableElement(ws, input);
+    if (result)
+    {
+        if (*result)
+            printf("non-nillable element=%s\n", result);
+        else
+            printf("non-nillable element=<empty>\n");
+            
+        axiscAxisDelete(result, XSDC_QNAME);
+    }
+    else
+        printf("non-nillable element=<nil>\n");
+
+    // Test empty non-nillable element
+    input = emptyQName;
+    
+    result = asNonNillableElement(ws, input);
+    if (result)
+    {
+        if (*result)
+            printf("empty non-nillable element=%s\n", result);
+        else
+            printf("empty non-nillable element=<empty>\n");
+            
+        axiscAxisDelete(result, XSDC_QNAME);
+    }
+    else
+        printf("empty non-nillable element=<nil>\n");
+
+    // Test non-nillable element with XML reserved characters
+    
+    input = reservedCharactersQName;
+    result = asNonNillableElement(ws, input);
+    if (result)
+    {
+        if (*result)
+            printf("non-nillable element with XML reserved characters=%s\n", result);
+        else
+            printf("non-nillable element with XML reserved characters=<empty>\n");
+            
+        axiscAxisDelete(result, XSDC_QNAME);
+    }
+    else
+        printf("non-nillable element with XML reserved characters=<nil>\n");
+
+    // Test non-nillable element with XML reserved characters
+    
+    input = whitespaceQName;
+    result = asNonNillableElement(ws, input);
+    if (result)
+    {
+        if (*result)
+            printf("non-nillable element with whitespace characters=\"%s\"\n", result);
+        else
+            printf("non-nillable element with whitespace characters=<empty>\n");
+            
+        axiscAxisDelete(result, XSDC_QNAME);
+    }
+    else
+        printf("non-nillable element with whitespace characters=<nil>\n");
+
+    // Test nillable element, with a value
+    input =  simpleQName;
+    result = asNillableElement(ws, input);
+    if (result)
+    {
+        if (*result)
+            printf("nillable element=%s\n", result);
+        else
+            printf("nillable element=<empty>\n");
+        axiscAxisDelete(result, XSDC_QNAME);
+    }
+    else
+        printf("nillable element=<nil>\n");
+
+    // Test empty nillable element
+    input =  emptyQName;
+    result = asNillableElement(ws, input);
+    if (result)
+    {
+        if (*result)
+            printf("empty nillable element=%s\n", result);
+        else
+            printf("empty nillable element=<empty>\n");
+        axiscAxisDelete(result, XSDC_QNAME);
+    }
+    else
+        printf("empty nillable element=<nil>\n");
+
+    // Test nillable element, with nil
+    result = asNillableElement(ws, NULL);
+    if (result)
+    {
+        if (*result)
+            printf("nil element=%s\n", result);
+        else
+            printf("nil element=<empty>\n");
+        axiscAxisDelete(result, XSDC_QNAME);
+    }
+    else
+        printf("nil element=<nil>\n");
+
+    // Test required attribute
+    requiredAttributeInput.requiredAttribute = simpleQName;
+    requiredAttributeResult = asRequiredAttribute(ws, &requiredAttributeInput);
+    if (requiredAttributeResult->requiredAttribute)
+    {
+        if (*(requiredAttributeResult->requiredAttribute))
+            printf("required attribute=%s\n", requiredAttributeResult->requiredAttribute);
+        else
+            printf("required attribute=<empty>\n");
+    }
+    else
+        printf("required attribute=<nil>\n");
+    Axis_Delete_RequiredAttributeElement(requiredAttributeResult, 0);
+
+    // Test empty required attribute
+    requiredAttributeInput.requiredAttribute = emptyQName;
+    requiredAttributeResult = asRequiredAttribute(ws, &requiredAttributeInput);
+    if (requiredAttributeResult->requiredAttribute)
+    {
+        if (*(requiredAttributeResult->requiredAttribute))
+            printf("empty required attribute=%s\n", requiredAttributeResult->requiredAttribute);
+        else
+            printf("empty required attribute=<empty>\n");
+    }
+    else
+        printf("empty required attribute=<nil>\n");
+    Axis_Delete_RequiredAttributeElement(requiredAttributeResult, 0);
+
+/* Optional Attributes currently unsupported by WSDL2Ws
+ * Exact coding of this section may change depending on chosen implementation
+        // Test optional attribute, with a value
+        input = new char[25];
+        strcpy (input, simpleQName);
+        OptionalAttributeElement optionalAttributeInput;
+        optionalAttributeInput.setoptionalAttribute(input);
+        OptionalAttributeElement* optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
+        if (optionalAttributeResult->getoptionalAttribute())
+        {
+            if (*(optionalAttributeResult->getoptionalAttribute()))
+                printf("optional attribute, with data=" ,optionalAttributeResult->getoptionalAttribute());
+            else
+                printf("optional attribute, with data=<empty>\n");
+        }
+        else
+            printf("optional attribute, with data=<not present>\n");
+        delete [] input;
+        delete optionalAttributeResult;
+
+        // Test empty optional attribute
+        input = new char[1];
+        strcpy (input, emptyQName);
+        optionalAttributeInput.setoptionalAttribute(input);
+        optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
+        if (optionalAttributeResult->getoptionalAttribute())
+        {
+            if (*(optionalAttributeResult->getoptionalAttribute()))
+                printf("empty optional attribute=" ,optionalAttributeResult->getoptionalAttribute());
+            else
+                printf("empty optional attribute=<empty>\n");
+        }
+        else
+        {
+            printf("empty optional attribute=<not present>\n");
+        }
+        delete [] input;
+        delete optionalAttributeResult;
+
+        // Test optional attribute, not present
+        // optionalAttributeInput.setattribute();
+        optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
+        if (optionalAttributeResult->getoptionalAttribute())
+        {
+            if (*(optionalAttributeResult->getoptionalAttribute()))
+                printf("optional attribute, not present=" ,optionalAttributeResult->getoptionalAttribute());
+            else
+                printf("optional attribute, not present=<empty>\n");
+        }
+        else
+            printf("optional attribute, not present=<not present>\n");
+        delete optionalAttributeResult;
+*/
+
+    // Test array
+    {
+#define ARRAY_SIZE 2                    
+       int i, outputSize=0;
+        
+       xsdc__QName_Array arrayInput;
+       xsdc__QName_Array* arrayResult;
+       xsdc__QName array[ARRAY_SIZE];
+       xsdc__QName *output;
+       
+        for (i=0 ; i < ARRAY_SIZE ; i++)
+        {
+            array[i] = (xsdc__QName)axiscAxisNew(XSDC_QNAME,25);
+            strcpy (array[i], simpleQName);            
+        }
+        
+        arrayInput.m_Array = array;
+        arrayInput.m_Size  = ARRAY_SIZE;
+        arrayInput.m_Type  = XSDC_QNAME;
+        
+        arrayResult = asArray(ws, &arrayInput);
+        
+        if (exceptionOccurred == C_TRUE
+            || get_XSD_QName_Status(ws) == AXISC_FAIL )
+            printf ("Failed\n");
+
+        if (arrayResult)
+        {
+           output     = arrayResult->m_Array;
+           outputSize = arrayResult->m_Size;
+        }
+
+        printf("array of %d elements\n" ,outputSize);
+        for (i = 0; i < outputSize ; i++)
+        {
+            if (output!=NULL)
+            {
+                if (output[i]!=NULL)
+                    printf("  element[%d]=%s\n" ,i ,output[i]);
+                else
+                    printf("  element[%d]=<empty>\n" ,i);
+            }
+            else
+                printf("  element[%d]=<nil>\n" ,i);
+        }
+
+                // Clear up input array        
+        for (i = 0 ; i < ARRAY_SIZE ; i++ )
+            axiscAxisDelete(array[i], XSDC_QNAME);
+        axiscAxisDelete(arrayResult, XSDC_ARRAY);
+    }
+
+
+    // Test complex type
+    {
+        SimpleComplexType complexTypeInput;
+        SimpleComplexType* complexTypeResult;
+        
+        complexTypeInput.complexTypeElement = simpleQName;
+        complexTypeResult = asComplexType(ws, &complexTypeInput);
+        if (complexTypeResult->complexTypeElement)
+        {
+            if (*(complexTypeResult->complexTypeElement))
+                printf("within complex type=%s\n" ,complexTypeResult->complexTypeElement);
+            else
+                printf("within complex type=<empty>\n");
+        }
+        else
+            printf("within complex type=<nil>\n");
+        Axis_Delete_SimpleComplexType(complexTypeResult, 0);
+    }
+
+        // Tests now complete
+
+        destroy_XSD_QName_stub(ws);
+
+    printf( "---------------------- TEST COMPLETE -----------------------------\n");
+   
+    return 0;
+}

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_shortClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_shortClient.c?rev=405243&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_shortClient.c (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_shortClient.c Mon May  8 17:27:27 2006
@@ -0,0 +1,180 @@
+// 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 "CommonClientTestCode.h"
+#include "XSD_short.h"
+
+int main(int argc, char* argv[])
+{
+    AXISCHANDLE ws;
+    
+    xsdc__short result;
+    xsdc__short  nillableInput;
+    xsdc__short* nillableResult;
+    
+    char endpoint[256];
+    const char* url="http://localhost:80/axis/XSD_short";
+
+    axiscAxisRegisterExceptionHandler(exceptionHandler);
+
+    if(argc>1)
+        url = argv[1];
+    
+    sprintf(endpoint, "%s", url);
+    ws = get_XSD_short_stub(endpoint);
+
+    result = asNonNillableElement(ws, (xsdc__short)32767);
+    printf("non-nillable element=%hd\n", result);
+    
+    result = asNonNillableElement(ws, (xsdc__short)1);
+    printf("non-nillable element=%hd\n", result);
+    
+    result = asNonNillableElement(ws, (xsdc__short)-32768);
+    printf("non-nillable element=%hd\n", result);
+    
+    result = asNonNillableElement(ws, (xsdc__short)-1);
+    printf("non-nillable element=%hd\n", result);
+    
+    result = asNonNillableElement(ws, (xsdc__short)0);
+    printf("non-nillable element=%hd\n", result);
+
+
+    // Test nillable element, with a value
+    nillableInput = (xsdc__short)12345;
+    nillableResult = asNillableElement(ws, &nillableInput);
+    if (nillableResult)
+    {
+        printf("nillable element=%hd\n", *(nillableResult));
+        delete nillableResult;
+    }
+    else
+        printf("nillable element=<nil>\n");
+
+    // Test nillable element, with nil
+    nillableResult = asNillableElement(ws, NULL);
+    if (nillableResult)
+    {
+        printf("nil element=%hd\n", *(nillableResult));
+        delete nillableResult;
+    }
+    else
+        printf("nil element=<nil>\n");
+
+    // Test required attribute
+    {
+        RequiredAttributeElement requiredAttributeInput;
+        RequiredAttributeElement* requiredAttributeResult;
+        
+        requiredAttributeInput.requiredAttribute = 12345;
+        requiredAttributeResult = asRequiredAttribute(ws, &requiredAttributeInput);
+        printf("required attribute=%hd\n", requiredAttributeResult->requiredAttribute);
+        Axis_Delete_RequiredAttributeElement(requiredAttributeResult, 0);
+    }
+
+/* Optional Attributes currently unsupported by WSDL2Ws
+ * Exact coding of this section may change depending on chosen implementation
+        // Test optional attribute, with a value
+        OptionalAttributeElement optionalAttributeInput;
+        optionalAttributeInput.setoptionalAttribute(12345);
+        OptionalAttributeElement* optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
+        if (optionalAttributeResult->getoptionalAttribute())
+        {
+            printf("optional attribute, with data=" << optionalAttributeResult->getoptionalAttribute());
+        }
+        else
+        {
+            printf("optional attribute, with data=<not present>\n");
+        }
+        delete optionalAttributeResult;
+
+        // Test optional attribute, not present
+        optionalAttributeInput.setattribute();
+        optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
+        if (optionalAttributeResult->getoptionalAttribute())
+        {
+            printf("optional attribute, not present=" << optionalAttributeResult->getoptionalAttribute());
+        }
+        else
+        {
+            printf("optional attribute, not present=<not present>\n");
+        }
+        delete optionalAttributeResult;
+*/
+
+    // Test array
+    {
+#define ARRAY_SIZE 2                    
+        int i, outputSize=0;
+        
+        xsdc__short_Array arrayInput;
+        xsdc__short_Array* arrayResult;
+        xsdc__short * array[ARRAY_SIZE];
+        xsdc__short ** output;
+        
+        for (i=0 ; i < ARRAY_SIZE ; i++)
+        {
+            array[i] = (xsdc__short *)axiscAxisNew(XSDC_SHORT,0);
+            *array[i]= 12345;
+        }
+
+        arrayInput.m_Array = array;
+        arrayInput.m_Size  = ARRAY_SIZE;
+        arrayInput.m_Type  = XSDC_SHORT;
+        
+        arrayResult = asArray(ws, &arrayInput);
+        
+        if (exceptionOccurred == C_TRUE
+            || get_XSD_short_Status(ws) == AXISC_FAIL )
+            printf ("Failed\n");
+
+        if (arrayResult)
+        {
+           output     = arrayResult->m_Array;
+           outputSize = arrayResult->m_Size;
+        }
+        
+        printf("array of %d elements\n", outputSize);
+        for (i = 0; i < outputSize ; i++)
+            printf("  element[%d]=%hd\n", i, *((xsdc__short*)(output[i])));
+        
+        // Clear up input array        
+        for (i = 0 ; i < ARRAY_SIZE ; i++ )
+            axiscAxisDelete(array[i], XSDC_SHORT);
+        axiscAxisDelete(arrayResult, XSDC_ARRAY);
+    }
+
+
+        
+    // Test complex type
+    {
+        SimpleComplexType complexTypeInput;
+        SimpleComplexType* complexTypeResult;
+        
+        complexTypeInput.complexTypeElement = 12345;
+        complexTypeResult = asComplexType(ws, &complexTypeInput);
+        printf("within complex type=%hd\n", complexTypeResult->complexTypeElement);
+        Axis_Delete_SimpleComplexType(complexTypeResult, 0);
+    }
+
+    // Tests now complete
+    destroy_XSD_short_stub(ws);
+
+    printf( "---------------------- TEST COMPLETE -----------------------------\n");
+   
+    return 0;
+}

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_stringClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_stringClient.c?rev=405243&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_stringClient.c (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_stringClient.c Mon May  8 17:27:27 2006
@@ -0,0 +1,291 @@
+// 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 "CommonClientTestCode.h"
+#include "XSD_string.h"
+
+
+int main(int argc, char* argv[])
+{
+    AXISCHANDLE ws;
+
+    xsdc__string input;
+    xsdc__string result;
+    
+    RequiredAttributeElement requiredAttributeInput;
+    RequiredAttributeElement* requiredAttributeResult;
+
+    char emptyString[1] = "";
+    char simpleString[25] = "A simple test message!";
+    char reservedCharactersString[] = "<>&\"\'";
+    char whitespaceString[] = "  \t\r\nsome text \t\r\nmore text \t\r\n";
+
+    char endpoint[256];
+    const char* url="http://localhost:80/axis/XSD_string";
+
+    axiscAxisRegisterExceptionHandler(exceptionHandler);
+
+    if(argc>1)
+        url = argv[1];
+
+    sprintf(endpoint, "%s", url);
+    ws = get_XSD_string_stub(endpoint);
+
+    // Test non-nillable element
+    result = asNonNillableElement(ws, simpleString);
+    if (result)
+    {
+        if (*result)
+            printf("non-nillable element=%s\n", result);
+        else
+            printf("non-nillable element=<empty>\n");
+        axiscAxisDelete(result, XSDC_STRING);
+    }
+    else
+        printf("non-nillable element=<nil>\n");
+
+    // Test empty non-nillable element
+    result = asNonNillableElement(ws, emptyString);
+    if (result)
+    {
+        if (*result)
+            printf("empty non-nillable element=%s\n", result);
+        else
+            printf("empty non-nillable element=<empty>\n");
+        axiscAxisDelete(result, XSDC_STRING);
+    }
+    else
+        printf("empty non-nillable element=<nil>\n");
+
+    // Test non-nillable element with XML reserved characters
+    result = asNonNillableElement(ws, reservedCharactersString);
+    if (result)
+    {
+        if (*result)
+            printf("non-nillable element with XML reserved characters=%s\n", result);
+        else
+            printf("non-nillable element with XML reserved characters=<empty>\n");
+        axiscAxisDelete(result, XSDC_STRING);
+    }
+    else
+        printf("non-nillable element with XML reserved characters=<nil>\n");
+
+    // Test non-nillable element with XML reserved characters
+    result = asNonNillableElement(ws, whitespaceString);
+    if (result)
+    {
+        if (*result)
+            printf("non-nillable element with whitespace characters=\"%s\"\n", result);
+        else
+            printf("non-nillable element with whitespace characters=<empty>\n");
+        axiscAxisDelete(result, XSDC_STRING);
+    }
+    else
+        printf("non-nillable element with whitespace characters=<nil>\n");
+
+    // Test nillable element, with a value
+    result = asNillableElement(ws, simpleString);
+    if (result)
+    {
+        if (*result)
+            printf("nillable element=%s\n", result);
+        else
+            printf("nillable element=<empty>\n");
+        axiscAxisDelete(result, XSDC_STRING);
+    }
+    else
+        printf("nillable element=<nil>\n");
+
+    // Test empty nillable element
+    result = asNillableElement(ws, emptyString);
+    if (result)
+    {
+        if (*result)
+            printf("empty nillable element=%s\n", result);
+        else
+            printf("empty nillable element=<empty>\n");
+        axiscAxisDelete(result, XSDC_STRING);
+    }
+    else
+        printf("empty nillable element=<nil>\n");
+
+    // Test nillable element, with nil
+    result = asNillableElement(ws, NULL);
+    if (result)
+    {
+        if (*result)
+            printf("nil element=%s\n", result);
+        else
+            printf("nil element=<empty>\n");
+        axiscAxisDelete(result, XSDC_STRING);
+    }
+    else
+        printf("nil element=<nil>\n");
+
+    // Test required attribute
+    requiredAttributeInput.requiredAttribute = simpleString;
+    requiredAttributeResult = asRequiredAttribute(ws, &requiredAttributeInput);
+    
+    if (requiredAttributeResult->requiredAttribute)
+    {
+        if (*(requiredAttributeResult->requiredAttribute))
+            printf("required attribute=%s\n", requiredAttributeResult->requiredAttribute);
+        else
+            printf("required attribute=<empty>\n");
+    }
+    else
+        printf("required attribute=<nil>\n");
+    Axis_Delete_RequiredAttributeElement(requiredAttributeResult, 0);
+
+    // Test empty required attribute
+    requiredAttributeInput.requiredAttribute = emptyString;
+    requiredAttributeResult = asRequiredAttribute(ws, &requiredAttributeInput);
+    if (requiredAttributeResult->requiredAttribute)
+    {
+        if (*(requiredAttributeResult->requiredAttribute))
+            printf("empty required attribute=%s\n", requiredAttributeResult->requiredAttribute);
+        else
+            printf("empty required attribute=<empty>\n");
+    }
+    else
+        printf("empty required attribute=<nil>\n");
+    Axis_Delete_RequiredAttributeElement(requiredAttributeResult, 0);
+
+/* Optional Attributes currently unsupported by WSDL2Ws
+ * Exact coding of this section may change depending on chosen implementation
+        // Test optional attribute, with a value
+        input = new char[25];
+        strcpy (input, simpleString);
+        OptionalAttributeElement optionalAttributeInput;
+        optionalAttributeInput.setoptionalAttribute(input);
+        OptionalAttributeElement* optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
+        if (optionalAttributeResult->getoptionalAttribute())
+        {
+            if (*(optionalAttributeResult->getoptionalAttribute()))
+                printf("optional attribute, with data=", optionalAttributeResult->getoptionalAttribute());
+            else
+                printf("optional attribute, with data=<empty>\n");
+        }
+        else
+            printf("optional attribute, with data=<not present>\n");
+        delete optionalAttributeResult;
+
+        // Test empty optional attribute
+        input = new char[1];
+        strcpy (input, emptyString);
+        optionalAttributeInput.setoptionalAttribute(input);
+        optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
+        if (optionalAttributeResult->getoptionalAttribute())
+        {
+            if (*(optionalAttributeResult->getoptionalAttribute()))
+                printf("empty optional attribute=", optionalAttributeResult->getoptionalAttribute());
+            else
+                printf("empty optional attribute=<empty>\n");
+        }
+        else
+            printf("empty optional attribute=<not present>\n");
+        delete optionalAttributeResult;
+
+        // Test optional attribute, not present
+        // optionalAttributeInput.setattribute();
+        optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
+        if (optionalAttributeResult->getoptionalAttribute())
+        {
+            if (*(optionalAttributeResult->getoptionalAttribute()))
+                printf("optional attribute, not present=", optionalAttributeResult->getoptionalAttribute());
+            else
+                printf("optional attribute, not present=<empty>\n");
+        }
+        else
+            printf("optional attribute, not present=<not present>\n");
+        delete optionalAttributeResult;
+*/
+
+    // Test arrays
+    {
+#define ARRAY_SIZE 2                    
+        int i, outputSize=0;
+        
+        xsdc__string_Array arrayInput;
+        xsdc__string_Array * arrayResult;
+        xsdc__string array[ARRAY_SIZE];
+        xsdc__string* output;
+         
+        for (i = 0 ; i < ARRAY_SIZE ; i++)
+            array[i] =  simpleString;
+
+        arrayInput.m_Array = array;
+        arrayInput.m_Size  = ARRAY_SIZE;
+        arrayInput.m_Type  = XSDC_STRING;
+        
+        arrayResult = asArray(ws, &arrayInput);
+        
+        if (exceptionOccurred == C_TRUE
+            || get_XSD_string_Status(ws) == AXISC_FAIL )
+            printf ("Failed\n");
+
+        if (arrayResult)
+        {
+           output     = arrayResult->m_Array;
+           outputSize = arrayResult->m_Size;
+        }
+        
+        printf("array of %d elements\n", outputSize);
+        if (output != NULL)
+        {
+            for (i = 0 ; i < outputSize ; i++)
+                printf("  element[%d]=%s\n", i, output[i] ? output[i] : "NULL");
+        }
+        else
+            printf("NULL array");
+
+        // Clean up        
+        axiscAxisDelete(arrayResult, XSDC_ARRAY);
+    }
+
+
+
+        
+    // Test complex type
+    {
+        SimpleComplexType complexTypeInput;
+        SimpleComplexType* complexTypeResult;
+        
+        complexTypeInput.complexTypeElement = simpleString;
+        complexTypeResult = asComplexType(ws, &complexTypeInput);
+        if (complexTypeResult->complexTypeElement)
+        {
+            if (*(complexTypeResult->complexTypeElement))
+                printf("within complex type=%s\n", complexTypeResult->complexTypeElement);
+            else
+                printf("within complex type=<empty>\n");
+        }
+        else
+            printf("within complex type=<nil>\n");
+        Axis_Delete_SimpleComplexType(complexTypeResult, 0);
+    }
+
+    // Tests now complete
+
+    destroy_XSD_string_stub(ws);
+
+
+    printf( "---------------------- TEST COMPLETE -----------------------------\n");
+   
+    return 0;
+}

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_timeClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_timeClient.c?rev=405243&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_timeClient.c (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/XSD_timeClient.c Mon May  8 17:27:27 2006
@@ -0,0 +1,181 @@
+// 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 "CommonClientTestCode.h"
+#include "XSD_time.h"
+
+
+int main(int argc, char* argv[])
+{
+    AXISCHANDLE ws;
+
+    xsdc__time input;
+    xsdc__time result;
+    xsdc__time* nillableInput;
+    xsdc__time* nillableResult;
+    
+    time_t timeToTest;
+    struct tm *temp;
+        
+    char endpoint[256];
+    const char* url="http://localhost:80/axis/XSD_time";
+    
+    char returnString[50];
+
+    axiscAxisRegisterExceptionHandler(exceptionHandler);
+    
+    if(argc>1)
+        url = argv[1];
+
+    sprintf(endpoint, "%s", url);
+    ws =  get_XSD_time_stub(endpoint);
+    
+    timeToTest = 1100246323;
+    temp = gmtime(&timeToTest);
+    memcpy(&input, temp, sizeof(struct tm));
+
+    // Test non-nillable element
+    result = asNonNillableElement(ws, input);
+    strftime(returnString, 50, "%H:%M:%S", &result);
+    printf("non-nillable element=%s\n" , returnString );
+
+    // Test nillable element, with a value
+    nillableResult = asNillableElement(ws, &input);
+    if (nillableResult)
+    {
+        strftime(returnString, 50, "%H:%M:%S", nillableResult);
+        printf("nillable element=%s\n" , returnString );
+        axiscAxisDelete(nillableResult, XSDC_TIME);
+    }
+    else
+        printf("nillable element=<nil>\n" );
+
+    // Test nillable element, with nil
+    nillableResult = asNillableElement(ws, NULL);
+    if (nillableResult)
+    {
+        strftime(returnString, 50, "%H:%M:%S", nillableResult);
+        printf("nil element=%s\n" , returnString );
+        axiscAxisDelete(nillableResult, XSDC_TIME);
+    }
+    else
+        printf("nil element=<nil>\n" );
+
+    // Test required attribute
+    {
+        RequiredAttributeElement requiredAttributeInput;
+        RequiredAttributeElement* requiredAttributeResult;
+        
+        requiredAttributeInput.requiredAttribute = input;
+        requiredAttributeResult = asRequiredAttribute(ws, &requiredAttributeInput);
+        result = requiredAttributeResult->requiredAttribute;
+        strftime(returnString, 50, "%H:%M:%S", &result);
+        printf("required attribute=%s\n" , returnString );
+        Axis_Delete_RequiredAttributeElement(requiredAttributeResult, 0);
+    }
+
+/* Optional Attributes currently unsupported by WSDL2Ws
+ * Exact coding of this section may change depending on chosen implementation
+        // Test optional attribute, with a value
+        OptionalAttributeElement optionalAttributeInput;
+        optionalAttributeInput.setoptionalAttribute(input);
+        OptionalAttributeElement* optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
+        if (optionalAttributeResult->getoptionalAttribute())
+        {
+            strftime(returnString, 50, "%H:%M:%S", optionalAttributeResult->getoptionalAttribute());
+            printf("optional attribute, with data=" , returnString );
+        }
+        else
+            printf("optional attribute, with data=<not present>\n" );
+        delete optionalAttributeResult;
+
+        // Test optional attribute, not present
+        optionalAttributeInput.setattribute();
+        optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
+        if (optionalAttributeResult->getoptionalAttribute())
+        {
+            strftime(returnString, 50, "%H:%M:%S", optionalAttributeResult->getoptionalAttribute());
+            printf("optional attribute, not present=" , returnString );
+        }
+        else
+            printf("optional attribute, not present=<not present>\n" );
+        delete optionalAttributeResult;
+*/
+    // Test array
+    {    
+#define ARRAY_SIZE 2                    
+        int i, outputSize=0;
+        
+        xsdc__time_Array arrayInput;
+        xsdc__time_Array* arrayResult;
+        xsdc__time * array[ARRAY_SIZE];
+        xsdc__time ** output;
+        
+        for (i=0 ; i < ARRAY_SIZE ; i++)
+            array[i] = &input;
+
+        arrayInput.m_Array = array;
+        arrayInput.m_Size  = ARRAY_SIZE;
+        arrayInput.m_Type  = XSDC_TIME;
+        
+        arrayResult = asArray(ws, &arrayInput);
+        
+        if (exceptionOccurred == C_TRUE
+            || get_XSD_time_Status(ws) == AXISC_FAIL )
+            printf ("Failed\n");
+
+        if (arrayResult)
+        {
+           output     = arrayResult->m_Array;
+           outputSize = arrayResult->m_Size;
+        }
+
+        printf("array of %d elements\n" , outputSize);
+        for (i = 0; i < outputSize ; i++)
+        {
+            strftime(returnString, 50, "%H:%M:%S", output[i]);
+            printf("  element[%d]=%s\n" , i , returnString );
+        }
+        
+        // Clean up       
+        axiscAxisDelete(arrayResult, XSDC_ARRAY);
+    }
+
+
+        
+
+    // Test complex type
+    {
+        SimpleComplexType complexTypeInput;
+        SimpleComplexType* complexTypeResult;
+        
+        complexTypeInput.complexTypeElement = input;
+        complexTypeResult = asComplexType(ws, &complexTypeInput);
+        result = complexTypeResult->complexTypeElement;
+        strftime(returnString, 50, "%H:%M:%S", &result);
+        printf("within complex type=%s\n" , returnString );
+        Axis_Delete_SimpleComplexType(complexTypeResult, 0);
+    }
+
+    // Tests now complete
+
+    destroy_XSD_time_stub(ws);
+
+    printf("---------------------- TEST COMPLETE -----------------------------\n");
+   
+    return 0;
+}