5
gSOAP HTTP GET plugin example application.
7
gSOAP XML Web services tools
8
Copyright (C) 2000-2006, Robert van Engelen, Genivia, Inc., All Rights Reserved.
10
--------------------------------------------------------------------------------
13
The contents of this file are subject to the gSOAP Public License Version 1.3
14
(the "License"); you may not use this file except in compliance with the
15
License. You may obtain a copy of the License at
16
http://www.cs.fsu.edu/~engelen/soaplicense.html
17
Software distributed under the License is distributed on an "AS IS" basis,
18
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
19
for the specific language governing rights and limitations under the License.
21
The Initial Developer of the Original Code is Robert A. van Engelen.
22
Copyright (C) 2000-2004, Robert van Engelen, Genivia, Inc., All Rights Reserved.
23
--------------------------------------------------------------------------------
26
This program is free software; you can redistribute it and/or modify it under
27
the terms of the GNU General Public License as published by the Free Software
28
Foundation; either version 2 of the License, or (at your option) any later
31
This program is distributed in the hope that it will be useful, but WITHOUT ANY
32
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
33
PARTICULAR PURPOSE. See the GNU General Public License for more details.
35
You should have received a copy of the GNU General Public License along with
36
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
37
Place, Suite 330, Boston, MA 02111-1307 USA
39
Author contact information:
40
engelen@genivia.com / engelen@acm.org
41
--------------------------------------------------------------------------------
45
soapcpp2 -CS -c httpgettest.h
46
cc -DWITH_NONAMESPACES -Iplugin -o httpgettest httpgettest.c soapC.c soapClient.c httpget.c stdsoap2.c
48
To support https and compression, compile with:
50
cc -DWITH_NONAMESPACES -DWITH_OPENSSL -DWITH_GZIP -Iplugin -o httpgettest httpgettest.c soapC.c httpget.c stdsoap2.c -lssl -lcrypto -lz
57
int main(int argc, char **argv)
60
{ fprintf(stderr, "Usage: httpgettest URL\n");
64
soap_register_plugin(&soap, http_get); // register plugin
65
if (soap_get_connect(&soap, argv[1], NULL)
66
|| soap_begin_recv(&soap))
67
{ soap_print_fault(&soap, stderr);
70
if (soap.http_content)
71
printf("Content type = %s\n", soap.http_content);
72
printf("Content length = %ld\n", soap.length);
73
if ((soap.mode & SOAP_IO) == SOAP_IO_CHUNK
75
|| soap.zlib_in != SOAP_ZLIB_NONE
79
// This loop handles chunked/compressed transfers
81
{ if ((c = soap_getchar(&soap)) == (int)EOF)
87
{ // This loop handles HTTP transfers (with HTTP content length set)
90
for (i = soap.length; i; i--)
92
if ((c = soap_getchar(&soap)) == (int)EOF)
93
{ soap.error = SOAP_EOF;
100
soap_end_recv(&soap);
106
SOAP_NMAC struct Namespace namespaces[] =
108
{"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/", "http://www.w3.org/*/soap-envelope", NULL},
109
{"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", "http://www.w3.org/*/soap-encoding", NULL},
110
{"xsi", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance", NULL},
111
{"xsd", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/*/XMLSchema", NULL},
112
{NULL, NULL, NULL, NULL}