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