~ifolder-dev/simias/trunk-packaging

« back to all changes in this revision

Viewing changes to tools/gsoap/gsoap-linux-2.7/samples/components/c/.svn/text-base/main.c.svn-base

  • Committer: Jorge O. Castro
  • Date: 2007-12-03 06:56:46 UTC
  • Revision ID: jorge@ubuntu.com-20071203065646-mupcnjcwgm5mnhyt
* Remove a bunch of .svn directories we no longer need.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
// must include envH.h first: it declares the SOAP Header and Fault structures
3
 
// shared among the clients and services
4
 
#include "envH.h"
5
 
 
6
 
// include the quote and rate stubs and calc skeleton
7
 
#include "quoteH.h"
8
 
#include "rateH.h"
9
 
#include "calcH.h"
10
 
 
11
 
// include the XML namespace mapping tables
12
 
#include "quote.nsmap"
13
 
#include "rate.nsmap"
14
 
#include "calc.nsmap"
15
 
 
16
 
int main(int argc, char *argv[])
17
 
{ struct soap *soap = soap_new();
18
 
  if (argc <= 1)
19
 
    return calc_serve(soap);
20
 
  else
21
 
  { float q;
22
 
    if (soap_call_ns__getQuote(soap, NULL, NULL, argv[1], &q))
23
 
      soap_print_fault(soap, stderr);
24
 
    else
25
 
    { if (argc > 2)
26
 
      { float r;
27
 
        if (soap_call_ns__getRate(soap, NULL, NULL, "us", argv[2], &r))
28
 
          soap_print_fault(soap, stderr);
29
 
        else
30
 
          q *= r;
31
 
      }
32
 
      printf("%s: %g\n", argv[1], q);
33
 
    }
34
 
  }
35
 
  soap_end(soap);
36
 
  soap_done(soap);
37
 
  free(soap);
38
 
  return 0;
39
 
}
40
 
 
41
 
int ns__add(struct soap *soap, double a, double b, double *result)
42
 
{ *result = a + b;
43
 
  return SOAP_OK;
44
 
}
45
 
 
46
 
int ns__sub(struct soap *soap, double a, double b, double *result)
47
 
{ *result = a - b;
48
 
  return SOAP_OK;
49
 
}
50
 
 
51
 
int ns__mul(struct soap *soap, double a, double b, double *result)
52
 
{ *result = a * b;
53
 
  return SOAP_OK;
54
 
}
55
 
 
56
 
int ns__div(struct soap *soap, double a, double b, double *result)
57
 
{ *result = a / b;
58
 
  return SOAP_OK;
59
 
}