CQL to CCL: add ()s for boolean sub terms
[yaz-moved-to-github.git] / test / test_soap2.c
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) 1995-2011 Index Data
3  * See the file LICENSE for details.
4  */
5 #if HAVE_CONFIG_H
6 #include <config.h>
7 #endif
8
9 #include <stdlib.h>
10 #include <yaz/test.h>
11 #include <yaz/srw.h>
12 #include <yaz/soap.h>
13
14 #if YAZ_HAVE_XML2
15 #include <libxml/parser.h>
16
17 static void tst_srw(void)
18 {
19     const char *charset = 0;
20     char *content_buf = 0;
21     int content_len;
22     int ret;
23     ODR o = odr_createmem(ODR_ENCODE);
24     Z_SOAP_Handler h[2] = {
25         {"http://www.loc.gov/zing/srw/", 0, (Z_SOAP_fun) yaz_srw_codec},
26         {0, 0, 0}
27     };
28     Z_SRW_PDU *sr = yaz_srw_get(o, Z_SRW_searchRetrieve_request);
29     Z_SOAP *p = (Z_SOAP *) odr_malloc(o, sizeof(*p));
30
31     YAZ_CHECK(o);
32     YAZ_CHECK(sr);
33     YAZ_CHECK(p);
34 #if 0
35     sr->u.request->query.cql = "jordb" "\xe6" "r"; 
36 #else
37     sr->u.request->query.cql = "jordbaer"; 
38 #endif
39
40     p->which = Z_SOAP_generic;
41     p->u.generic = (Z_SOAP_Generic *) odr_malloc(o, sizeof(*p->u.generic));
42     p->u.generic->no = 0;
43     p->u.generic->ns = 0;
44     p->u.generic->p = sr;
45     p->ns = "http://schemas.xmlsoap.org/soap/envelope/";
46
47     ret = z_soap_codec_enc(o, &p, &content_buf, &content_len, h, charset);
48     odr_destroy(o);
49     YAZ_CHECK(ret == 0);  /* codec failed ? */
50 }
51 #endif
52
53 int main(int argc, char **argv)
54 {
55     YAZ_CHECK_INIT(argc, argv);
56 #if YAZ_HAVE_XML2
57     LIBXML_TEST_VERSION;
58     tst_srw();
59 #endif
60     YAZ_CHECK_TERM;
61 }
62 /*
63  * Local variables:
64  * c-basic-offset: 4
65  * c-file-style: "Stroustrup"
66  * indent-tabs-mode: nil
67  * End:
68  * vim: shiftwidth=4 tabstop=8 expandtab
69  */
70