So compatible with 2.7.6b for now.
#include <cclassad.h>
-#include "glite/security/glite_gsplugin.h"
#include "glite/jp/known_attr.h"
#include "jpps_H.h"
#include "jpps_.nsmap"
#include "jptype_map.h"
+#include "glite/security/glite_gsplugin.h"
+#include "glite/security/glite_gscompat.h"
-#include "soap_version.h"
#if GSOAP_VERSION <= 20602
#define soap_call___jpsrv__RegisterJob soap_call___ns1__RegisterJob
#define soap_call___jpsrv__StartUpload soap_call___ns1__StartUpload
#define soap_call___jpsrv__GetJob soap_call___ns1__GetJob
#endif
+#define dprintf(FMT, ARGS...) fprintf(stderr, (FMT), ##ARGS)
+#include "glite/jp/ws_fault.c"
+#define check_fault(SOAP, ERR) glite_jp_clientCheckFault((SOAP), (ERR), NULL, 0)
+
static void usage(const char *me)
{
exit (EX_USAGE);
}
-
-static int check_fault(struct soap *soap,int err) {
- struct SOAP_ENV__Detail *detail;
- struct jptype__genericFault *f;
- char *reason,indent[200] = " ";
-
- switch(err) {
- case SOAP_OK: puts("OK");
- break;
- case SOAP_FAULT:
- case SOAP_SVR_FAULT:
- if (soap->version == 2) {
- detail = soap->fault->SOAP_ENV__Detail;
- reason = soap->fault->SOAP_ENV__Reason;
- }
- else {
- detail = soap->fault->detail;
- reason = soap->fault->faultstring;
- }
- fputs(reason,stderr);
- putc('\n',stderr);
- assert(detail->__type == SOAP_TYPE__genericFault);
-#if GSOAP_VERSION >=20700
- f = ((struct _genericFault *) detail->fault)
-#else
- f = ((struct _genericFault *) detail->value)
-#endif
- -> jpelem__genericFault;
-
- while (f) {
- fprintf(stderr,"%s%s: %s (%s)\n",indent,
- f->source,f->text,f->description);
- f = f->reason;
- strcat(indent," ");
- }
- return -1;
-
- default: soap_print_fault(soap,stderr);
- return -1;
- }
- return 0;
-}
static const char *orig2str(enum jptype__attrOrig orig)
{
if ((ret = check_fault(soap,soap_call___jpsrv__GetJobAttributes(soap,server,"",&in,&out))))
return 1;
- ad = cclassad_create(out.attrValues[0]->value->string);
+ ad = cclassad_create(GSOAP_STRING(out.attrValues[0]->value));
if (!ad) {
fputs("Can't parse JDL\n",stderr);
return 1;
in.tag = &tagval;
tagval.name = GLITE_JP_ATTR_WF_SUCCESSOR;
tagval.value = &val;
- val.string = js;
- val.blob = NULL;
+ GSOAP_STRING(&val) = js;
+ GSOAP_BLOB(&val) = NULL;
printf("Register successor ...\n");
ret = check_fault(soap,soap_call___jpsrv__RecordTag(soap, server, "",&in, &empty));
in.jobid = js;
tagval.name = GLITE_JP_ATTR_WF_ANCESTOR;
- val.string = ja;
+ GSOAP_STRING(&val) = ja;
printf("Register ancestor ...\n");
ret = check_fault(soap,soap_call___jpsrv__RecordTag(soap, server, "",&in, &empty));
#include <string.h>
#include <assert.h>
-#include "glite/security/glite_gsplugin.h"
-
#include "jpps_H.h"
#include "jpps_.nsmap"
#include "jptype_map.h"
+#include "glite/security/glite_gsplugin.h"
+#include "glite/security/glite_gscompat.h"
-#include "soap_version.h"
#if GSOAP_VERSION <= 20602
#define soap_call___jpsrv__RegisterJob soap_call___ns1__RegisterJob
#define soap_call___jpsrv__StartUpload soap_call___ns1__StartUpload
#define soap_call___jpsrv__GetJob soap_call___ns1__GetJob
#endif
+#define dprintf(x) printf x
+#include "glite/jp/ws_fault.c"
+#define check_fault(SOAP, ERR) glite_jp_clientCheckFault((SOAP), (ERR), NULL, 0)
static void usage(const char *me)
{
exit (EX_USAGE);
}
-static int check_fault(struct soap *soap,int err) {
- struct SOAP_ENV__Detail *detail;
- struct jptype__genericFault *f;
- char *reason,indent[200] = " ";
-
- switch(err) {
- case SOAP_OK: puts("OK");
- break;
- case SOAP_FAULT:
- case SOAP_SVR_FAULT:
- if (soap->version == 2) {
- detail = soap->fault->SOAP_ENV__Detail;
- reason = soap->fault->SOAP_ENV__Reason;
- }
- else {
- detail = soap->fault->detail;
- reason = soap->fault->faultstring;
- }
- fputs(reason,stderr);
- putc('\n',stderr);
- assert(detail->__type == SOAP_TYPE__genericFault);
-#if GSOAP_VERSION >=20700
- f = ((struct _genericFault *) detail->fault)
-#else
- f = ((struct _genericFault *) detail->value)
-#endif
- -> jpelem__genericFault;
-
- while (f) {
- fprintf(stderr,"%s%s: %s (%s)\n",indent,
- f->source,f->text,f->description);
- f = f->reason;
- strcat(indent," ");
- }
- return -1;
-
- default: soap_print_fault(soap,stderr);
- return -1;
- }
- return 0;
-}
-
/* FIXME: new wsdl */
#if 0
static struct jptype__Attribute sample_attr[] = {
in.tag = &tagval;
tagval.name = argv[3];
tagval.value = &val;
- val.string = argv[4];
- val.blob = NULL;
+ GSOAP_STRING(&val) = argv[4];
+ GSOAP_BLOB(&val)= NULL;
if (!(ret = check_fault(soap,
soap_call___jpsrv__RecordTag(soap, server, "",&in, &empty)))) {
"http://egee.cesnet.cz/en/Schema/JP/System:owner"
};
- struct jptype__stringOrBlob vals[] = {
- { "/O=CESNET/O=Masaryk University/CN=Ales Krenek", NULL },
- { "Done", NULL }
- };
+ struct jptype__stringOrBlob vals[2];
+ memset(vals, 0, sizeof vals);
+ GSOAP_STRING(vals) = "/O=CESNET/O=Masaryk University/CN=Ales Krenek";
+ GSOAP_STRING(vals + 1) = "Done";
struct jptype__primaryQuery q[] = {
{
puts("Attribute values:");
for (i=0; i<out.__sizeattrValues; i++)
printf("\t%s\t%s\t%s",
- out.attrValues[i]->value->string ?
- out.attrValues[i]->value->string :
+ GSOAP_STRING(out.attrValues[i]->value) ?
+ GSOAP_STRING(out.attrValues[i]->value) :
"binary",
orig2str(out.attrValues[i]->origin),
ctime(&out.attrValues[i]->timestamp));
#define SOAP_FMAC1 static
#include "glite/jp/types.h"
+#include "soap_version.h"
#include "glite/security/glite_gsplugin.h"
+#include "glite/security/glite_gscompat.h"
#include "feed.h"
#include "is_client.h"
#include "jpis_.nsmap"
+#include "glite/jp/ws_fault.c"
#include "soap_util.c"
#include "soap_env_ctx.h"
struct _jpelem__UpdateJobsResponse out;
struct jptype__jobRecord jr, *jrp = &jr;
int i;
- enum xsd__boolean false = false_;
+ enum xsd__boolean false = GLITE_SECURITY_GSOAP_FALSE;
glite_jp_error_t err;
glite_jp_clear_error(ctx);
struct _jpelem__UpdateJobs in;
struct _jpelem__UpdateJobsResponse out;
struct jptype__jobRecord *jr;
- enum xsd__boolean false = false_;
+ enum xsd__boolean false = GLITE_SECURITY_GSOAP_FALSE;
glite_jp_error_t err;
printf("multi_feed: %s\n",destination);
#include "attrs.h"
#include "jptype_map.h"
+#include "glite/security/glite_gscompat.h"
#include "file_plugin.h"
#include "builtin_plugins.h"
#include "jpps_.nsmap"
-#include "soap_util.c"
-
#include "soap_env_ctx.h"
#include "soap_env_ctx.c"
-static struct jptype__genericFault *jp2s_error(struct soap *soap,
- const glite_jp_error_t *err)
-{
- struct jptype__genericFault *ret = NULL;
- if (err) {
- ret = soap_malloc(soap,sizeof *ret);
- memset(ret,0,sizeof *ret);
- ret->code = err->code;
- ret->source = soap_strdup(soap,err->source);
- ret->text = soap_strdup(soap,strerror(err->code));
- ret->description = soap_strdup(soap,err->desc);
- ret->reason = jp2s_error(soap,err->reason);
- }
- return ret;
-}
-
-static void err2fault(const glite_jp_context_t ctx,struct soap *soap)
-{
- char *et;
- struct SOAP_ENV__Detail *detail = soap_malloc(soap,sizeof *detail);
- struct _genericFault *f = soap_malloc(soap,sizeof *f);
-
-
- f->jpelem__genericFault = jp2s_error(soap,ctx->error);
-
- detail->__type = SOAP_TYPE__genericFault;
-#if GSOAP_VERSION >= 20700
- detail->fault = f;
-#else
- detail->value = f;
-#endif
- detail->__any = NULL;
+#include "glite/jp/ws_fault.c"
+#include "soap_util.c"
- soap_receiver_fault(soap,"Oh, shit!",NULL);
- if (soap->version == 2) soap->fault->SOAP_ENV__Detail = detail;
- else soap->fault->detail = detail;
-}
+#define err2fault(CTX, SOAP) glite_jp_server_err2fault((CTX), (SOAP));
#define CONTEXT_FROM_SOAP(soap,ctx) glite_jp_context_t ctx = (glite_jp_context_t) ((soap)->user)
}
attr[0].name = in->tag->name;
- if (in->tag->value->string) {
- attr[0].value = in->tag->value->string;
+ if (GSOAP_STRING(in->tag->value)) {
+ attr[0].value = GSOAP_STRING(in->tag->value);
attr[0].binary = 0;
}
else {
- attr[0].value = in->tag->value->blob->__ptr;
- attr[0].size = in->tag->value->blob->__size;
+ attr[0].value = GSOAP_BLOB(in->tag->value)->__ptr;
+ attr[0].size = GSOAP_BLOB(in->tag->value)->__size;
attr[0].binary = 1;
}
attr[0].origin = GLITE_JP_ATTR_ORIG_USER;
static void s2jp_qval(const struct jptype__stringOrBlob *in, char **value, int *binary, size_t *size)
{
- if (in->string) {
- *value = in->string;
+ if (GSOAP_STRING(in)) {
+ *value = GSOAP_STRING(in);
*binary = 0;
*size = 0;
}
else {
- assert(in->blob); /* XXX: should report error instead */
- *value = in->blob->__ptr;
+ assert(GSOAP_BLOB(in)); /* XXX: should report error instead */
+ *value = GSOAP_BLOB(in)->__ptr;
*binary = 1;
- *size = in->blob->__size;
+ *size = GSOAP_BLOB(in)->__size;
}
}
if (freeit) free(in[i].name);
a->value = soap_malloc(soap,sizeof *a->value);
if (in[i].binary) {
- a->value->blob = soap_malloc(soap,sizeof *a->value->blob);
- memset(a->value->blob,0,sizeof *a->value->blob);
- a->value->blob->__ptr = soap_malloc(soap,in[i].size);
- a->value->blob->__size = in[i].size;
- memcpy(a->value->blob->__ptr,in[i].value,in[i].size);
+ GSOAP_BLOB(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);
- a->value->string = NULL;
+ GSOAP_STRING(a->value) = NULL;
}
else {
- a->value->string = soap_strdup(soap,in[i].value);
- a->value->blob = NULL;
+ GSOAP_STRING(a->value) = soap_strdup(soap,in[i].value);
+ GSOAP_BLOB(a->value) = NULL;
}
if (freeit) free(in[i].value);
a->origin = jp2s_origin(in[i].origin);
for (i=0; i<na; i++) {
soap_dealloc(soap,a[i]->name);
- if (a[i]->value->string) soap_dealloc(soap,a[i]->value->string);
- if (a[i]->value->blob) {
- soap_dealloc(soap,a[i]->value->blob->__ptr);
- soap_dealloc(soap,a[i]->value->blob);
+ if (GSOAP_STRING(a[i]->value)) soap_dealloc(soap,GSOAP_STRING(a[i]->value));
+ if (GSOAP_BLOB(a[i]->value)) {
+ soap_dealloc(soap,GSOAP_BLOB(a[i]->value)->__ptr);
+ soap_dealloc(soap,GSOAP_BLOB(a[i]->value));
}
soap_dealloc(soap,a[i]->value);
if (a[i]->originDetail) soap_dealloc(soap,a[i]->originDetail);