CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/EventFilter/StorageManager/src/SoapUtils.cc

Go to the documentation of this file.
00001 
00004 
00006 #include "EventFilter/StorageManager/interface/SoapUtils.h"
00007 
00008 #include "xdaq/NamespaceURI.h"
00009 #include "xoap/MessageFactory.h"
00010 #include "xoap/Method.h"
00011 #include "xoap/SOAPBody.h"
00012 #include "xoap/SOAPEnvelope.h"
00013 #include "xoap/SOAPName.h"
00014 #include "xoap/SOAPPart.h"
00015 #include "xoap/domutils.h"
00016 
00017 #include "xdaq2rc/version.h"
00018 #include "xdaq2rc/SOAPParameterExtractor.hh"
00019 
00020 namespace stor
00021 {
00022   namespace soaputils
00023   {
00024 
00025     std::string extractParameters( xoap::MessageReference msg, xdaq::Application* app )
00026     {
00027       std::string command;
00028 
00029       // Extract the command name and update any configuration parameter
00030       // found in the SOAP message in the application infospace
00031       xdaq2rc::SOAPParameterExtractor soapParameterExtractor(app);
00032       command = soapParameterExtractor.extractParameters(msg);
00033       return command;
00034     }
00035 
00036 
00037     xoap::MessageReference createFsmSoapResponseMsg
00038     (
00039       const std::string commandName,
00040       const std::string currentState
00041     )
00042     {
00043       xoap::MessageReference reply;
00044       
00045       try
00046       {
00047         // response string
00048         reply = xoap::createMessage();
00049         xoap::SOAPEnvelope envelope  = reply->getSOAPPart().getEnvelope();
00050         xoap::SOAPName responseName  = envelope.createName(commandName+"Response",
00051           "xdaq",XDAQ_NS_URI);
00052         xoap::SOAPBodyElement responseElem =
00053           envelope.getBody().addBodyElement(responseName);
00054         
00055         // state string
00056         xoap::SOAPName stateName = envelope.createName("state", "xdaq",XDAQ_NS_URI);
00057         xoap::SOAPElement stateElem = responseElem.addChildElement(stateName);
00058         xoap::SOAPName attributeName = envelope.createName("stateName", "xdaq",XDAQ_NS_URI);
00059         stateElem.addAttribute(attributeName,currentState);
00060       }
00061       catch(xcept::Exception &e)
00062       {
00063         XCEPT_RETHROW(xoap::exception::Exception,
00064           "Failed to create FSM SOAP response message for command '" +
00065           commandName + "' and current state '" + currentState + "'.",  e);
00066       }
00067       
00068       return reply;
00069     }
00070     
00071   } // namespace soaputils
00072 
00073 } // namespace stor
00074 
00075