- soap data conversion
authorJiří Škrábal <nykolas@ics.muni.cz>
Thu, 14 Oct 2004 09:28:48 +0000 (09:28 +0000)
committerJiří Škrábal <nykolas@ics.muni.cz>
Thu, 14 Oct 2004 09:28:48 +0000 (09:28 +0000)
org.glite.lb.server/Makefile
org.glite.lb.server/src/bkserverd.c
org.glite.lb.server/src/ws_query.c
org.glite.lb.server/src/ws_typeref.c.T

index d029010..7a670b7 100644 (file)
@@ -21,6 +21,8 @@ gsoap_prefix=/opt/gsoap
 -include Makefile.inc
 -include ../Makefile.inc
 
+CC=gcc
+
 GSOAP_FILES_PREFIX:= bk_ws_
 
 YACC=bison -y
@@ -58,21 +60,10 @@ LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS}
 INSTALL:=libtool --mode=install install
 LINKXX:=libtool --mode=link  ${CXX} -rpath ${stagedir}/lib ${LDFLAGS}
 
-# assisst & gss due to VOMS only
-#      -lglobus_gss_assist_${nothrflavour} \
-#      -lglobus_gssapi_gsi_${nothrflavour} \
-
 GLOBUS_LIBS:= -L${globus_prefix}/lib \
        -lglobus_common_${nothrflavour} \
        -lglobus_gssapi_gsi_${nothrflavour}
 
-
-# XXX: our vomsc.la depends on badly installed expat
-
-# not yet
-#      -L${repository}/${gacl}/lib -lgacl \
-#      ${repository}/${voms}/lib/libvomsc.a \
-
 EXT_LIBS:= -L${ares_prefix}/lib -lares \
        -L${mysql_prefix}/lib -lmysqlclient -lz\
        -L${expat_prefix}/lib -lexpat \
@@ -94,11 +85,14 @@ SERVER_OBJS:= bkserverd.o get_events.o index.o jobstat.o jobstat_supp.o \
 SERVER_SOAP_OBJS:=${GSOAP_FILES_PREFIX}C.o ${GSOAP_FILES_PREFIX}Server.o \
        ws_plugin.o ws_query.o ws_fault.o ws_typeref.o
 
-
 INDEX_OBJS:= index.o index_parse.o jobstat_supp.o lbs_db.o openserver.o \
        jobstat.o query.o lock.o get_events.o write2rgma.o index_lex.o \
        lb_authz.o store.o bkindex.o
 
+WS_CLIENT_OBJS:= test_ws_plugin.o $(GSOAP_FILES_PREFIX)C.o $(GSOAP_FILES_PREFIX)Client.o ws_fault.o ws_typeref.o
+WS_CLIENT_LIBS:= ${GSOAP_LIBS} -L${stagedir}/lib -lglite_lb_client_${nothrflavour}
+
+
 glite_lb_bkserverd: ${SERVER_OBJS} ${SERVER_SOAP_OBJS}
        ${LINK} -o $@ ${SERVER_OBJS} ${SERVER_SOAP_OBJS} ${COMMON_LIB} ${SRVBONES_LIB} ${GSOAP_LIBS} ${EXT_LIBS}
 
@@ -109,7 +103,7 @@ default all: compile
 
 compile: glite_lb_bkserverd glite_lb_bkindex
 
-check: compile test.xml
+check: compile test.soapconv
        -echo check.query not complete yet
 
 test_coverage:
@@ -117,19 +111,12 @@ test_coverage:
        cd coverage && $(MAKE) -f ../Makefile top_srcdir=../../ COVERAGE_FLAGS="-fprofile-arcs -ftest-coverage" check
        cd coverage && for i in `echo ${INDEX_OBJS} ${SERVER_OBJS} | tr ' ' '\012' | sort -u`; do gcov $$i ; done
 
-test.xml: test_xml
-       ./test_xml
-
-test_xml: test_xml.cpp
-       ${CXX} -c ${CFLAGS} ${TEST_INC} $<
-       ${LINKXX} -o $@ test_xml.o lb_xml_parse.o ${COMMON_LIB} ${TEST_LIBS}
-
 lb_xml_parse.c: lb_xml_parse.c.T
        rm -f $@
        ${AT3} $< >$@ || rm -f $@
        chmod -w $@ >/dev/null
 
-${GSOAP_FILES_PREFIX}H.h ${GSOAP_FILES_PREFIX}C.c ${GSOAP_FILES_PREFIX}Server.c: LB.xh
+${GSOAP_FILES_PREFIX}H.h ${GSOAP_FILES_PREFIX}C.c ${GSOAP_FILES_PREFIX}Server.c ${GSOAP_FILES_PREFIX}Client.c: LB.xh
        ${gsoap_prefix}/bin/soapcpp2 -w -c -p ${GSOAP_FILES_PREFIX} LB.xh
 
 LB.xh: LB.wsdl ws_typemap.dat
@@ -137,6 +124,12 @@ LB.xh: LB.wsdl ws_typemap.dat
        ${gsoap_prefix}/bin/wsdl2h -c -t ${top_srcdir}/src/ws_typemap.dat -o $@ LB.wsdl
        rm LB.wsdl
 
+test.xml: test_xml
+       ./test_xml
+
+test_xml: test_xml.cpp
+       ${CXX} -c ${CFLAGS} ${TEST_INC} $<
+       ${LINKXX} -o $@ test_xml.o lb_xml_parse.o ${COMMON_LIB} ${TEST_LIBS}
 
 check.query: test_query_events
        ./test_query_events
@@ -147,9 +140,12 @@ test_query_events: test_query_events.o
        ${LINKXX} -o $@ test_query_events.o ${query_events_objs} \
        ${TEST_LIBS} ${COMMON_LIB} ${EXT_LIBS}
 
-WS_CLIENT_OBJS:= test_ws_plugin.o $(GSOAP_FILES_PREFIX)C.o $(GSOAP_FILES_PREFIX)Client.o ws_fault.o ws_typeref.o
-WS_CLIENT_LIBS:= ${GSOAP_LIBS} -L${stagedir}/lib -lglite_lb_client_${nothrflavour}
+test.soapconv: test_soap_conv
+       ./test_soap_conv
 
+test_soap_conv: test_soap_conv.cpp ${WS_CLIENT_OBJS}
+       ${CXX} -c ${CFLAGS} ${TEST_INC} $<
+       ${LINKXX} -o $@ test_soap_conv.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${COMMON_LIB} ${TEST_LIBS}
 
 ws_jobstat: ws_jobstat.o ${WS_CLIENT_OBJS}
        ${LINK} -o $@ ws_jobstat.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${EXT_LIBS}
@@ -157,7 +153,10 @@ ws_jobstat: ws_jobstat.o ${WS_CLIENT_OBJS}
 ws_query_ex: ws_query_ex.o ${WS_CLIENT_OBJS}
        ${LINK} -o $@ ws_query_ex.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${EXT_LIBS}
 
-test_ws_plugin.o: ${top_srcdir}/src/ws_plugin.c
+ws_query_ext: ws_query_ext.o ${WS_CLIENT_OBJS}
+       ${LINK} -o $@ ws_query_ext.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${EXT_LIBS}
+
+test_ws_plugin.o: ws_plugin.c
        ${CC} ${CFLAGS} -DPLUGIN_TEST -c -o $@ ${top_srcdir}/src/ws_plugin.c
 
 doc:
index 7cffac6..100a205 100644 (file)
@@ -63,8 +63,6 @@ extern edg_wll_ErrorCode edg_wll_Close(edg_wll_Context);
 #define SLAVE_CONNS_MAX                500     /* commit suicide after that many connections */
 #define MASTER_TIMEOUT         30      /* maximal time of one-round of master network communication */
 #define SLAVE_TIMEOUT          30      /* maximal time of one-round of slave network communication */
-#define SLAVE_CHECK_SIGNALS    2       /* how often to check signals while waiting for recv_mesg */
-#define WATCH_TIMEOUT          1800    /* wake up to check updated credentials */
 
 #ifndef EDG_PURGE_STORAGE
 #define EDG_PURGE_STORAGE      "/tmp/purge"
@@ -236,6 +234,7 @@ int main(int argc, char *argv[])
        edg_wll_Context         ctx;
        OM_uint32                       min_stat;
        edg_wll_GssStatus       gss_code;
+       struct timeval          to;
 
 
 
@@ -499,10 +498,18 @@ a.sin_addr.s_addr = INADDR_ANY;
        }
 
 
-       glite_srvbones_run(slaves, bk_clnt_data_init, service_table, sizofa(service_table), debug);
+       glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_CT, slaves);
+       glite_srvbones_set_param(GLITE_SBPARAM_SLAVE_OVERLOAD, SLAVE_OVERLOAD);
+       glite_srvbones_set_param(GLITE_SBPARAM_SLAVE_CONNS_MAX, SLAVE_CONNS_MAX);
+       to = (struct timeval){CLNT_TIMEOUT, 0};
+       glite_srvbones_set_param(GLITE_SBPARAM_CLNT_TIMEOUT, &to);
+       to = (struct timeval){TOTAL_CLNT_TIMEOUT, 0};
+       glite_srvbones_set_param(GLITE_SBPARAM_TOTAL_CLNT_TIMEOUT, &to);
 
+       glite_srvbones_run(bk_clnt_data_init, service_table, sizofa(service_table), debug);
 
-       semctl(semset,0,IPC_RMID,0);
+
+       semctl(semset, 0, IPC_RMID, 0);
        unlink(pidfile);
        free(port);
        gss_release_cred(&min_stat, &mycred);
index 3ab7264..60dd118 100644 (file)
@@ -7,6 +7,10 @@
 #include "query.h"
 #include "ws_plugin.h"
 #include "bk_ws_H.h"
+#include "get_events.h"
+#include "ws_fault.h"
+#include "ws_typeref.h"
+
 
 int edgwll2__JobStatus(
         struct soap                                               *soap,
@@ -19,8 +23,6 @@ int edgwll2__JobStatus(
        edg_wll_JobStat         s;
 
 
-       out->status = soap_malloc(soap, sizeof *out->status);
-
        if ( edg_wlc_JobIdParse(jobid, &j) )
        {
                edg_wll_SetError(ctx, EINVAL, jobid);
@@ -34,7 +36,7 @@ int edgwll2__JobStatus(
                return SOAP_FAULT;
        }
 
-       edg_wll_StatusToSoap(soap, &s, out->status);
+       edg_wll_StatusToSoap(soap, &s, &(out->status));
 
        return SOAP_OK;
 }
@@ -62,12 +64,12 @@ int edgwll2__QueryJobs(
 
        edg_wll_ResetError(ctx);
        edg_wll_SoapToJobStatFlags(flags, &fl);
-       if ( !edg_wll_SoapToQueryCondsExt(conditions, &qr) ) {
+       if ( edg_wll_SoapToQueryCondsExt(conditions, &qr) ) {
                edg_wll_SetError(ctx, ENOMEM, "Couldn't create internal structures");
                goto cleanup;
        }
        if ( edg_wll_QueryJobsServer(ctx, qr, fl, &jobsOut, &statesOut) ) goto cleanup;
-       if ( edg_wll_JobsQueryResToSoap(jobsOut, statesOut, out) ) goto cleanup;
+       if ( edg_wll_JobsQueryResToSoap(soap, jobsOut, statesOut, out) ) goto cleanup;
        ret = SOAP_OK;
 
 cleanup:
index c451dff..fd862f4 100644 (file)
@@ -8,7 +8,7 @@
 #include "glite/lb/consumer.h"
 /* XXX: references only, src and dest share pointers */
 
-static void edg_wll_JobStatCodeToSoap(edg_wll_JobStatCode in, enum edgwll__JobStatCode *out)
+void edg_wll_JobStatCodeToSoap(edg_wll_JobStatCode in, enum edgwll__JobStatCode *out)
 {
        switch ( in )
        {
@@ -25,7 +25,7 @@ static void edg_wll_JobStatCodeToSoap(edg_wll_JobStatCode in, enum edgwll__JobSt
        }
 }
 
-static void edg_wll_SoapToJobStatCode(enum edgwll__JobStatCode in, edg_wll_JobStatCode *out)
+void edg_wll_SoapToJobStatCode(enum edgwll__JobStatCode in, edg_wll_JobStatCode *out)
 {
        switch ( in )
        {
@@ -42,12 +42,14 @@ static void edg_wll_SoapToJobStatCode(enum edgwll__JobStatCode in, edg_wll_JobSt
        }
 }
 
-void edg_wll_StatusToSoap(struct soap *soap,edg_wll_JobStat const *src,struct edgwll__JobStat *dest)
+int edg_wll_StatusToSoap(struct soap *soap,edg_wll_JobStat const *src,struct edgwll__JobStat **dest)
 {
        int     i;
+       struct edgwll__JobStat *js;
 
-       memset(dest,0,sizeof *dest);
-       dest->state = src->state;       /* XXX: enum mapping */
+       if ( !(js = soap_malloc(soap, sizeof(*js))) ) return SOAP_FAULT;
+       memset(js, 0, sizeof(*js));
+       edg_wll_JobStatCodeToSoap(src->state, &(js->state));
 @@@{
        selectType $status '_common_';
        for (getFieldsOrdered $status) {
@@ -56,33 +58,36 @@ void edg_wll_StatusToSoap(struct soap *soap,edg_wll_JobStat const *src,struct ed
                my $usuc = $_;
                $usuc = $1.uc($2).$3 while ($usuc =~ /([^_]*)_([a-z])(.*)/);
                if ($ft eq 'jobid') {
-                       gen "\tdest->$usuc = edg_wlc_JobIdUnparse(src->$_);\n";
+                       gen "\tjs->$usuc = edg_wlc_JobIdUnparse(src->$_);\n";
                }
                elsif ($ft eq 'strlist') {
                        gen "\tfor (i=0; src->$_ && src->$_\[i]; i++);\n";
-                       gen "\tdest->__size$usuc = i;\n";
-                       gen "\tdest->$usuc = src->$_;\n";
+                       gen "\tjs->__size$usuc = i;\n";
+                       gen "\tjs->$usuc = src->$_;\n";
                } elsif ($ft eq 'intlist') {
-                       gen "\tdest->__size$usuc = src->$_ ? src->$_\[0] : 0;\n";
-                       gen "\tdest->$usuc = src->$_ ? src->$_ + 1 : NULL;\n";
+                       gen "\tjs->__size$usuc = src->$_ ? src->$_\[0] : 0;\n";
+                       gen "\tjs->$usuc = src->$_ ? src->$_ + 1 : NULL;\n";
                } elsif ($ft eq 'stslist' || $ft eq 'taglist') {
 # FIXME
-                       gen "\tdest->__size$usuc = 0;\n";
-                       gen "\tdest->$usuc = NULL;\n";
+                       gen "\tjs->__size$usuc = 0;\n";
+                       gen "\tjs->$usuc = NULL;\n";
                } elsif ($ft eq 'timeval') {
-                       gen "\tdest->$usuc = soap_malloc(soap,sizeof *dest->$usuc);\n";
-                       gen "\tdest->$usuc->tvSec = src->$_.tv_sec;\n";
-                       gen "\tdest->$usuc->tvUsec = src->$_.tv_usec;\n";
+                       gen "\tjs->$usuc = soap_malloc(soap,sizeof *js->$usuc);\n";
+                       gen "\tjs->$usuc->tvSec = src->$_.tv_sec;\n";
+                       gen "\tjs->$usuc->tvUsec = src->$_.tv_usec;\n";
                }
-               else { gen "\tdest->$usuc = src->$_;\n"; }
+               else { gen "\tjs->$usuc = src->$_;\n"; }
        }
 @@@}
+
+       *dest = js;
+       return SOAP_OK;
 }
 
 void edg_wll_SoapToStatus(struct soap *soap,struct edgwll__JobStat const *src,edg_wll_JobStat *dest)
 {
        memset(dest,0,sizeof *dest);
-       dest->state = src->state;       /* XXX: enum mapping */
+       edg_wll_SoapToJobStatCode(src->state, &(dest->state));
 
 @@@{
        selectType $status '_common_';
@@ -124,6 +129,7 @@ void edg_wll_SoapToJobStatFlags(const struct edgwll__JobStatFlags *in, int *out)
        int             i;
 
        assert(in); assert(out);
+       *out = 0;
        for ( i = 0; i < in->__sizeflag; i++ ) switch ( in->flag[i] )
        {
        case CLASSADS: *out |= EDG_WLL_STAT_CLASSADS; break;
@@ -152,7 +158,7 @@ int edg_wll_JobStatFlagsToSoap(struct soap *soap, const int in, struct edgwll__J
        return SOAP_OK;
 }
 
-static void edg_wll_SoapToAttr(const enum edgwll__QueryAttr in, edg_wll_QueryAttr *out)
+void edg_wll_SoapToAttr(const enum edgwll__QueryAttr in, edg_wll_QueryAttr *out)
 {
        switch ( in )
        {
@@ -178,7 +184,7 @@ static void edg_wll_SoapToAttr(const enum edgwll__QueryAttr in, edg_wll_QueryAtt
        }
 }
 
-static void edg_wll_AttrToSoap(const edg_wll_QueryAttr in, enum edgwll__QueryAttr *out)
+void edg_wll_AttrToSoap(const edg_wll_QueryAttr in, enum edgwll__QueryAttr *out)
 {
        switch ( in )
        {
@@ -204,7 +210,7 @@ static void edg_wll_AttrToSoap(const edg_wll_QueryAttr in, enum edgwll__QueryAtt
        }
 }
 
-static void edg_wll_SoapToQueryOp(const enum edgwll__QueryOp in, edg_wll_QueryOp *out)
+void edg_wll_SoapToQueryOp(const enum edgwll__QueryOp in, edg_wll_QueryOp *out)
 {
        switch ( in )
        {
@@ -216,7 +222,7 @@ static void edg_wll_SoapToQueryOp(const enum edgwll__QueryOp in, edg_wll_QueryOp
        }
 }
 
-static void edg_wll_QueryOpToSoap(const enum edgwll__QueryOp in, edg_wll_QueryOp *out)
+void edg_wll_QueryOpToSoap(const edg_wll_QueryOp in, enum edgwll__QueryOp *out)
 {
        switch ( in )
        {
@@ -265,7 +271,7 @@ int edg_wll_QueryValToSoap(
        case EDG_WLL_QUERY_ATTR_DESTINATION:
        case EDG_WLL_QUERY_ATTR_HOST:
        case EDG_WLL_QUERY_ATTR_INSTANCE:
-               if ( !(out->c = soap_strdup(soap, in->c)) ) return SOAP_FAULT;
+               if ( in->c && !(out->c = soap_strdup(soap, in->c)) ) return SOAP_FAULT;
                break;
        case EDG_WLL_QUERY_ATTR_JOBID:
        case EDG_WLL_QUERY_ATTR_PARENT: {
@@ -335,40 +341,42 @@ err:
 int edg_wll_QueryRecToSoap(
        struct soap                                *soap,
        const edg_wll_QueryRec     *in,
-       struct edgwll__QueryRec    *out)
+       struct edgwll__QueryRec   **out)
 {
-       struct edgwll__QueryRec         qr;
+       struct edgwll__QueryRec    *qr;
 
 
        assert(in); assert(out);
-       if ( !in ) { memset(out, 0, sizeof(*out)); return SOAP_OK; }
-       memset(&qr, 0, sizeof(qr));
-       edg_wll_QueryOpToSoap(in->op, &(qr.op));
+       if ( !(qr = soap_malloc(soap, sizeof(*qr))) ) return SOAP_FAULT;
+       memset(qr, 0, sizeof(*qr));
+       if ( !in ) goto ret;
+       edg_wll_QueryOpToSoap(in->op, &(qr->op));
        if (   in->attr == EDG_WLL_QUERY_ATTR_TIME
                || in->attr == EDG_WLL_QUERY_ATTR_USERTAG ) {
-               if ( !(qr.attrid = soap_malloc(soap, sizeof(*(qr.attrid)))) ) return SOAP_FAULT;
-               memset(qr.attrid, 0, sizeof(*(qr.attrid)));
+               if ( !(qr->attrid = soap_malloc(soap, sizeof(*(qr->attrid)))) ) return SOAP_FAULT;
+               memset(qr->attrid, 0, sizeof(*(qr->attrid)));
                if ( in->attr == EDG_WLL_QUERY_ATTR_TIME ) {
-                       qr.attrid->state = soap_malloc(soap, sizeof(*(qr.attrid->state)));
-                       if ( !qr.attrid->state ) return SOAP_FAULT;
-                       edg_wll_JobStatCodeToSoap(in->attr_id.state, qr.attrid->state);
+                       qr->attrid->state = soap_malloc(soap, sizeof(*(qr->attrid->state)));
+                       if ( !qr->attrid->state ) return SOAP_FAULT;
+                       edg_wll_JobStatCodeToSoap(in->attr_id.state, qr->attrid->state);
                }
                else {
-                       qr.attrid->tag = soap_strdup(soap, in->attr_id.tag);
-                       if ( !qr.attrid->tag ) return SOAP_FAULT;
+                       qr->attrid->tag = soap_strdup(soap, in->attr_id.tag);
+                       if ( !qr->attrid->tag ) return SOAP_FAULT;
                }
        }
        switch ( in->op ) {
        case EDG_WLL_QUERY_OP_WITHIN:
-               if ( !(qr.value2 = soap_malloc(soap, sizeof(*(qr.value2)))) ) return SOAP_FAULT;
-               if ( edg_wll_QueryValToSoap(soap, in->attr, &(in->value2), qr.value2) ) return SOAP_FAULT;
+               if ( !(qr->value2 = soap_malloc(soap, sizeof(*(qr->value2)))) ) return SOAP_FAULT;
+               if ( edg_wll_QueryValToSoap(soap, in->attr, &(in->value2), qr->value2) ) return SOAP_FAULT;
        default:
-               if ( !(qr.value1 = soap_malloc(soap, sizeof(*(qr.value1)))) ) return SOAP_FAULT;
-               if ( edg_wll_QueryValToSoap(soap, in->attr, &(in->value), qr.value1) ) return SOAP_FAULT;
+               if ( !(qr->value1 = soap_malloc(soap, sizeof(*(qr->value1)))) ) return SOAP_FAULT;
+               if ( edg_wll_QueryValToSoap(soap, in->attr, &(in->value), qr->value1) ) return SOAP_FAULT;
                break;
        }
 
-       memcpy(out, &qr, sizeof(qr));
+ret:
+       *out = qr;
        return SOAP_OK;
 }
 
@@ -378,7 +386,7 @@ int edg_wll_SoapToQueryConds(const struct edgwll__QueryCondition *in, edg_wll_Qu
        edg_wll_QueryRec   *qr;
 
 
-       assert(in); assert(*out);
+       assert(in); assert(out);
        if ( !(qr = calloc(in->__sizerecords+1, sizeof(*qr))) ) goto err;
        for ( i = 0; i < in->__sizerecords; i++ )
                if ( edg_wll_SoapToQueryRec(in->attr, in->records[i], qr+i) ) goto err;
@@ -396,25 +404,27 @@ err:
 int edg_wll_QueryCondsToSoap(
        struct soap                                        *soap,
        const edg_wll_QueryRec             *in,
-       struct edgwll__QueryCondition  *out)
+       struct edgwll__QueryCondition **out)
 {
        int                                                             i;
-       struct edgwll__QueryCondition   qc;
+       struct edgwll__QueryCondition  *qc;
 
 
        assert(out);
-       if ( !in ) { memset(out, 0, sizeof(*out)); return SOAP_OK; }
-       memset(&qc, 0, sizeof(qc));
-       while ( in[qc.__sizerecords].attr ) qc.__sizerecords++;
-       if ( qc.__sizerecords ) { memset(out, 0, sizeof(*out)); return SOAP_OK; }
-       qc.records = soap_malloc(soap, sizeof(*qc.records)*qc.__sizerecords);
-       if ( !qc.records ) return SOAP_FAULT;
-       edg_wll_AttrToSoap(in[0].attr, &(qc.attr));
+       if ( !(qc = soap_malloc(soap, sizeof(*qc))) ) return SOAP_FAULT;
+       memset(qc, 0, sizeof(*qc));
+       if ( !in ) goto ret;
+       while ( in[qc->__sizerecords].attr ) qc->__sizerecords++;
+       if ( !qc->__sizerecords ) goto ret;
+       qc->records = soap_malloc(soap, sizeof(*(qc->records))*qc->__sizerecords);
+       if ( !qc->records ) return SOAP_FAULT;
+       edg_wll_AttrToSoap(in[0].attr, &(qc->attr));
        for ( i = 0; in[i].attr; i++ )
-               if ( edg_wll_QueryRecToSoap(soap, in+i, qc.records[i]) )
+               if ( edg_wll_QueryRecToSoap(soap, in+i, qc->records+i) )
                        return SOAP_FAULT;
 
-       memcpy(out, &qc, sizeof(qc));
+ret:
+       *out = qc;
        return SOAP_OK;
 }
 
@@ -424,10 +434,10 @@ int edg_wll_SoapToQueryCondsExt(const struct edgwll__QueryConditions *in, edg_wl
        edg_wll_QueryRec  **qr;
 
 
-       assert(in); assert(*out);
+       assert(in); assert(out);
        if ( !(qr = calloc(in->__sizecondition+1, sizeof(*qr))) ) return -1;
        for ( i = 0; i < in->__sizecondition; i++ )
-               if ( edg_wll_SoapToQueryConds(*(in->condition), qr+i) ) goto err;
+               if ( edg_wll_SoapToQueryConds(in->condition[i], qr+i) ) goto err;
 
        *out = qr;
        return 0;
@@ -448,31 +458,33 @@ err:
 int edg_wll_QueryCondsExtToSoap(
        struct soap                                                        *soap,
        const edg_wll_QueryRec                            **in,
-       struct edgwll__QueryConditions             *out)
+       struct edgwll__QueryConditions            **out)
 {
        int                                                             i;
-       struct edgwll__QueryConditions  qc;
+       struct edgwll__QueryConditions *qc;
 
 
        assert(out);
-       if ( !in ) { memset(out, 0, sizeof(*out)); return SOAP_OK; }
-       memset(&qc, 0, sizeof(qc));
-       while ( in[qc.__sizecondition] ) qc.__sizecondition++;
-       if ( !qc.__sizecondition ) { memset(out, 0, sizeof(*out)); return SOAP_OK; }
-       qc.condition = soap_malloc(soap, sizeof(*qc.condition)*qc.__sizecondition);
-       if ( !qc.condition ) return SOAP_FAULT;
+       if ( !(qc = soap_malloc(soap, sizeof(*qc))) ) return SOAP_FAULT;
+       memset(qc, 0, sizeof(*qc));
+       if ( !in ) goto ret;
+       while ( in[qc->__sizecondition] ) qc->__sizecondition++;
+       if ( !qc->__sizecondition ) goto ret;
+       qc->condition = soap_malloc(soap, sizeof(*(qc->condition))*qc->__sizecondition);
+       if ( !qc->condition ) return SOAP_FAULT;
        for ( i = 0; in[i]; i++ )
-               if ( edg_wll_QueryCondsToSoap(soap, in[i], qc.condition[i]) )
+               if ( edg_wll_QueryCondsToSoap(soap, in[i], qc->condition+i) )
                        return SOAP_FAULT;
 
-       memcpy(out, &qc, sizeof(qc));
+ret:
+       *out = qc;
        return SOAP_OK;
 }
 
 int edg_wll_JobsQueryResToSoap(
        struct soap                                                *soap,
-       edg_wlc_JobId                                      *jobs,
-       edg_wll_JobStat                                    *states,
+       const edg_wlc_JobId                                *jobs,
+       const edg_wll_JobStat                      *states,
        struct edgwll2__QueryJobsResponse  *out)
 {
        int                                                     i;
@@ -498,8 +510,11 @@ int edg_wll_JobsQueryResToSoap(
                for ( i = 0; states[i].state; i++ ) ;
                out->states->states = soap_malloc(soap, sizeof(*(out->states->states))*i);
                if ( !out->states->states ) return SOAP_FAULT;
+               out->states->__sizestates = i;
+
                for ( i = 0; states[i].state; i++ )
-                       edg_wll_StatusToSoap(soap, states+i, out->states->states[i]);
+                       if ( edg_wll_StatusToSoap(soap, states+i, out->states->states+i) )
+                               return SOAP_FAULT;
        }
 
        return SOAP_OK;