- function GetVersion added
authorJiří Škrábal <nykolas@ics.muni.cz>
Wed, 20 Oct 2004 08:56:36 +0000 (08:56 +0000)
committerJiří Škrábal <nykolas@ics.muni.cz>
Wed, 20 Oct 2004 08:56:36 +0000 (08:56 +0000)
org.glite.lb.server/Makefile
org.glite.lb.server/examples/ws_getversion.c [new file with mode: 0644]
org.glite.lb.server/project/LB.wsdl
org.glite.lb.server/src/ws_query.c

index 6c0018d..3354d89 100644 (file)
@@ -49,8 +49,10 @@ DEBUG:=-g -O0 -Wall
 #      -I/usr/include/libxml2 \
 
 # -DNO_VOMS -DNO_GACL to be removed when voms/gridsite are available
-CFLAGS:= -DNO_VOMS -DNO_GACL ${WS_CFLAGS} \
-       ${DEBUG} -I${stagedir}/include -I${top_srcdir}/src -I. \
+CFLAGS:= -DNO_VOMS -DNO_GACL \
+       ${WS_CFLAGS} ${DEBUG} \
+       -DVERSION=\"${version}\" \
+       -I${stagedir}/include -I${top_srcdir}/src -I. \
        -I${expat_prefix}/include \
        -I${ares_prefix}/include \
        -I${gsoap_prefix}/include \
@@ -161,7 +163,10 @@ test_soap_conv: test_soap_conv.cpp ${WS_CLIENT_OBJS}
        ${CXX} -c ${CFLAGS} ${TEST_INC} $<
        ${LINKXX} -o $@ test_soap_conv.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${COMMON_LIB} ${TEST_LIBS}
 
-examples: ws_jobstat ws_query_ex 
+examples: ws_getversion ws_jobstat ws_query_ex
+
+ws_getversion: ws_getversion.o ${WS_CLIENT_OBJS}
+       ${LINK} -o $@ ws_getversion.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${EXT_LIBS}
 
 ws_jobstat: ws_jobstat.o ${WS_CLIENT_OBJS}
        ${LINK} -o $@ ws_jobstat.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${EXT_LIBS}
diff --git a/org.glite.lb.server/examples/ws_getversion.c b/org.glite.lb.server/examples/ws_getversion.c
new file mode 100644 (file)
index 0000000..89bea11
--- /dev/null
@@ -0,0 +1,60 @@
+#include <getopt.h>
+#include <stdsoap2.h>
+
+#include "glite/lb/consumer.h"
+
+#include "ws_plugin.h"
+#include "bk_ws_H.h"
+
+static struct option opts[] = {
+       {"help",        0,      NULL,   'h'},
+       {"server",      1,      NULL,   'm'},
+};
+
+static void usage(char *me)
+{
+       fprintf(stderr,"usage: %s [option]\n"
+               "\t-h, --help      Shows this screen.\n"
+               "\t-m, --server    BK server address:port.\n"
+               , me);
+}
+
+static void printstat(edg_wll_JobStat stat, int level);
+
+int main(int argc,char** argv)
+{
+    edg_wll_Context                                            ctx;
+    struct soap                                                   *mydlo = soap_new();
+    struct edgwll2__GetVersionResponse out;
+    int                                                                        opt, err;
+       char                                                       *server = "http://localhost:8999/",
+                                                                          *name = NULL;
+
+
+       name = strrchr(argv[0],'/');
+       if (name) name++; else name = argv[0];
+
+       while ((opt = getopt_long(argc, argv, "hm:", opts, NULL)) != EOF) switch (opt)
+       {
+       case 'h': usage(name); return 0;
+       case 'm': server = strdup(optarg); break;
+       case '?': usage(name); return 1;
+       }
+
+    edg_wll_InitContext(&ctx);
+
+       if ( soap_register_plugin_arg(mydlo, edg_wll_ws_plugin, (void *)ctx) )
+       {
+               soap_print_fault(mydlo, stderr);
+               return 1;
+       }
+
+    switch (err = soap_call_edgwll2__GetVersion(mydlo, server, "", &out))
+       {
+       case SOAP_OK: printf("Server version: %s\n", out.version); break;
+       case SOAP_FAULT: 
+       default: printf("???\n");
+    }
+
+    return 0;
+}
index 33e39d1..4313f00 100644 (file)
                        <element name="GenericLBFault" type="glitenstypes:GenericLBFaultType"/>
                </schema>
        </WSDL:types>
+       <message name="GetVersionRequest">
+       </message>
+       <message name="GetVersionResponse">
+               <part name="version" type="xsd:string"/>
+       </message>
        <message name="JobStatusRequest">
                <part name="jobid" type="xsd:string"/>
                <part name="flags" type="glitenstypes:JobStatFlags"/>
        </message>
 
        <portType name="LoggingAndBookkeeping_PortType">
+               <operation name="GetVersion">
+                       <documentation>Query the version of LB servere
+
+Input: no input
+
+Output: Version of LB server
+
+Faults: GenericLBFault
+                       </documentation>
+                       <input name="i" message="tns:GetVersionRequest"/>
+                       <output name="o" message="tns:GetVersionResponse"/>
+                       <fault name="f" message="tns:GenericLBFault"/>
+               </operation>
                <operation name="JobStatus">
                        <documentation>Retrieve state of a single job.
 
@@ -280,6 +298,18 @@ Faults: GenericLBFault
        </portType>
        <binding name="LoggingAndBookkeeping" type="tns:LoggingAndBookkeeping_PortType">
                <SOAP:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+               <operation name="GetVersion">
+                       <SOAP:operation style="rpc"/>
+                       <input name="i">
+                               <SOAP:body use="literal" namespace="http://glite.org/wsdl/services/lb"/>
+                       </input>
+                       <output name="o">
+                               <SOAP:body use="literal" namespace="http://glite.org/wsdl/services/lb"/>
+                       </output>
+                       <fault name="f">
+                               <SOAP:fault name="f" use="literal"/>
+                       </fault>
+               </operation>
                <operation name="JobStatus">
                        <SOAP:operation style="rpc"/>
                        <input name="i">
index 60dd118..b37a9f2 100644 (file)
 #include "ws_typeref.h"
 
 
+int edgwll2__GetVersion(
+        struct soap                                               *soap,
+               struct edgwll2__GetVersionResponse *out)
+{
+       out->version = strdup(VERSION);
+
+       return SOAP_OK;
+}
+
 int edgwll2__JobStatus(
         struct soap                                               *soap,
         char                                                      *jobid,