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