comparison GEMBASSY-1.0.3/gsoap/extras/ckdbtest.c @ 0:8300eb051bea draft

Initial upload
author ktnyt
date Fri, 26 Jun 2015 05:19:29 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:8300eb051bea
1 /*
2 ckdbtest.c
3
4 Test client for HTTP cookie database manager.
5
6 Copyright (C) 2000-2002 Robert A. van Engelen. All Rights Reserved.
7
8 1. Compile ckdb.h:
9 soapcpp2 -cnpckdb ckdb.h
10 2. Compile ckdb.c:
11 gcc -DWITH_COOKIES -c ckdb.c
12 3. Compile and link ckdbtest.c:
13 soapcpp2 -c ckdbtest.h
14 gcc -DWITH_COOKIES ckdbtest.c ckdb.o stdsoap2.c soapC.c soapClient.c
15 4. Execute
16 Cookies will be stored in 'jar.xml'
17
18 */
19
20 #include "soapH.h"
21 #include "ckdbtest.nsmap"
22
23 char ckserver[] = "http://www.cs.fsu.edu/~engelen/ck.cgi";
24
25 int main()
26 { struct soap soap;
27 char *r;
28 soap_init(&soap);
29 if (soap_call_ck__demo(&soap, ckserver, NULL, &r))
30 { soap_print_fault(&soap, stderr);
31 soap_print_fault_location(&soap, stderr);
32 exit(-1);
33 }
34 printf("The server responded with: %s\n", r);
35 if (soap_save_cookies(&soap, "jar.xml"))
36 fprintf(stderr, "Cannot store cookies\n");
37 soap_free_cookies(&soap);
38 if (soap_load_cookies(&soap, "jar.xml"))
39 fprintf(stderr, "Cannot restore cookies\n");
40 else
41 printf("Got cookies (%s=%s)\n", soap.cookies->name, soap.cookies->value);
42 if (soap_call_ck__demo(&soap, ckserver, NULL, &r))
43 { soap_print_fault(&soap, stderr);
44 soap_print_fault_location(&soap, stderr);
45 exit(-1);
46 }
47 printf("The server responded with: %s\n", r);
48 if (soap_save_cookies(&soap, "jar.xml"))
49 fprintf(stderr, "Cannot store cookies\n");
50 soap_end(&soap); /* This will delete the deserialized cookies too! */
51 soap.cookies = NULL; /* so make sure this is NULL */
52 return 0;
53 }