client.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "soapfreppleProxy.h"
00029 #include "frepple.nsmap"
00030
00031
00032 int main(int argc, char *argv[])
00033 {
00034 if (argc <= 2 || (strcmp(argv[1],"get") && strcmp(argv[1],"post")))
00035 {
00036 std::cout << "Usage:" << std::endl;
00037 std::cout << " " << argv[0] << " get <demand name>" << std::endl << std::endl;
00038 std::cout << " " << argv[0] << " post <data>" << std::endl << std::endl;
00039 return 1;
00040 }
00041
00042 frepple svc;
00043
00044
00045 if (!strcmp(argv[1],"get"))
00046 {
00047 struct frepple__DemandInfoResponse result;
00048 if (svc.frepple__demand(argv[2], result) == SOAP_OK)
00049 {
00050 std::cout << "Name: " << result._return.name << std::endl
00051 << "Item: " << result._return.item << std::endl
00052 << "Quantity: " << result._return.quantity << std::endl
00053 << "Due date: " << asctime(gmtime(&result._return.due))
00054 << "Priority: " << result._return.priority << std::endl;
00055 }
00056 else
00057 soap_print_fault(svc.soap, stderr);
00058 }
00059
00060
00061 if (!strcmp(argv[1],"post"))
00062 {
00063 struct frepple__PostResponse result;
00064 if (svc.frepple__post(argv[2], result) == SOAP_OK)
00065 {
00066 std::cout << "answer: " << result._return << std::endl;
00067 }
00068 else
00069 soap_print_fault(svc.soap, stderr);
00070 }
00071
00072 return 0;
00073 }
00074