CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SoapUtils.cc
Go to the documentation of this file.
1 
4 
7 
8 #include "xdaq/NamespaceURI.h"
9 #include "xoap/MessageFactory.h"
10 #include "xoap/Method.h"
11 #include "xoap/SOAPBody.h"
12 #include "xoap/SOAPEnvelope.h"
13 #include "xoap/SOAPName.h"
14 #include "xoap/SOAPPart.h"
15 #include "xoap/domutils.h"
16 
17 #include "xdaq2rc/version.h"
18 #include "xdaq2rc/SOAPParameterExtractor.hh"
19 
20 namespace stor
21 {
22  namespace soaputils
23  {
24 
25  std::string extractParameters( xoap::MessageReference msg, xdaq::Application* app )
26  {
27  std::string command;
28 
29  // Extract the command name and update any configuration parameter
30  // found in the SOAP message in the application infospace
31  xdaq2rc::SOAPParameterExtractor soapParameterExtractor(app);
32  command = soapParameterExtractor.extractParameters(msg);
33  return command;
34  }
35 
36 
37  xoap::MessageReference createFsmSoapResponseMsg
38  (
39  const std::string commandName,
40  const std::string currentState
41  )
42  {
43  xoap::MessageReference reply;
44 
45  try
46  {
47  // response string
48  reply = xoap::createMessage();
49  xoap::SOAPEnvelope envelope = reply->getSOAPPart().getEnvelope();
50  xoap::SOAPName responseName = envelope.createName(commandName+"Response",
51  "xdaq",XDAQ_NS_URI);
52  xoap::SOAPBodyElement responseElem =
53  envelope.getBody().addBodyElement(responseName);
54 
55  // state string
56  xoap::SOAPName stateName = envelope.createName("state", "xdaq",XDAQ_NS_URI);
57  xoap::SOAPElement stateElem = responseElem.addChildElement(stateName);
58  xoap::SOAPName attributeName = envelope.createName("stateName", "xdaq",XDAQ_NS_URI);
59  stateElem.addAttribute(attributeName,currentState);
60  }
61  catch(xcept::Exception &e)
62  {
63  XCEPT_RETHROW(xoap::exception::Exception,
64  "Failed to create FSM SOAP response message for command '" +
65  commandName + "' and current state '" + currentState + "'.", e);
66  }
67 
68  return reply;
69  }
70 
71  } // namespace soaputils
72 
73 } // namespace stor
74 
75 
xoap::MessageReference createFsmSoapResponseMsg(const std::string commandName, const std::string currentState)
Definition: SoapUtils.cc:38
std::string extractParameters(xoap::MessageReference, xdaq::Application *)
Definition: SoapUtils.cc:25