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/17 05:40:45 UTC

svn commit: r407141 - in /webservices/axis/trunk/c: src/cbindings/INamespaceC.cpp tests/auto_build/testcases/client/c/INamespaceTest1Client.c tests/auto_build/testcases/client/c/InOutClient.c tests/auto_build/testcases/tests/INamespaceTest1C.xml

Author: nadiramra
Date: Tue May 16 20:40:44 2006
New Revision: 407141

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

Added:
    webservices/axis/trunk/c/src/cbindings/INamespaceC.cpp
    webservices/axis/trunk/c/tests/auto_build/testcases/client/c/INamespaceTest1Client.c
    webservices/axis/trunk/c/tests/auto_build/testcases/tests/INamespaceTest1C.xml
Modified:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/c/InOutClient.c

Added: webservices/axis/trunk/c/src/cbindings/INamespaceC.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/cbindings/INamespaceC.cpp?rev=407141&view=auto
==============================================================================
--- webservices/axis/trunk/c/src/cbindings/INamespaceC.cpp (added)
+++ webservices/axis/trunk/c/src/cbindings/INamespaceC.cpp Tue May 16 20:40:44 2006
@@ -0,0 +1,141 @@
+/*
+ *   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 <axis/GDefine.hpp>
+#include <axis/INamespace.hpp>
+#include <axis/AxisException.hpp>
+
+#include "AxisObjectContainer.hpp"
+
+#include <axis/Axis.h>
+#include <axis/GDefine.h>
+#include <axis/INamespace.h>
+
+AXIS_CPP_NAMESPACE_USE
+
+extern "C" {
+
+AXISC_STORAGE_CLASS_INFO 
+void axiscNamespaceDestroy(AXISCHANDLE iNamespace) 
+{
+    INamespace *ins = (INamespace*)iNamespace;
+    
+    try
+    {
+        delete ins;
+    }
+    catch ( AxisException& e  )
+    {
+        axiscAxisInvokeExceptionHandler(e.getExceptionCode(), e.what());
+    }
+    catch ( ... )
+    {
+        axiscAxisInvokeExceptionHandler(-1, "Unrecognized exception thrown.");
+    }
+}
+
+
+AXISC_STORAGE_CLASS_INFO 
+int axiscNamespaceSetURI(AXISCHANDLE iNamespace, 
+                         const AxiscChar * uri) 
+{
+    INamespace *ins = (INamespace*)iNamespace;
+
+    try
+    {
+        return ins->setURI(uri);
+    }
+    catch ( AxisException& e  )
+    {
+        axiscAxisInvokeExceptionHandler(e.getExceptionCode(), e.what());
+    }
+    catch ( ... )
+    {
+        axiscAxisInvokeExceptionHandler(-1, "Unrecognized exception thrown.");
+    }
+    
+    return AXISC_FAIL;
+}
+
+
+AXISC_STORAGE_CLASS_INFO 
+int axiscNamespaceSetPrefix(AXISCHANDLE iNamespace, 
+                             const AxiscChar * prefix) 
+{
+    INamespace *ins = (INamespace*)iNamespace;
+
+    try
+    {
+        return ins->setPrefix(prefix);
+    }
+    catch ( AxisException& e  )
+    {
+        axiscAxisInvokeExceptionHandler(e.getExceptionCode(), e.what());
+    }
+    catch ( ... )
+    {
+        axiscAxisInvokeExceptionHandler(-1, "Unrecognized exception thrown.");
+    }
+    
+    return AXISC_FAIL;
+}
+
+
+
+AXISC_STORAGE_CLASS_INFO 
+const AxiscChar * axiscNamespaceGetURI(AXISCHANDLE iNamespace) 
+{
+    INamespace *ins = (INamespace*)iNamespace;
+
+    try
+    {
+        return ins->getURI();
+    }
+    catch ( AxisException& e  )
+    {
+        axiscAxisInvokeExceptionHandler(e.getExceptionCode(), e.what());
+    }
+    catch ( ... )
+    {
+        axiscAxisInvokeExceptionHandler(-1, "Unrecognized exception thrown.");
+    }
+
+    return (const AxiscChar *)NULL;
+}
+
+AXISC_STORAGE_CLASS_INFO 
+const AxiscChar * axiscNamespaceGetPrefix(AXISCHANDLE iNamespace) 
+{
+    INamespace *ins = (INamespace*)iNamespace;
+
+    try
+    {
+        return ins->getPrefix();
+    }
+    catch ( AxisException& e  )
+    {
+        axiscAxisInvokeExceptionHandler(e.getExceptionCode(), e.what());
+    }
+    catch ( ... )
+    {
+        axiscAxisInvokeExceptionHandler(-1, "Unrecognized exception thrown.");
+    }
+
+    return (const AxiscChar *)NULL;    
+}
+
+}

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/INamespaceTest1Client.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/INamespaceTest1Client.c?rev=407141&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/INamespaceTest1Client.c (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/INamespaceTest1Client.c Tue May 16 20:40:44 2006
@@ -0,0 +1,82 @@
+// 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.
+
+
+/* Tests setPrefix(),getPrefix(),setURI() and getURI() APIs in INamespace class  
+@ Author : James Jose
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+#include "CommonClientTestCode.h"
+#include "Calculator.h"
+
+
+int main(int argc, char* argv[])
+{
+    AXISCHANDLE ws;
+    
+    char endpoint[256];
+    const char* url="http://localhost:80/axis/Calculator";
+    const char* op = 0;
+    int i1=0, i2=0;
+    int iResult;
+    
+    const AxiscChar *pf="nsp";
+    const AxiscChar *uri="http://axis.apache.org";
+
+    AXISCHANDLE phb;
+    AXISCHANDLE nsp;
+
+    const AxiscChar *p;
+    const AxiscChar *u;
+
+    axiscAxisRegisterExceptionHandler(exceptionHandler);
+    
+    if (argc > 1)
+        url = argv[1];
+
+    sprintf(endpoint, "%s", url);
+    ws = get_Calculator_stub(endpoint);
+    
+    phb=axiscStubCreateSOAPHeaderBlock(ws, "TestHeader","http://apache.org","ns");
+    nsp=axiscHeaderBlockCreateNamespaceDeclINamespace(phb, "ns1","http://axis.org");
+    
+    printf("%d\n", axiscNamespaceSetURI(nsp, NULL));
+    printf("%d\n", axiscNamespaceSetURI(nsp, uri));
+    printf("%d\n", axiscNamespaceSetPrefix(nsp, NULL));
+    printf("%d\n", axiscNamespaceSetPrefix(nsp, pf));
+    p=axiscNamespaceGetPrefix(nsp);
+    u=axiscNamespaceGetURI(nsp);
+    printf("Prefix = %s\n" , p);
+    printf("Uri    = %s\n" , u);
+    op = "add";
+    i1 = 2;
+    i2 = 3;
+
+    if (strcmp(op, "add") == 0)
+    {
+        iResult = add(ws, i1, i2);
+        printf("%d\n",  iResult);
+    }
+    
+    destroy_Calculator_stub(ws);
+        
+    printf("---------------------- TEST COMPLETE -----------------------------\n");
+    return 0;
+}
+

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/c/InOutClient.c
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/c/InOutClient.c?rev=407141&r1=407140&r2=407141&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/c/InOutClient.c (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/c/InOutClient.c Tue May 16 20:40:44 2006
@@ -13,15 +13,6 @@
 // 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   */
-/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
-
 
 /*
    Perform a variety of tests.

Added: webservices/axis/trunk/c/tests/auto_build/testcases/tests/INamespaceTest1C.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/tests/INamespaceTest1C.xml?rev=407141&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/tests/INamespaceTest1C.xml (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/tests/INamespaceTest1C.xml Tue May 16 20:40:44 2006
@@ -0,0 +1,16 @@
+<test>
+    <name>INamespaceTest1C</name>
+    <description>INamespaceTest1C</description>
+    <clientLang>c</clientLang>
+    <clientCode>INamespaceTest1Client.c</clientCode>
+    <wsdl>CalculatorDocC.wsdl</wsdl>
+    <expected>
+        <output>
+            INamespaceTest1.expected
+        </output>
+	<request> 
+		INamespaceTest1Request.out 
+	</request>
+    </expected>
+	<endpoint>http://localhost:80/axis/CalculatorDoc</endpoint>
+</test>