${CXX} -c ${CFLAGS} ${TEST_INC} $<
${LINKXX} -o $@ test_soap_conv.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${TEST_LIBS}
-examples: ws_getversion ws_jobstat ws_query_ex ws_joblog
+examples: ws_getversion ws_jobstat ws_query_ex ws_joblog ws_userjobs
ws_getversion: ws_getversion.o ${WS_CLIENT_OBJS}
- ${LINK} -o $@ ws_getversion.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS}
+ ${LINK} -o $@ $< ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS}
ws_jobstat: ws_jobstat.o ${WS_CLIENT_OBJS}
- ${LINK} -o $@ ws_jobstat.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS}
+ ${LINK} -o $@ $< ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS}
ws_query_ex: ws_query_ex.o ${WS_CLIENT_OBJS}
- ${LINK} -o $@ ws_query_ex.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS}
+ ${LINK} -o $@ $< ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS}
ws_joblog: ws_joblog.o ${WS_CLIENT_OBJS}
- ${LINK} -o $@ ws_joblog.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS}
+ ${LINK} -o $@ $< ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS}
+
+ws_userjobs: ws_userjobs.o ${WS_CLIENT_OBJS}
+ ${LINK} -o $@ $< ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS}
${STATIC_LIB_BK}: ${LIB_OBJS_BK}
ar crv $@ ${LIB_OBJS_BK}
--- /dev/null
+#include <assert.h>
+#include <getopt.h>
+#include <stdsoap2.h>
+
+#include "glite/security/glite_gsplugin.h"
+#include "glite/lb/consumer.h"
+
+#include "bk_ws_H.h"
+#include "ws_fault.h"
+
+#include "soap_version.h"
+#if GSOAP_VERSION <= 20602
+#define soap_call___lb__UserJobs soap_call___ns1__UserJobs
+#endif
+
+#include "LoggingAndBookkeeping.nsmap"
+
+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;
+ glite_gsplugin_Context gsplugin_ctx;
+ struct soap soap;
+ struct _lbe__UserJobs in;
+ struct _lbe__UserJobsResponse out;
+ int opt, err, i;
+ char *server = "http://localhost:9003/",
+ *name = NULL,
+ *st;
+
+
+ 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 = optarg; break;
+ case '?': usage(name); return 1;
+ }
+
+ edg_wll_InitContext(&ctx);
+ glite_gsplugin_init_context(&gsplugin_ctx);
+
+ soap_init(&soap);
+ soap_set_namespaces(&soap, namespaces);
+
+ if ( soap_register_plugin_arg(&soap, glite_gsplugin, (void *)gsplugin_ctx) )
+ {
+ soap_print_fault(&soap, stderr);
+ return 1;
+ }
+
+ memset(&in, 0, sizeof(in));
+ memset(&out, 0, sizeof(out));
+ switch (err = soap_call___lb__UserJobs(&soap, server, "", &in, &out))
+ {
+ case SOAP_OK:
+ printf("Server version: %p\n", &out);
+ assert(out.__sizejobs == out.__sizestates);
+ for (i = 0; i < out.__sizejobs; i++) {
+ st = edg_wll_StatToString(out.states[i]->state);
+ printf("\t%s\t%s\n", out.jobs[i], st);
+ free(st);
+ }
+
+ break;
+ case SOAP_FAULT:
+ case SOAP_SVR_FAULT:
+ {
+ char *et,*ed;
+
+ edg_wll_FaultToErr(&soap,ctx);
+ edg_wll_Error(ctx,&et,&ed);
+ fprintf(stderr,"%s: %s (%s)\n",argv[0],et,ed);
+ exit(1);
+ }
+ default:
+ printf("???, err=%d\n", err);
+ soap_print_fault(&soap, stderr);
+ }
+
+ soap_end(&soap);
+ soap_done(&soap);
+ glite_gsplugin_free_context(gsplugin_ctx);
+ edg_wll_FreeContext(ctx);
+
+ return 0;
+}
char *userid, *stmt = NULL,
*res = NULL;
char *can_peername;
- int njobs = 0,ret,i,j,idx;
+ int njobs = 0,ret,i,idx;
edg_wlc_JobId *out = NULL;
glite_lbu_Statement sth = NULL;
edg_wll_ErrorCode err = 0;
*states = calloc(njobs+1, sizeof(**states));
idx = 0;
for (i = 0; i < njobs; i++) {
- if (edg_wll_JobStatusServer(ctx, out[idx], -1, &(*states)[idx]) != 0) {
- if (edg_wll_Error(ctx, NULL, NULL) == ENOENT) {
- /* some jobs may be purged meanwhile, ignore */
- continue;
- }
- else break;
- }
+ if (edg_wll_JobStatusServer(ctx, out[idx], -1, &(*states)[idx]) != 0)
+ edg_wll_ResetError(ctx);
idx++;
}
}
#define edg_wll_CommonJobsResponseToSoap do { \
- int i; \
+ int count, i; \
\
assert(out); \
out->__sizejobs = 0; \
out->__sizestates = 0; \
out->states = NULL; \
\
+ count = 0; \
if ( jobs ) { \
for ( i = 0; jobs[i]; i++ ) ; \
- out->jobs = soap_malloc(soap, sizeof(*(out->jobs))*i); \
+ count = i; \
+ out->jobs = soap_malloc(soap, sizeof(*(out->jobs))*count); \
if ( !out->jobs ) return SOAP_FAULT; \
- out->__sizejobs = i; \
+ out->__sizejobs = count; \
for ( i = 0; jobs[i]; i++ ) { \
char *s; \
if ( !(s = edg_wlc_JobIdUnparse(jobs[i])) ) return SOAP_FAULT; \
} \
} \
if ( states ) { \
- for ( i = 0; states[i].state; i++ ) ; \
- GLITE_SECURITY_GSOAP_LIST_CREATE(soap, out, states, struct lbt__jobStatus, i); \
+ GLITE_SECURITY_GSOAP_LIST_CREATE(soap, out, states, struct lbt__jobStatus, count); \
if ( !out->states ) return SOAP_FAULT; \
\
- for ( i = 0; states[i].state; i++ ) \
+ for ( i = 0; i < count; i++ ) \
if ( edg_wll_StatusToSoap(soap, states+i, GLITE_SECURITY_GSOAP_LIST_GET(out->states, i)) ) \
return SOAP_FAULT; \
} \