Final stage - compatibility of JP with gSoap 2.7.96b. glite-jp-primary_branch_1_2_0_RC31
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 21 Mar 2007 12:29:26 +0000 (12:29 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 21 Mar 2007 12:29:26 +0000 (12:29 +0000)
Basic testing passed but certainly not all features was tested.

org.glite.jp.primary/examples/dag-deps.c
org.glite.jp.primary/examples/jpps-test.c
org.glite.jp.primary/src/is_client.c
org.glite.jp.primary/src/soap_ops.c
org.glite.jp.primary/src/soap_util.c

index f8f0f3a..2796df3 100644 (file)
@@ -93,7 +93,7 @@ int main(int argc,char *argv[])
        if ((ret = check_fault(soap,soap_call___jpsrv__GetJobAttributes(soap,server,"",&in,&out))))
                return 1;
 
-               ad = cclassad_create(GSOAP_STRING(out.attrValues[0]->value));
+               ad = cclassad_create(GSOAP_STRING(GLITE_SECURITY_GSOAP_LIST_GET(out.attrValues, 0)->value));
        if (!ad) {
                fputs("Can't parse JDL\n",stderr);
                return 1;
index fc54c3e..98dc20b 100644 (file)
@@ -20,7 +20,7 @@
 #define soap_call___jpsrv__GetJob soap_call___ns1__GetJob
 #endif
 
-#define dprintf(x) printf x
+#define dprintf(FMT, ARGS...) printf(FMT, ##ARGS)
 #include "glite/jp/ws_fault.c"
 #define check_fault(SOAP, ERR) glite_jp_clientCheckFault((SOAP), (ERR), NULL, 0)
 
@@ -155,6 +155,7 @@ int main(int argc,char *argv[])
                        "http://egee.cesnet.cz/en/Schema/LB/Attributes:RB",
                        "http://egee.cesnet.cz/en/Schema/JP/System:owner"
                };
+               int sizepq;
 
                struct jptype__stringOrBlob vals[2];
                memset(vals, 0, sizeof vals);
@@ -172,11 +173,16 @@ int main(int argc,char *argv[])
                                jptype__queryOp__UNEQUAL,
                                NULL, vals+1, NULL
                        }
-               }, *qp[] = { q, q+1 };
+               };
+               GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, primaryQuery) pq;
+
+               GLITE_SECURITY_GSOAP_LIST_CREATE0(soap, pq, sizepq, struct jptype__primaryQuery, 2);
+               memcpy(GLITE_SECURITY_GSOAP_LIST_GET(pq, 0), &q[0], sizeof(q[0]));
+               memcpy(GLITE_SECURITY_GSOAP_LIST_GET(pq, 1), &q[1], sizeof(q[1]));
                struct _jpelem__FeedIndex       in = {
                        "http://some.index//",
                        2,ap,
-                       2,qp,
+                       sizepq,pq,
                        0,
                        1
                };
@@ -188,6 +194,7 @@ int main(int argc,char *argv[])
                {
                        printf("FeedId: %s\nExpires: %s\n",out.feedId,ctime(&out.feedExpires));
                }
+               GLITE_SECURITY_GSOAP_LIST_DESTROY(soap, &in, conditions);
         }
 /* FIXME: new wsdl  */
 #if 0
@@ -205,6 +212,7 @@ int main(int argc,char *argv[])
        else if (!strcasecmp(argv[1],"GetJobFiles")) {
                struct _jpelem__GetJobFiles     in;
                struct _jpelem__GetJobFilesResponse     out;
+               struct jptype__jppsFile *outf;
 
                if (argc != 3) usage(argv[0]);
                in.jobid = argv[2];
@@ -217,10 +225,11 @@ int main(int argc,char *argv[])
                        printf("JobFiles:\n");
 
                        for (i=0; i<out.__sizefiles;i++) {
+                               outf = GLITE_SECURITY_GSOAP_LIST_GET(out.files, i);
                                printf("\tclass = %s, name = %s, url = %s\n",
-                                               out.files[i]->class_,
-                                               out.files[i]->name,
-                                               out.files[i]->url);
+                                               outf->class_,
+                                               outf->name,
+                                               outf->url);
                        }
                }
 
@@ -228,6 +237,7 @@ int main(int argc,char *argv[])
        else if (!strcasecmp(argv[1],"GetJobAttr")) {
                struct _jpelem__GetJobAttributes        in;
                struct _jpelem__GetJobAttributesResponse        out;
+               struct jptype__attrValue        *outav;
                
                if (argc != 4) usage(argv[0]);
                in.jobid = argv[2];
@@ -239,13 +249,15 @@ int main(int argc,char *argv[])
                        int     i;
 
                        puts("Attribute values:");
-                       for (i=0; i<out.__sizeattrValues; i++)
+                       for (i=0; i<out.__sizeattrValues; i++) {
+                               outav = GLITE_SECURITY_GSOAP_LIST_GET(out.attrValues, i);
                                printf("\t%s\t%s\t%s",
-                                       GSOAP_ISSTRING(out.attrValues[i]->value) ?
-                                               GSOAP_STRING(out.attrValues[i]->value) :
+                                       GSOAP_ISSTRING(outav->value) ?
+                                               GSOAP_STRING(outav->value) :
                                                "binary",
-                                       orig2str(out.attrValues[i]->origin),
-                                       ctime(&out.attrValues[i]->timestamp));
+                                       orig2str(outav->origin),
+                                       ctime(&outav->timestamp));
+                       }
 
                }
                
index 9cf17bf..c4ad7c7 100644 (file)
@@ -4,7 +4,9 @@
 #include <string.h>
 #include <errno.h>
 #include <assert.h>
+#include <stdsoap2.h>
 
+#undef SOAP_FMAC1
 #define SOAP_FMAC1 static
 
 #include "glite/jp/types.h"
 
 #include "jpis_.nsmap"
 
-#include "glite/jp/ws_fault.c"
-#include "soap_util.c"
-
 #include "soap_env_ctx.h"
 #include "soap_env_ctx.c"
 
+#include "glite/jp/ws_fault.c"
+#include "soap_util.c"
+
 extern char *server_key, *server_cert; /* XXX */
 
 static int check_other_soap(glite_jp_context_t ctx)
@@ -115,8 +117,8 @@ int glite_jpps_single_feed(
        in.jobAttributes = &jrp;
 
        for (i=0; attrs[i].name; i++);
-       jr.jobid = (char *) job; /* XXX: const */
-       jr.owner = owner;
+       jr.jobid = soap_strdup(ctx->other_soap, job);
+       jr.owner = soap_strdup(ctx->other_soap, owner);
 
        jr.__sizeattributes = jp2s_attrValues(ctx->other_soap,
                        (glite_jp_attrval_t *) attrs, /* XXX: const */
@@ -149,6 +151,8 @@ int glite_jpps_single_feed(
        }
        RESTORE_SOAP_CTX
 
+       soap_dealloc(ctx->other_soap, jr.jobid);
+       soap_dealloc(ctx->other_soap, jr.owner);
        attrValues_free(ctx->other_soap,jr.attributes,jr.__sizeattributes);
 
        return err.code;
@@ -181,8 +185,7 @@ int glite_jpps_multi_feed(
 
        in.feedId = (char *) feed; /* XXX: const */
        in.feedDone = done;
-       in.__sizejobAttributes = njobs;
-       in.jobAttributes = malloc(njobs * sizeof *in.jobAttributes);
+       GLITE_SECURITY_GSOAP_LIST_CREATE(ctx->other_soap, &in, jobAttributes, struct jptype__jobRecord, njobs);
 
        for (i=0; i<njobs; i++) {
                puts(jobs[i]);
@@ -190,7 +193,7 @@ int glite_jpps_multi_feed(
                        printf("%s = %s\n",attrs[i][j].name,attrs[i][j].value);
                putchar(10);
 
-               in.jobAttributes[i] = jr = malloc(sizeof *jr);
+               jr = GLITE_SECURITY_GSOAP_LIST_GET(in.jobAttributes, i);
                jr->jobid = jobs[i];
                jr->owner = owners[i];
 
@@ -208,11 +211,10 @@ int glite_jpps_multi_feed(
                soap_call___jpsrv__UpdateJobs(ctx->other_soap,destination,"", &in,&out));
        RESTORE_SOAP_CTX
        for (i=0; i<njobs; i++) {
-               jr = in.jobAttributes[i];
+               jr = GLITE_SECURITY_GSOAP_LIST_GET(in.jobAttributes, i);
                attrValues_free(ctx->other_soap,jr->attributes,jr->__sizeattributes);
-               free(jr);
        }
-       free(in.jobAttributes);
+       GLITE_SECURITY_GSOAP_LIST_DESTROY(ctx->other_soap, &in, jobAttributes);
 
        return err.code;
 }
index 187af84..13b5de9 100644 (file)
@@ -1,7 +1,9 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <assert.h>
+#include <stdsoap2.h>
 
+#undef SOAP_FMAC1
 #define SOAP_FMAC1     static
 
 #include "glite/jp/types.h"
@@ -325,7 +327,7 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__FeedIndex(
        }
 
        memcpy(attrs,in->attributes,sizeof *attrs * in->__sizeattributes);
-       for (i = 0; i<in->__sizeconditions; i++) s2jp_query(in->conditions[i],qry+i);
+       for (i = 0; i<in->__sizeconditions; i++) s2jp_query(GLITE_SECURITY_GSOAP_LIST_GET(in->conditions, i),qry+i);
 
        if (in->history) {
                if (glite_jpps_run_feed(ctx,in->destination,attrs,qry,in->continuous,&feed_id)) {
@@ -386,11 +388,11 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetJobFiles(
        int     i,n;
        glite_jp_error_t        err;
        void    **pd;
-       struct jptype__jppsFile         **f = NULL;
+       struct jptype__jppsFile         *f = NULL;
        glite_jp_attrval_t      meta[2];
 
        memset(&err,0,sizeof err);
-       out->__sizefiles = 0;
+       n = 0;
 
        memset(meta,0,sizeof meta);
         meta[0].name = strdup(GLITE_JP_ATTR_OWNER);
@@ -409,12 +411,13 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetJobFiles(
                for (i=0; plugin->uris[i]; i++) {
                        glite_jp_clear_error(ctx);
                        switch (glite_jppsbe_get_job_url(ctx,in->jobid,plugin->classes[i],NULL,&url)) {
-                               case 0: n = out->__sizefiles++;
-                                       f = realloc(f,out->__sizefiles * sizeof *f);
-                                       f[n] = soap_malloc(soap, sizeof **f);
-                                       f[n]->class_ = soap_strdup(soap,plugin->uris[i]);
-                                       f[n]->name = NULL;
-                                       f[n]->url = soap_strdup(soap,url);
+                               case 0:
+                                       f = realloc(f,(n + 1) * sizeof *f);
+                                       f[n].class_ = soap_strdup(soap,plugin->uris[i]);
+#warning FIXME: file name required in WSDL
+                                       f[n].name = NULL;
+                                       f[n].url = soap_strdup(soap,url);
+                                       n++;
                                        free(url);
                                        break;
                                case ENOENT:
@@ -431,7 +434,7 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetJobFiles(
                }
        }
 
-       if (!out->__sizefiles) {
+       if (!n) {
                glite_jp_clear_error(ctx);
                err.code = ENOENT;
                err.source = __FUNCTION__;
@@ -442,8 +445,8 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetJobFiles(
                return SOAP_FAULT;
        }
 
-       out->files = soap_malloc(soap,out->__sizefiles * sizeof *f);
-       memcpy(out->files,f,out->__sizefiles * sizeof *f);
+       GLITE_SECURITY_GSOAP_LIST_CREATE(soap, out, files, struct jptype__jppsFile, n);
+       for (i = 0; i < n; i++) memcpy(GLITE_SECURITY_GSOAP_LIST_GET(out->files, i), &f[i], sizeof(f[i]));
 
        return SOAP_OK;
 err:
index 1ece4d0..5d6898d 100644 (file)
@@ -11,38 +11,40 @@ static enum jptype__attrOrig jp2s_origin(glite_jp_attr_orig_t o)
 static int jp2s_attrValues(
        struct soap *soap,
        glite_jp_attrval_t *in,
-       struct jptype__attrValue ***outp,
+       GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, attrValue) *outp,
        int freeit)
 {
-       struct jptype__attrValue **out;
+       GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, attrValue)       out;
+       struct jptype__attrValue        a;
        int     i,cnt;
 
        for (cnt=0; in[cnt].name; cnt++);
               
-       out = soap_malloc(soap,cnt * sizeof *out);
+       GLITE_SECURITY_GSOAP_LIST_CREATE0(soap, out, cnt, struct jptype__attrValue, cnt);
        for (i=0; in[i].name; i++) {
-               struct jptype__attrValue        *a = soap_malloc(soap,sizeof *a);
-               out[i] = a;
-
-               a->name = soap_strdup(soap,in[i].name); 
+               memset(&a, 0, sizeof a);
+               a.name = soap_strdup(soap,in[i].name); 
                if (freeit) free(in[i].name);
-               a->value = soap_malloc(soap,sizeof *a->value);
-               memset(a->value, 0, sizeof *a->value);
+               a.value = soap_malloc(soap,sizeof *a.value);
+               memset(a.value, 0, sizeof *a.value);
                if (in[i].binary) {
-                       GSOAP_SETBLOB(a->value, soap_malloc(soap,sizeof *GSOAP_BLOB(a->value)));
-                       memset(GSOAP_BLOB(a->value),0,sizeof *GSOAP_BLOB(a->value));
-                       GSOAP_BLOB(a->value)->__ptr = soap_malloc(soap,in[i].size);
-                       GSOAP_BLOB(a->value)->__size = in[i].size;
-                       memcpy(GSOAP_BLOB(a->value)->__ptr,in[i].value,in[i].size);
+                       GSOAP_SETBLOB(a.value, soap_malloc(soap,sizeof *GSOAP_BLOB(a.value)));
+                       memset(GSOAP_BLOB(a.value),0,sizeof *GSOAP_BLOB(a.value));
+                       GSOAP_BLOB(a.value)->__ptr = soap_malloc(soap,in[i].size);
+                       GSOAP_BLOB(a.value)->__size = in[i].size;
+                       memcpy(GSOAP_BLOB(a.value)->__ptr,in[i].value,in[i].size);
                }
                else {
-                       GSOAP_SETSTRING(a->value, soap_strdup(soap,in[i].value));
+                       GSOAP_SETSTRING(a.value, soap_strdup(soap,in[i].value));
                }
+
                if (freeit) free(in[i].value);
-               a->origin = jp2s_origin(in[i].origin);
-               a->originDetail = in[i].origin_detail ? soap_strdup(soap,in[i].origin_detail) : NULL;
+               a.origin = jp2s_origin(in[i].origin);
+               a.originDetail = in[i].origin_detail ? soap_strdup(soap,in[i].origin_detail) : NULL;
                if (freeit) free(in[i].origin_detail);
-               a->timestamp = in[i].timestamp;
+               a.timestamp = in[i].timestamp;
+
+               memcpy(GLITE_SECURITY_GSOAP_LIST_GET(out, i), &a, sizeof a);
        }
        if (freeit) free(in);
 
@@ -52,21 +54,21 @@ static int jp2s_attrValues(
 
 static void attrValues_free(
        struct soap *soap,
-       struct jptype__attrValue **a,
+       GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, attrValue) a,
        int     na)
 {
        int     i;
+       struct jptype__attrValue *ai;
 
        for (i=0; i<na; i++) {
-               soap_dealloc(soap,a[i]->name);
-               if (GSOAP_ISSTRING(a[i]->value) && GSOAP_STRING(a[i]->value)) soap_dealloc(soap,GSOAP_STRING(a[i]->value));
-               if (GSOAP_ISBLOB(a[i]->value) && GSOAP_BLOB(a[i]->value)) {
-                       soap_dealloc(soap,GSOAP_BLOB(a[i]->value)->__ptr);
-                       soap_dealloc(soap,GSOAP_BLOB(a[i]->value));
+               ai = GLITE_SECURITY_GSOAP_LIST_GET(a, i);
+               if (GSOAP_ISSTRING(ai->value) && GSOAP_STRING(ai->value)) soap_dealloc(soap,GSOAP_STRING(ai->value));
+               if (GSOAP_ISBLOB(ai->value) && GSOAP_BLOB(ai->value)) {
+                       soap_dealloc(soap,GSOAP_BLOB(ai->value)->__ptr);
+                       soap_dealloc(soap,GSOAP_BLOB(ai->value));
                }
-               soap_dealloc(soap,a[i]->value);
-               if (a[i]->originDetail) soap_dealloc(soap,a[i]->originDetail);
-               soap_dealloc(soap,a[i]);
+               soap_dealloc(soap,ai->value);
+               if (ai->originDetail) soap_dealloc(soap,ai->originDetail);
        }
-       soap_dealloc(soap,a);
+       GLITE_SECURITY_GSOAP_LIST_DESTROY0(soap, a, na);
 }