From 667eabe2e7156dee3a2c7e8cd86fcee931f951ef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Thu, 2 Dec 2004 20:26:24 +0000 Subject: [PATCH] - use gsoap library instead of compiling stdsoap2.c - re-enabled calling UpdateJobs - GetJob implemented in the example Works with both WSDLs (but I don't know exactly why :-( ) --- org.glite.jp.primary/Makefile | 9 +++++---- org.glite.jp.primary/examples/jpps-test.c | 14 +++++++++++++- org.glite.jp.primary/src/feed.c | 3 +-- org.glite.jp.primary/src/is_client.c | 10 +++++++--- org.glite.jp.primary/src/simple_server.c | 2 -- org.glite.jp.primary/src/soap_ops.c | 14 +++++++++++++- 6 files changed, 39 insertions(+), 13 deletions(-) diff --git a/org.glite.jp.primary/Makefile b/org.glite.jp.primary/Makefile index f599349..0db5174 100644 --- a/org.glite.jp.primary/Makefile +++ b/org.glite.jp.primary/Makefile @@ -60,20 +60,21 @@ SRCS:= simple_server.c soap_ops.c \ EXA_SRCS:=jpps-test.c ${ps_prefix}C.c ${ps_prefix}Client.c -OBJS:=${SRCS:.c=.o} stdsoap2.o -EXA_OBJS:=${EXA_SRCS:.c=.o} stdsoap2.o +OBJS:=${SRCS:.c=.o} +EXA_OBJS:=${EXA_SRCS:.c=.o} COMMONLIB:=-lglite_jp_common +GSOAPLIB:=-L${gsoap_prefix}/lib -lgsoap${GSOAP_DEBUG} default all: compile compile: ${daemon} ${example} ${daemon}: ${OBJS} - ${LINK} -o $@ ${OBJS} ${COMMONLIB} ${GLOBUS_LIBS} + ${LINK} -o $@ ${OBJS} ${COMMONLIB} ${GSOAPLIB} ${GLOBUS_LIBS} ${example}: ${EXA_OBJS} - ${LINK} -o $@ ${EXA_OBJS} + ${LINK} -o $@ ${EXA_OBJS} ${GSOAPLIB} JobProvenanceIS.xh JobProvenancePS.xh: %.xh: %.wsdl JobProvenanceTypes.wsdl typemap.dat cp ${jpproject}/JobProvenanceTypes.wsdl . diff --git a/org.glite.jp.primary/examples/jpps-test.c b/org.glite.jp.primary/examples/jpps-test.c index 5120582..8fb2322 100644 --- a/org.glite.jp.primary/examples/jpps-test.c +++ b/org.glite.jp.primary/examples/jpps-test.c @@ -16,7 +16,7 @@ static void usage(const char *me) " StartUpload jobid class(0,1,2) commit_before mimetype\n" " CommitUpload\n" " RecordTag\n" - " GetJob\n" + " GetJob jobid\n" " FeedIndex destination query_number history continuous\n" ,me); @@ -135,6 +135,18 @@ int main(int argc,char *argv[]) { printf("FeedId: %s\nExpires: %s\n",r.feedId,ctime(&r.expires)); } + } else if (!strcasecmp(argv[1],"GetJob")) { + struct jpsrv__GetJobResponse r; + + if (argc != 3) usage(argv[0]); + + if (!check_fault(soap,soap_call_jpsrv__GetJob(soap,server,"", + argv[2],&r))) + { + printf("JobLog:\t%s\nInput:\t%s\nOutput:\t%s\nTags:\t%s\n", + r.jobLog,r.inputSandbox,r.outputSandbox,r.tags); + } + } else usage(argv[0]); diff --git a/org.glite.jp.primary/src/feed.c b/org.glite.jp.primary/src/feed.c index a6d7ceb..297eb23 100644 --- a/org.glite.jp.primary/src/feed.c +++ b/org.glite.jp.primary/src/feed.c @@ -126,8 +126,7 @@ static int match_feed( } /* matched completely */ - /* FIXME: dont' call it yet - return glite_jpps_single_feed(ctx,feed->destination,job,attrs); */ + return glite_jpps_single_feed(ctx,feed->destination,job,attrs); return 0; } diff --git a/org.glite.jp.primary/src/is_client.c b/org.glite.jp.primary/src/is_client.c index 1a50c03..1d0446a 100644 --- a/org.glite.jp.primary/src/is_client.c +++ b/org.glite.jp.primary/src/is_client.c @@ -21,9 +21,13 @@ int glite_jpps_single_feed( /* TODO: really call JP Index server (via interlogger) */ printf("feed to %s, job %s\n",destination,job); - /* FIXME: check fault */ - // soap_call_jpsrv__UpdateJobs(ctx->other_soap,destination,"", - + if (soap_call_jpsrv__UpdateJobs(ctx->other_soap,destination,"", + /* FIXME: feedId */ "", + /* FIXME: UpdateJobsData */ NULL, + 0, + NULL + )) fprintf(stderr,"UpdateJobs: %s %s\n",ctx->other_soap->fault->faultcode, + ctx->other_soap->fault->faultstring); return 0; } diff --git a/org.glite.jp.primary/src/simple_server.c b/org.glite.jp.primary/src/simple_server.c index c6263e2..3bbb743 100644 --- a/org.glite.jp.primary/src/simple_server.c +++ b/org.glite.jp.primary/src/simple_server.c @@ -26,11 +26,9 @@ int main(int argc, char *argv[]) { soap.user = (void *) ctx; -/* not yet client of JPIS ctx->other_soap = soap_new(); soap_init(ctx->other_soap); soap_set_namespaces(ctx->other_soap,jpis__namespaces); -*/ srand48(time(NULL)); /* feed id generation */ diff --git a/org.glite.jp.primary/src/soap_ops.c b/org.glite.jp.primary/src/soap_ops.c index e9fe8a2..1e5534b 100644 --- a/org.glite.jp.primary/src/soap_ops.c +++ b/org.glite.jp.primary/src/soap_ops.c @@ -335,7 +335,7 @@ SOAP_FMAC5 int SOAP_FMAC6 jpsrv__GetJob( { GLITE_JP_FILECLASS_UNDEF, NULL, NULL } }; - int i; + int i,gotone = 0; glite_jp_error_t err; for (i=0; tab[i].type; i++) { @@ -343,6 +343,7 @@ SOAP_FMAC5 int SOAP_FMAC6 jpsrv__GetJob( switch (glite_jppsbe_get_job_url(ctx,job,tab[i].type,&url)) { case 0: *tab[i].url = soap_strdup(soap,url); free(url); + gotone = 1; break; case ENOENT: *tab[i].url = NULL; @@ -357,6 +358,17 @@ SOAP_FMAC5 int SOAP_FMAC6 jpsrv__GetJob( return SOAP_FAULT; } } + + if (!gotone) { + glite_jp_clear_error(ctx); + err.code = ENOENT; + err.source = __FUNCTION__; + err.desc = "No file found for this job"; + glite_jp_stack_error(ctx,&err); + err2fault(ctx,soap); + glite_jp_clear_error(ctx); + return SOAP_FAULT; + } return SOAP_OK; } -- 1.8.2.3