#include "glite/security/glite_gsplugin.h"
#include "conf.h"
+#include "soap_ps_calls.h"
#include "soap_version.h"
#include "jpis_H.h"
fprintf(stderr,"Server idenity: %s\n",mysubj);
else fputs("WARNING: Running unauthenticated\n",stderr);
+ // ask PS server for data
+ // XXX: should come after glite_srvbones_run(), when listening
+ for (i=0; conf->PS_list[i]; i++)
+ MyFeedIndex(conf,conf->PS_list[i]);
+
/* XXX: daemonise */
glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT,1);
glite_srvbones_run(data_init,&stab,1 /* XXX: entries in stab */,debug);
- // XXX: need solve 2 WSDLs problem :(
- /*
- for (i=0; conf->PS_list[i]; i++)
- MyFeedIndex(conf,conf->PS_list[i]);
- */
-
-
glite_jp_free_conf(conf);
return 0;
#include "jpis_H.h"
#include "jpis_.nsmap"
-// XXX: need solve 2 WSDLs problem :(
-//#include "jpps_H.h"
-//#include "jpps_.nsmap"
#include "soap_version.h"
puts(__FUNCTION__);
return SOAP_OK;
}
-
-
-
-
-
-/*----------------------*/
-/* PS WSDL client calls */
-/*----------------------*/
-
-/*
-// XXX: need solve 2 WSDLs problem :(
-
-// call PS FeedIndex for a given destination
-void MyFeedIndex(glite_jp_is_conf *conf, char *dest)
-{
- struct _jpelem__FeedIndex in;
- struct jpsrv__FeedIndexResponse out;
- struct jptype__PrimaryQuery query;
- struct jptype__stringOrBlob value;
-// struct xsd__base64Binary blob;
- int i;
-
-
- memset(&in, 0, sizeof(in));
-
- for (i=0; conf->attrs[i]; i++) ;
- in.__sizeattributes = i;
- in.attributes = conf->attrs;
-
- // XXX: we need C -> WSDL conversion function !
- query.attr = conf->query[0][0].attr;
- query.op = conf->query[0][0].op; // XXX: nasty, needs conversion
- query.origin = jptype__attrOrig__USER;
- value.string = conf->query[0][0].value; // XXX: hope string
-// memset(&blob, 0, sizeof(blob));
-// value.blob = &blob;
- value.blob = NULL;
- query.value = &value;
- query.value2 = NULL;
-
- in.__sizeconditions = 1
- in.conditions = malloc(sizeof(*in.conditions));
- in.conditions[0] = &query; // XXX: supp. only one dimensional queries ! (no ORs)
- // for 2D queries one more _sizeconditions needed IMO
-
- in.history = conf->history;
- in.continuous = conf->continuous;
-
- if (!check_fault(soap,soap_call_jpsrv___FeedIndex(soap,server,"",
- dest, &in, &out)))
- {
- printf("FeedId: %s\nExpires: %s\n",out.feedId,ctime(&out.expires));
- }
-
-}
-*/
--- /dev/null
+#include <stdio.h>
+#include <fcntl.h>
+
+#include "glite/jp/types.h"
+#include "glite/jp/context.h"
+
+#include "jpps_H.h"
+#include "jpps_.nsmap"
+#include "soap_version.h"
+
+#include "conf.h"
+
+#include "stdsoap2.h"
+
+/*------------------*/
+/* Helper functions */
+/*------------------*/
+
+
+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;
+
+ soap_receiver_fault(soap,"Oh, shit!",NULL);
+ if (soap->version == 2) soap->fault->SOAP_ENV__Detail = detail;
+ else soap->fault->detail = detail;
+}
+
+
+
+/*----------------------*/
+/* PS WSDL client calls */
+/*----------------------*/
+
+
+// call PS FeedIndex for a given destination
+void MyFeedIndex(glite_jp_is_conf *conf, char *dest)
+{
+ struct _jpelem__FeedIndex in;
+ struct _jpelem__FeedIndexResponse out;
+ struct jptype__primaryQuery query;
+ struct jptype__stringOrBlob value;
+// struct xsd__base64Binary blob;
+ int i;
+ struct soap *soap = soap_new();
+
+
+printf("MyFeedIndex for %s called\n", dest);
+
+ soap_init(soap);
+ soap_set_namespaces(soap,jpps__namespaces);
+
+ memset(&in, 0, sizeof(in));
+
+ for (i=0; conf->attrs[i]; i++) ;
+ in.__sizeattributes = i;
+ in.attributes = conf->attrs;
+
+ // XXX: we need C -> WSDL conversion function !
+ query.attr = conf->query[0][0].attr;
+ query.op = conf->query[0][0].op; // XXX: nasty, needs conversion
+ query.origin = malloc(sizeof(*query.origin));
+ *query.origin = jptype__attrOrig__USER;
+ value.string = conf->query[0][0].value; // XXX: hope string
+// memset(&blob, 0, sizeof(blob));
+// value.blob = &blob;
+ value.blob = NULL;
+ query.value = &value;
+ query.value2 = NULL;
+
+ in.__sizeconditions = 1;
+ in.conditions = malloc(sizeof(*in.conditions));
+ in.conditions[0] = &query; // XXX: supp. only one dimensional queries ! (no ORs)
+ // for 2D queries one more _sizeconditions needed IMO
+
+ in.history = conf->history;
+ in.continuous = conf->continuous;
+
+ //if (!check_fault(soap,soap_call_jpsrv___FeedIndex(soap,dest,"",
+ if (soap_call___jpsrv__FeedIndex(soap,dest,"", &in, &out))
+ printf("soap_call___jpsrv__FeedIndex() returned error\n");
+ else
+ printf("FeedId: %s\nExpires: %s\n",out.feedId,ctime(&out.feedExpires));
+
+ soap_end(soap);
+}
+