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