From 33456083fa898f92d9342cd73943b19fdc2274b6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Wed, 1 Feb 2006 13:13:41 +0000 Subject: [PATCH] XML validity checks: - added client namespace in code because we don't have it in IS.wsdl - root element needs right name with client namespace Added forgotten schema. Stage more stuff, keep stage & install in sync. --- org.glite.jp.index/Makefile | 18 ++++++++-------- org.glite.jp.index/examples/jpis-client.c | 34 ++++++++++++++++++++++++++++--- org.glite.jp.index/src/typemap.dat | 2 +- 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/org.glite.jp.index/Makefile b/org.glite.jp.index/Makefile index fa55b27..fefc79b 100644 --- a/org.glite.jp.index/Makefile +++ b/org.glite.jp.index/Makefile @@ -99,9 +99,9 @@ JobProvenancePS.xh: %.xh: %.wsdl JobProvenanceTypes.wsdl typemap.dat ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o $@ $< rm -f JobProvenanceTypes.wsdl -#JobProvenanceISClient.xh: typemap.dat JobProvenanceISClient.xsd JobProvenanceIS.wsdl +#JobProvenanceISClient.xh: typemap.dat JobProvenanceISClientQuery.xsd JobProvenanceIS.wsdl # cp ${stagedir}/interface/JobProvenance{Types.xsd,Types.wsdl,IS.wsdl} . -# ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o $@ JobProvenanceIS.wsdl ${top_srcdir}/src/JobProvenanceISClient.xsd +# ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o $@ JobProvenanceIS.wsdl ${top_srcdir}/src/JobProvenanceISClientQuery.xsd # rm -f JobProvenance{Types.xsd,Types.wsdl,IS.wsdl} ${is_prefix}ClientLib.c ${is_prefix}Client.c \ @@ -109,6 +109,8 @@ ${is_prefix}Server.c ${is_prefix}ServerLib.c \ ${is_prefix}C.c ${is_prefix}H.h ${is_prefix}_Stub.h: JobProvenanceIS.xh ${gsoap_bin_prefix}/soapcpp2 -n -w -c -p ${is_prefix} $< +# JobProvenanceISClient.xh should be used, +# for now (gsoap-2.7.0) used direct JobProvenanceIS.xh ${is_client_prefix}ClientLib.c ${is_client_prefix}Client.c \ ${is_client_prefix}Server.c ${is_client_prefix}ServerLib.c \ ${is_client_prefix}C.c ${is_client_prefix}H.h ${is_client_prefix}_Stub.h: JobProvenanceIS.xh @@ -132,8 +134,7 @@ check: doc: stage: compile - ${INSTALL} -m 755 ${daemon} ${stagedir}/bin - ${INSTALL} -m 755 ${examples} ${stagedir}/bin + $(MAKE) install PREFIX=${stagedir} dist: distsrc distbin @@ -150,12 +151,13 @@ distbin: install: -mkdir -p ${PREFIX}/bin ${PREFIX}/etc ${PREFIX}/etc/init.d - -mkdir -p ${PREFIX}/share/doc/${package}-${version} - ${INSTALL} -m 755 glite-jp-indexd ${PREFIX}/bin; \ - ${INSTALL} -m 755 glite-jpis-test ${PREFIX}/bin; \ - + -mkdir -p ${PREFIX}/share/doc/${package}-${version} ${PREFIX}/examples + -mkdir -p ${PREFIX}/interface + ${INSTALL} -m 755 ${daemon} ${PREFIX}/bin ${INSTALL} -m 755 ${top_srcdir}/config/startup ${PREFIX}/etc/init.d/glite-jp-indexd + ${INSTALL} -m 755 ${examples} ${PREFIX}/examples ${INSTALL} -m 644 ${top_srcdir}/doc/README ${PREFIX}/share/doc/${package}-${version} + ${INSTALL} -m 644 ${top_srcdir}/interface/JobProvenanceISClientQuery.xsd ${PREFIX}/interface clean: diff --git a/org.glite.jp.index/examples/jpis-client.c b/org.glite.jp.index/examples/jpis-client.c index 1e1930e..900727f 100644 --- a/org.glite.jp.index/examples/jpis-client.c +++ b/org.glite.jp.index/examples/jpis-client.c @@ -211,7 +211,7 @@ static int query_recv(struct soap *soap, int fd, struct _jpisclient__QueryJobs * soap->recvfd = fd; soap_begin_recv(soap); soap_default__jpisclient__QueryJobs(soap, qj); - if (!soap_get__jpisclient__QueryJobs(soap, qj, "queryJobs", "indexQuery")) { + if (!soap_get__jpisclient__QueryJobs(soap, qj, "QueryJobs", NULL)) { soap_end_recv(soap); soap_end(soap); return EINVAL; @@ -232,7 +232,7 @@ static int query_dump(struct soap *soap, int fd, struct _jpisclient__QueryJobs * soap->sendfd = fd; soap_begin_send(soap); soap_serialize__jpisclient__QueryJobs(soap, qj); - retval = soap_put__jpisclient__QueryJobs(soap, qj, "queryJobs", "indexQuery"); + retval = soap_put__jpisclient__QueryJobs(soap, qj, "jpisclient:QueryJobs", NULL); soap_end_send(soap); return retval; @@ -351,6 +351,8 @@ int main(int argc, char * const argv[]) { char *server, *example_file, *query_file, *test_file; const char *prog_name; int retval, opt, example_fd, query_fd, test_fd; + struct Namespace *namespaces; + int i; prog_name = server = NULL; example_file = query_file = test_file = NULL; @@ -362,7 +364,32 @@ int main(int argc, char * const argv[]) { * For communications with JP IS glite_gsplugin needs to be registered yet. */ soap_init(&soap); - soap_set_namespaces(&soap, jpis_client__namespaces); + + /* + * Following code is needed, when we can't combine more XSD/WSDL files + * for using both as client. We direct use structures only from + * JobProvenanceIS.wsdl, just retyped to jpisclient namespace. + * + * So manually add jpisclient to the namespaces. + */ + for (i = 0; jpis_client__namespaces[i].id; i++) + if (strcmp(jpis_client__namespaces[i].id, "jpisclient") == 0) break; + if (jpis_client__namespaces[i].id) { + /* + * namespaces hack isn't needed (used two schemas and + * gsoap 2.7.6b) + */ + namespaces = NULL; + soap_set_namespaces(&soap, jpis_client__namespaces); + } else { + /* perform namespaces hack */ + namespaces = calloc(i + 2, sizeof(struct Namespace)); + memcpy(namespaces, jpis_client__namespaces, sizeof(jpis_client__namespaces)); + namespaces[i].id = "jpisclient"; + namespaces[i].ns = "http://glite.org/xsd/types/jpisclient"; + soap_set_namespaces(&soap, namespaces); + } + #ifdef SOAP_XML_INDENT soap_omode(&soap, SOAP_XML_INDENT); #endif @@ -486,6 +513,7 @@ cleanup: free(example_file); free(query_file); free(test_file); + free(namespaces); return retval; } diff --git a/org.glite.jp.index/src/typemap.dat b/org.glite.jp.index/src/typemap.dat index 18321cc..e86b875 100644 --- a/org.glite.jp.index/src/typemap.dat +++ b/org.glite.jp.index/src/typemap.dat @@ -1,4 +1,4 @@ jpsrv = http://glite.org/wsdl/services/jp jptype = http://glite.org/wsdl/types/jp jpelem = http://glite.org/wsdl/elements/jp -#jpisclient = http://glite.org/xsd/types/jpisclient +jpisclient = http://glite.org/xsd/types/jpisclient -- 1.8.2.3