summaryrefslogtreecommitdiff
path: root/bindings/gsoap/testclient.cpp
blob: 7b0c8a7506ac588029255d97fe54818690a923ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/******************************************************************************
 *
 *  testclient.cpp -	
 *
 * $Id: testclient.cpp 2833 2013-06-29 06:40:28Z chrislit $
 *
 * Copyright 2002-2013 CrossWire Bible Society (http://www.crosswire.org)
 *	CrossWire Bible Society
 *	P. O. Box 2528
 *	Tempe, AZ  85280-2528
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation version 2.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 */

#include "soapH.h"
#include <iostream.h>

char server[] = "http://localhost:18083";

int main(int argc, char **argv) {
	xsd__int mgr;
	xsd__int noop;

	if (soap_call_sword__SWMgr_new(server, NULL, mgr)) {
		soap_print_fault(stderr);
		soap_print_fault_location(stderr);
		exit(-1);
	}

	xsd__int modIt;
	if (soap_call_sword__SWMgr_getModulesIterator(server, NULL, mgr, modIt)) {
		soap_print_fault(stderr);
		soap_print_fault_location(stderr);
		exit(-1);
	}

	xsd__int module;
	do {
		if (soap_call_sword__ModList_iterator_val(server, NULL, modIt, module)) {
			soap_print_fault(stderr);
			soap_print_fault_location(stderr);
			exit(-1);
		}


		if (module) {
			char *name;
			char *desc;
			if (soap_call_sword__SWModule_getName(server, NULL, module, name)) {
				soap_print_fault(stderr);
				soap_print_fault_location(stderr);
				exit(-1);
			}
			if (soap_call_sword__SWModule_getDescription(server, NULL, module, desc)) {
				soap_print_fault(stderr);
				soap_print_fault_location(stderr);
				exit(-1);
			}

			cout << "[" << name << "] " << desc << endl;

			if (soap_call_sword__ModList_iterator_next(server, NULL, modIt, noop)) {
				soap_print_fault(stderr);
				soap_print_fault_location(stderr);
				exit(-1);
			}
		}

		
	} while (module);

	if (soap_call_sword__SWMgr_delete(server, NULL, mgr, noop)) {
		soap_print_fault(stderr);
		soap_print_fault_location(stderr);
		exit(-1);
	}
	char *text;
	if (soap_call_sword__Quick_getModuleRenderText(server, NULL, "KJV", "jas1:19", text)) {
		soap_print_fault(stderr);
		soap_print_fault_location(stderr);
		exit(-1);
	}
	cout << text << endl;

	printf("success: %d\n", mgr);
	soap_free();
	return 0;
}

#include "sword.nsmap"