Basic testing passed but certainly not all features was tested.
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;
#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)
"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);
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
};
{
printf("FeedId: %s\nExpires: %s\n",out.feedId,ctime(&out.feedExpires));
}
+ GLITE_SECURITY_GSOAP_LIST_DESTROY(soap, &in, conditions);
}
/* FIXME: new wsdl */
#if 0
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];
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);
}
}
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];
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));
+ }
}
#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)
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 */
}
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;
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]);
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];
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;
}
#include <stdio.h>
#include <fcntl.h>
#include <assert.h>
+#include <stdsoap2.h>
+#undef SOAP_FMAC1
#define SOAP_FMAC1 static
#include "glite/jp/types.h"
}
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)) {
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);
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:
}
}
- if (!out->__sizefiles) {
+ if (!n) {
glite_jp_clear_error(ctx);
err.code = ENOENT;
err.source = __FUNCTION__;
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:
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);
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);
}