summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar snowdrop2004-06-03 13:13:37 +0000
committerGravatar snowdrop2004-06-03 13:13:37 +0000
commit0d3bfe08e889344eee4880e4750311aad8641a69 (patch)
tree2de13abc8348391995a8156b8797fe1917f5eeb8
parent5dee322ce245ef858b3d0e6591cdc19d76e4cb30 (diff)
downloadcsoap-0d3bfe08e889344eee4880e4750311aad8641a69.tar.gz
csoap-0d3bfe08e889344eee4880e4750311aad8641a69.tar.bz2
added CallFunc CallVar and CallList objects
-rwxr-xr-xwsdl2c/Makefile.am17
-rwxr-xr-xwsdl2c/wsdl2c.c71
2 files changed, 74 insertions, 14 deletions
diff --git a/wsdl2c/Makefile.am b/wsdl2c/Makefile.am
index e045020..db3a8c0 100755
--- a/wsdl2c/Makefile.am
+++ b/wsdl2c/Makefile.am
@@ -1,15 +1,16 @@
-bin_PROGRAMS=wsdl2c
-
-INCLUDES=$(LIBXML_CFLAGS) -I$(top_srcdir)
-LDFLAGS=$(LIBXML_LIBS)
+bin_PROGRAMS=wsdl2c
+
+INCLUDES=$(LIBXML_CFLAGS) -I$(top_srcdir)
+LDFLAGS=$(LIBXML_LIBS)
xsd2c_root= $(top_srcdir)/xsd2c
+
xsd2c_objs=../xsd2c/util.o \
../xsd2c/formatter.o \
../xsd2c/obj.o \
../xsd2c/xsd2c.o \
../xsd2c/tr.o
-
-wsdl2c_SOURCES=wsdl2c.c
-wsdl2c_LDFLAGS=$(LDFLAGS) $(xsd2c_objs)
-
+
+wsdl2c_SOURCES=CallVar.c CallFunc.c CallList.c wsdl2c.c
+wsdl2c_LDFLAGS=$(LDFLAGS) $(xsd2c_objs)
+
diff --git a/wsdl2c/wsdl2c.c b/wsdl2c/wsdl2c.c
index 5b744e7..4626d67 100755
--- a/wsdl2c/wsdl2c.c
+++ b/wsdl2c/wsdl2c.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: wsdl2c.c,v 1.5 2004/06/03 08:53:34 snowdrop Exp $
+ * $Id: wsdl2c.c,v 1.6 2004/06/03 13:13:47 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -28,6 +28,48 @@
#include <xsd2c/obj.h> /* formatter sax serializer */
#include <string.h>
+#define _DESERIALIZER_DISABLE_
+#include "CallList.h"
+
+/* ------------- Just for test --------------------------------- */
+
+int Writer_Tab = 0;
+int Writer_Ret = 0;
+
+void Writer_StartElement(const char* element_name, int attr_count, char **keys, char **values, void* userData)
+{
+ int i, j;
+ if (Writer_Ret) printf("\n");
+ for (j=0;j<Writer_Tab;j++) printf("\t");
+ printf("<%s", element_name);
+ for (i=0;i<attr_count;i++)
+ {
+ printf(" %s = \"%s\"", keys[i], values[i]);
+ }
+ printf(">");
+ Writer_Tab++;
+ Writer_Ret = 1;
+}
+
+void Writer_Characters(const char* element_name, const char* chars, void* userData)
+{
+ printf("%s", chars!=NULL?chars:"null");
+}
+
+void Writer_EndElement(const char* element_name, void* userData)
+{
+ int j;
+ Writer_Tab--;
+ if (!Writer_Ret)
+ for (j=0;j<Writer_Tab;j++) printf("\t");
+ printf("</%s>\n", element_name);
+ Writer_Ret = 0;
+}
+
+/* ------------------------------------------------------------- */
+
+struct CallList* callList = NULL;
+
xmlXPathObjectPtr xpath_eval(xmlDocPtr doc, const char *xpath)
{
xmlXPathContextPtr context;
@@ -192,13 +234,13 @@ xmlNodePtr findSubNode(xmlNodePtr root, const char *element_name)
}
-void handleInputParameters(xmlDocPtr doc, const char *name)
+void handleInputParameters(xmlDocPtr doc, const char *name, struct CallFunc *func)
{
char ns[10];
char message_name[255];
xmlNodePtr node;
xmlNodePtr cur;
-
+ struct CallVar *var;
xmlChar *var_name, *var_type;
parseNS(name, ns, message_name); /* check why to pase ns? */
@@ -243,6 +285,10 @@ void handleInputParameters(xmlDocPtr doc, const char *name)
continue;
}
+ var = CallVar_Create();
+ CallVar_Set_name(var, (const char*)var_name);
+ CallVar_Set_type(var, (const char*)var_type);
+ CallFunc_Add_in(func, var);
fprintf(stdout, "\t\t(%s,%s)\n", trXSD2C((const char*)var_type), (const char*)var_name);
@@ -262,7 +308,7 @@ void handlePortType(xmlDocPtr doc, const char *name)
xmlNodePtr cur;
xmlChar *attr_name;
xmlChar *message;
-
+ struct CallFunc *func;
char opname[255];
node = findPortType(doc, name);
@@ -292,6 +338,11 @@ void handlePortType(xmlDocPtr doc, const char *name)
strcpy(opname, (const char*)attr_name);
xmlFree(attr_name);
+
+ func = CallFunc_Create();
+ CallList_Add_operation(callList, func);
+
+ CallFunc_Set_name(func, opname);
fprintf(stdout, "Operation -> '%s'\n", opname);
/* handle input */
@@ -311,7 +362,7 @@ void handlePortType(xmlDocPtr doc, const char *name)
fprintf(stdout, "\tinput = '%s'\n", (const char*)message);
- handleInputParameters(doc, (const char*)message);
+ handleInputParameters(doc, (const char*)message, func);
xmlFree(message);
@@ -515,7 +566,7 @@ int main(int argc, char *argv[])
if (!xsdInitObjModule(xsdRoot))
return 1;
-
+
if (xsdEngineRun(xsdRoot, outDir)) {
@@ -523,8 +574,16 @@ int main(int argc, char *argv[])
return 1;
}
+ callList = CallList_Create();
wsdlParse(doc);
+ CallList_Sax_Serialize(callList, "CallList",
+ Writer_StartElement,
+ Writer_Characters,
+ Writer_EndElement, 0);
+
+ CallList_Free(callList);
+
trFreeModule();
objFreeModule();