~ubuntu-branches/ubuntu/raring/gsoap/raring-proposed

« back to all changes in this revision

Viewing changes to gsoap/TandemNonStop/tandemclient.c

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2011-11-01 05:14:38 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20111101051438-3bm51yiv71ng1uc6
Tags: 2.8.4-1
* New upstream release
* Drop gsoap-ipv6.patch implemented upstream
* Link gsoap SSL shared libraries with libssl (Closes: #646228)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
        calcclient.c
 
3
 
 
4
        Example calculator service client in C
 
5
 
 
6
        Compilation in C (see samples/calc/calc.h):
 
7
        > soapcpp2 -c calc.h
 
8
        > cc -o calcclient calcclient.c stdsoap2.c soapC.c soapClient.c
 
9
 
 
10
--------------------------------------------------------------------------------
 
11
gSOAP XML Web services tools
 
12
Copyright (C) 2001-2010, Robert van Engelen, Genivia, Inc. All Rights Reserved.
 
13
This software is released under one of the following two licenses:
 
14
GPL or Genivia's license for commercial use.
 
15
--------------------------------------------------------------------------------
 
16
GPL license.
 
17
 
 
18
This program is free software; you can redistribute it and/or modify it under
 
19
the terms of the GNU General Public License as published by the Free Software
 
20
Foundation; either version 2 of the License, or (at your option) any later
 
21
version.
 
22
 
 
23
This program is distributed in the hope that it will be useful, but WITHOUT ANY
 
24
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 
25
PARTICULAR PURPOSE. See the GNU General Public License for more details.
 
26
 
 
27
You should have received a copy of the GNU General Public License along with
 
28
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
29
Place, Suite 330, Boston, MA 02111-1307 USA
 
30
 
 
31
Author contact information:
 
32
engelen@genivia.com / engelen@acm.org
 
33
--------------------------------------------------------------------------------
 
34
A commercial use license is available from Genivia, Inc., contact@genivia.com
 
35
--------------------------------------------------------------------------------
 
36
*/
 
37
 
 
38
#include "soapH.h"
 
39
#include "calc.nsmap"
 
40
 
 
41
#include "tandem.h"
 
42
 
 
43
const char server[] = "http://websrv.cs.fsu.edu/~engelen/calcserver.cgi";
 
44
 
 
45
int main(int argc, char **argv)
 
46
{ struct soap soap;
 
47
  double a, b, result;
 
48
  if (argc < 4)
 
49
  { fprintf(stderr, "Usage: [add|sub|mul|div|pow] num num\n");
 
50
    exit(0);
 
51
  }
 
52
  soap_init(&soap);
 
53
  tandem_init(&soap, argv[0]);
 
54
  socket_set_inet_name(argv[0]); /* ? See Tandem TCP/IP programming */
 
55
  soap.send_timeout = 10; /* 10 sec */
 
56
  soap.recv_timeout = 10; /* 10 sec */
 
57
  a = strtod(argv[2], NULL);
 
58
  b = strtod(argv[3], NULL);
 
59
  switch (*argv[1])
 
60
  { case 'a':
 
61
      soap_call_ns__add(&soap, server, "", a, b, &result);
 
62
      break;
 
63
    case 's':
 
64
      soap_call_ns__sub(&soap, server, "", a, b, &result);
 
65
      break;
 
66
    case 'm':
 
67
      soap_call_ns__mul(&soap, server, "", a, b, &result);
 
68
      break;
 
69
    case 'd':
 
70
      soap_call_ns__div(&soap, server, "", a, b, &result);
 
71
      break;
 
72
    case 'p':
 
73
      soap_call_ns__pow(&soap, server, "", a, b, &result);
 
74
      break;
 
75
    default:
 
76
      fprintf(stderr, "Unknown command\n");
 
77
      exit(0);
 
78
  }
 
79
  if (soap.error)
 
80
  { soap_print_fault(&soap, stderr);
 
81
    exit(1);
 
82
  }
 
83
  else
 
84
    printf("result = %g\n", result);
 
85
  soap_destroy(&soap);
 
86
  soap_end(&soap);
 
87
  tandem_done(&soap);
 
88
  soap_done(&soap);
 
89
  return 0;
 
90
}