webservice.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 "module.h"
00029 #include "frepple.nsmap"
00030
00031
00032
00033 SOAP_FMAC5 int SOAP_FMAC6 frepple__demand(struct soap* soap, char *name, struct frepple__DemandInfoResponse &result)
00034 {
00035
00036 if (!name)
00037 return soap_sender_fault(soap, "Missing demand name", "NULL demand name passed");
00038 Demand* i = Demand::find(name);
00039 if (!i)
00040 {
00041 ostringstream msg;
00042 msg << "The demand with name '" << name << "' couldn't be found";
00043 return soap_sender_fault(soap, "Demand not found", msg.str().c_str());
00044 }
00045
00046
00047 result._return.name = const_cast<char*>(i->getName().c_str());
00048 if (i->getItem())
00049 result._return.item = const_cast<char*>(i->getItem()->getName().c_str());
00050 result._return.priority = i->getPriority();
00051 result._return.quantity = i->getQuantity();
00052 result._return.due = i->getDue().getTicks();
00053 return SOAP_OK;
00054 }
00055
00056
00057
00058 SOAP_FMAC5 int SOAP_FMAC6 frepple__post(struct soap* soap, char *data, struct frepple__PostResponse &result)
00059 {
00060 try {
00061 CommandReadXMLString(data, true, false).execute();
00062 }
00063 catch (DataException e)
00064 {return soap_sender_fault(soap, "Data Exception", e.what());}
00065 catch (LogicException e)
00066 {return soap_sender_fault(soap, "Logic Exception", e.what());}
00067 catch (RuntimeException e)
00068 {return soap_sender_fault(soap, "Runtime Exception", e.what());}
00069 catch (...)
00070 {return soap_sender_fault(soap, "Exception", "Unidentified");}
00071 result._return = 11;
00072 return SOAP_OK;
00073 }
00074
00075