separating PS and IS wsdl calls to avoid declaration clashes
authorMiloš Mulač <mulac@civ.zcu.cz>
Tue, 30 Aug 2005 11:13:57 +0000 (11:13 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Tue, 30 Aug 2005 11:13:57 +0000 (11:13 +0000)
org.glite.jp.index/Makefile
org.glite.jp.index/src/bones_server.c
org.glite.jp.index/src/soap_ops.c
org.glite.jp.index/src/soap_ps_calls.c [new file with mode: 0644]
org.glite.jp.index/src/soap_ps_calls.h [new file with mode: 0644]

index 9d2afb5..711de56 100644 (file)
@@ -46,7 +46,7 @@ example:=jpis-test
 is_prefix:=jpis_
 ps_prefix:=jpps_
 
-SRCS:= conf.c bones_server.c soap_ops.c \
+SRCS:= conf.c bones_server.c soap_ops.c soap_ps_calls.c \
        ${is_prefix}ServerLib.c \
        ${ps_prefix}ClientLib.c ${ps_prefix}C.c
 
index 60ff01e..6c78082 100644 (file)
@@ -13,6 +13,7 @@
 #include "glite/security/glite_gsplugin.h"
 
 #include "conf.h"
+#include "soap_ps_calls.h"
 
 #include "soap_version.h"
 #include "jpis_H.h"
@@ -117,19 +118,17 @@ int main(int argc, char *argv[])
                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;
index c9ab90a..6fbe550 100644 (file)
@@ -6,9 +6,6 @@
 
 #include "jpis_H.h"
 #include "jpis_.nsmap"
-// XXX: need solve 2 WSDLs problem :(
-//#include "jpps_H.h"
-//#include "jpps_.nsmap"
 #include "soap_version.h"
 
 
@@ -87,59 +84,3 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__QueryJobs(
        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));
-       }
-
-}
-*/
diff --git a/org.glite.jp.index/src/soap_ps_calls.c b/org.glite.jp.index/src/soap_ps_calls.c
new file mode 100644 (file)
index 0000000..8bbdef8
--- /dev/null
@@ -0,0 +1,116 @@
+#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);
+}
+
diff --git a/org.glite.jp.index/src/soap_ps_calls.h b/org.glite.jp.index/src/soap_ps_calls.h
new file mode 100644 (file)
index 0000000..ac87eaf
--- /dev/null
@@ -0,0 +1,10 @@
+#ident "$Header$"
+
+#ifndef _SOAP_PS_CALLS_H
+#define _SOAP_PS_CALLS_H
+
+#include "conf.h"
+
+void MyFeedIndex(glite_jp_is_conf *conf, char *dest);
+
+#endif