NCBI C++ ToolKit
|
Search Toolkit Book for CSoapServerApplication
#include <serial/soap/soap_server.hpp>
Public Types | |
typedef bool(CSoapServerApplication::* | TWebMethod) (CSoapMessage &response, const CSoapMessage &request) |
typedef vector< TWebMethod > | TListeners |
![]() | |
typedef CNcbiApplication | CParent |
![]() | |
enum | EAppNameType { eBaseName , eFullName , eRealName } |
Public Member Functions | |
CSoapServerApplication (const string &wsdl_filename, const string &namespace_name) | |
virtual int | ProcessRequest (CCgiContext &ctx) |
This is the method you should override. More... | |
void | SetDefaultNamespaceName (const string &namespace_name) |
const string & | GetDefaultNamespaceName (void) const |
void | SetWsdlFilename (const string &wsdl_filename) |
void | RegisterObjectType (TTypeInfoGetter type_getter) |
void | AddMessageListener (TWebMethod listener, const string &message_name, const string &namespace_name=kEmptyStr) |
TDiagPostFlags | GetFaultPostFlags (void) const |
void | SetFaultPostFlags (TDiagPostFlags flags) |
![]() | |
CCgiApplication (const SBuildInfo &build_info=NCBI_SBUILDINFO_DEFAULT()) | |
~CCgiApplication (void) | |
const CCgiContext & | GetContext (void) const |
Get current server context. Throw exception if the context is not set. More... | |
CCgiContext & | GetContext (void) |
Get current server context. Throw exception if the context is not set. More... | |
const CNcbiResource & | GetResource (void) const |
Get server 'resource'. Throw exception if the resource is not set. More... | |
CNcbiResource & | GetResource (void) |
Get server 'resource'. Throw exception if the resource is not set. More... | |
unsigned int | GetFCgiIteration (void) const |
Get the # of currently processed HTTP request. More... | |
virtual bool | IsFastCGI (void) const |
Return TRUE if it is running as a "fast" CGI. More... | |
virtual void | Init (void) |
This method is called on the CGI application initialization – before starting to process a HTTP request or even receiving one. More... | |
virtual void | Exit (void) |
This method is called on the CGI application exit. More... | |
virtual int | Run (void) |
Do not override this method yourself! – it includes all the CGI specific machinery. More... | |
virtual CNcbiResource * | LoadResource (void) |
virtual CCgiServerContext * | LoadServerContext (CCgiContext &context) |
void | SetRequestFlags (int flags) |
Set cgi parsing flag. More... | |
virtual void | SetupArgDescriptions (CArgDescriptions *arg_desc) |
Setup the command line argument descriptions. More... | |
virtual const CArgs & | GetArgs (void) const |
Get parsed command line arguments extended with CGI parameters. More... | |
virtual ICgiSessionStorage * | GetSessionStorage (CCgiSessionParameters ¶ms) const |
Get instance of CGI session storage interface. More... | |
virtual bool | ValidateSynchronizationToken (void) |
Validate synchronization token (cross-site request forgery prevention). More... | |
![]() | |
virtual | ~CNcbiApplication (void) |
Destructor. More... | |
CNcbiApplication (const SBuildInfo &build_info=NCBI_SBUILDINFO_DEFAULT()) | |
Constructor. More... | |
![]() | |
CNcbiApplicationAPI (const SBuildInfo &build_info) | |
Constructor. More... | |
virtual | ~CNcbiApplicationAPI (void) |
Destructor. More... | |
int | AppMain (int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString) |
Main function (entry point) for the NCBI application. More... | |
virtual int | DryRun (void) |
Test run the application. More... | |
const CNcbiArguments & | GetArguments (void) const |
Get the application's cached unprocessed command-line arguments. More... | |
const CNcbiEnvironment & | GetEnvironment (void) const |
Get the application's cached environment. More... | |
CNcbiEnvironment & | SetEnvironment (void) |
Get a non-const copy of the application's cached environment. More... | |
void | SetEnvironment (const string &name, const string &value) |
Set a specified environment variable by name. More... | |
bool | HasLoadedConfig (void) const |
Check if the config file has been loaded. More... | |
bool | FinishedLoadingConfig (void) const |
Check if the application has finished loading config file (successfully or not). More... | |
const CNcbiRegistry & | GetConfig (void) const |
Get the application's cached configuration parameters (read-only). More... | |
CNcbiRegistry & | GetConfig (void) |
const string & | GetConfigPath (void) const |
Get the full path to the configuration file (if any) we ended up using. More... | |
bool | ReloadConfig (CMetaRegistry::TFlags flags=CMetaRegistry::fReloadIfChanged, IRegistry::TFlags reg_flags=IRegistry::fWithNcbirc) |
Reload the configuration file. More... | |
SIZE_TYPE | FlushDiag (CNcbiOstream *os, bool close_diag=false) |
Flush the in-memory diagnostic stream (for "eDS_ToMemory" case only). More... | |
const string & | GetProgramDisplayName (void) const |
Get the application's "display" name. More... | |
const string & | GetProgramExecutablePath (EFollowLinks follow_links=eIgnoreLinks) const |
Get the application's executable path. More... | |
CVersionInfo | GetVersion (void) const |
Get the program version information. More... | |
const CVersionAPI & | GetFullVersion (void) const |
Get the program version information. More... | |
bool | IsDryRun (void) const |
Check if it is a test run. More... | |
virtual bool | SetupDiag_AppSpecific (void) |
Setup application specific diagnostic stream. More... | |
template<class TFunc > | |
void | AddOnExitAction (TFunc func) |
Add callback to be executed from CNcbiApplicationAPI destructor. More... | |
Protected Member Functions | |
void | SetOmitScopePrefixes (bool bOmit) |
bool | GetOmitScopePrefixes () const |
![]() | |
virtual EPreparseArgs | PreparseArgs (int argc, const char *const *argv) |
Check the command line arguments before parsing them. More... | |
void | SetRequestId (const string &rid, bool is_done) |
virtual int | OnException (std::exception &e, CNcbiOstream &os) |
This method is called if an exception is thrown during the processing of HTTP request. More... | |
virtual void | OnEvent (EEvent event, int status) |
This method is called after each request, or when the CGI is forced to skip a request, or to finish altogether without processing a request. More... | |
virtual void | FASTCGI_ScheduleExit (void) |
Schedule Fast-CGI loop to end as soon as possible, after safely finishing the currently processed request, if any. More... | |
virtual CCgiContext * | CreateContext (CNcbiArguments *args=0, CNcbiEnvironment *env=0, CNcbiIstream *inp=0, CNcbiOstream *out=0, int ifd=-1, int ofd=-1) |
Factory method for the Context object construction. More... | |
virtual CCgiContext * | CreateContextWithFlags (CNcbiArguments *args, CNcbiEnvironment *env, CNcbiIstream *inp, CNcbiOstream *out, int ifd, int ofd, int flags) |
The same as CreateContext(), but allows for a custom set of flags to be specified in the CCgiRequest constructor. More... | |
CCgiContext * | CreateContextWithFlags_Default (CCgiRequestProcessor &processor, CNcbiArguments *args, CNcbiEnvironment *env, CNcbiIstream *inp, CNcbiOstream *out, int ifd, int ofd, int flags) |
Default implementation of CreateContextWithFlags. More... | |
void | RegisterDiagFactory (const string &key, CDiagFactory *fact) |
CDiagFactory * | FindDiagFactory (const string &key) |
virtual void | ConfigureDiagnostics (CCgiContext &context) |
virtual void | ConfigureDiagDestination (CCgiContext &context) |
virtual void | ConfigureDiagThreshold (CCgiContext &context) |
virtual void | ConfigureDiagFormat (CCgiContext &context) |
ELogOpt | GetLogOpt (void) const |
virtual CCgiStatistics * | CreateStat () |
Class factory for statistics class. More... | |
void | SetCafService (CCookieAffinity *caf) |
Attach cookie affinity service interface. More... | |
void | VerifyCgiContext (CCgiContext &context) |
Check CGI context for possible problems, throw exception with HTTP status set if something is wrong. More... | |
virtual string | GetDefaultLogPath (void) const |
Get default path for the log files. More... | |
virtual void | AppStart (void) |
Prepare properties and print the application start message. More... | |
virtual void | AppStop (int exit_code) |
Prepare properties for application stop message. More... | |
void | SetHTTPStatus (unsigned int status, const string &reason=kEmptyStr) |
Set HTTP status code in the current request context and in the current CHttpResponse if one exists. More... | |
virtual void | ProcessHelpRequest (const string &format) |
Process help request: set content type, print usage informations etc. More... | |
virtual void | ProcessVersionRequest (EVersionType ver_type) |
Process version request: set content type, print version informations etc. More... | |
virtual bool | ProcessAdminRequest (EAdminCommand cmd) |
Process admin command passed through ncbi_admin_cmd argument. More... | |
void | ParseAcceptHeader (TAcceptEntries &entries) const |
Parse "Accept:" header, put entries to the list, more specific first. More... | |
virtual CCgiRequestProcessor * | CreateRequestProcessor (void) |
Create request processor to process the request. More... | |
void | ProcessHttpReferer (void) |
Set CONN_HTTP_REFERER, print self-URL and referer to log. More... | |
void | LogRequest (void) const |
void | LogRequest (const CCgiContext &ctx) const |
Write the required values to log (user-agent, self-url, referer etc.) More... | |
virtual bool | x_RunFastCGI (int *result, unsigned int def_iter=10) |
string | GetFastCGIStandaloneServer (void) const |
bool | GetFastCGIStatLog (void) const |
unsigned int | GetFastCGIIterations (unsigned int def_iter) const |
bool | GetFastCGIComplete_Request_On_Sigterm (void) const |
CCgiWatchFile * | CreateFastCGIWatchFile (void) const |
unsigned int | GetFastCGIWatchFileTimeout (bool have_watcher) const |
int | GetFastCGIWatchFileRestartDelay (void) const |
bool | GetFastCGIChannelErrors (void) const |
bool | GetFastCGIHonorExitRequest (void) const |
bool | GetFastCGIDebug (void) const |
bool | GetFastCGIStopIfFailed (void) const |
unsigned int | GetFastCGIMTMaxThreads (void) const |
bool | CheckMemoryLimit (void) |
void | InitArgs (CArgs &args, CCgiContext &context) const |
void | AddLBCookie (CCgiCookies &cookies) |
virtual ICache * | GetCacheStorage (void) const |
virtual bool | IsCachingNeeded (const CCgiRequest &request) const |
bool | GetResultFromCache (const CCgiRequest &request, CNcbiOstream &os, ICache &cache) |
void | SaveResultToCache (const CCgiRequest &request, CNcbiIstream &is, ICache &cache) |
void | SaveRequest (const string &rid, const CCgiRequest &request, ICache &cache) |
CCgiRequest * | GetSavedRequest (const string &rid, ICache &cache) |
bool | x_ProcessHelpRequest (CCgiRequestProcessor &processor) |
bool | x_ProcessVersionRequest (CCgiRequestProcessor &processor) |
bool | x_ProcessAdminRequest (CCgiRequestProcessor &processor) |
void | x_OnEvent (CCgiRequestProcessor *pprocessor, EEvent event, int status) |
void | x_OnEvent (EEvent event, int status) |
CCgiRequestProcessor & | x_CreateProcessor (void) |
![]() | |
void | DisableArgDescriptions (TDisableArgDesc disable=fDisableStdArgs) |
void | HideStdArgs (THideStdArgs hide_mask) |
Set the hide mask for the Hide Std Flags. More... | |
void | SetStdioFlags (TStdioSetupFlags stdio_flags) |
Adjust the behavior of standard I/O streams. More... | |
void | SetVersion (const CVersionInfo &version) |
Set the version number for the program. More... | |
void | SetVersion (const CVersionInfo &version, const SBuildInfo &build_info) |
void | SetVersionByBuild (int major) |
void | SetFullVersion (CRef< CVersionAPI > version) |
Set version data for the program. More... | |
const CArgDescriptions * | GetArgDescriptions (void) const |
Get argument descriptions (set by SetupArgDescriptions) More... | |
bool | SetupDiag (EAppDiagStream diag) |
Setup the application diagnostic stream. More... | |
virtual bool | LoadConfig (CNcbiRegistry ®, const string *conf, CNcbiRegistry::TFlags reg_flags) |
Load settings from the configuration file to the registry. More... | |
virtual bool | LoadConfig (CNcbiRegistry ®, const string *conf) |
Load settings from the configuration file to the registry. More... | |
CNcbiRegistry & | GetRWConfig (void) |
Get the application's cached configuration parameters, accessible for read-write for an application's internal use only. More... | |
void | SetProgramDisplayName (const string &app_name) |
Set program's display name. More... | |
void | SetExitCode (int exit_code, EExitMode when=eExceptionalExits) |
Force the program to return a specific exit code later, either when it exits due to an exception or unconditionally. More... | |
void | SetAppFlags (TAppFlags flags) |
void | ExecuteOnExitActions () |
Should only be called from the destructors of classes derived from CNcbiApplicationAPI - if it is necessary to access their data members and virtual methods; or to dynamic_cast<> from the base app class. More... | |
Private Member Functions | |
bool | x_ProcessWsdlRequest (CCgiResponse &response, const CCgiRequest &request) const |
bool | x_ProcessSoapRequest (CCgiResponse &response, const CCgiRequest &request) |
const TListeners * | x_FindListeners (const CSoapMessage &request) |
TListeners * | x_FindListenersByName (const string &message_name, const string &namespace_name) |
void | x_FaultVersionMismatch (CSoapMessage &response) const |
void | x_FaultMustUnderstand (CSoapMessage &response) const |
void | x_FaultServer (CSoapMessage &response, const string &text) const |
void | x_FaultNoListeners (CSoapMessage &response) const |
Private Attributes | |
string | m_DefNamespace |
string | m_Wsdl |
vector< TTypeInfoGetter > | m_Types |
multimap< string, pair< string, TListeners > > | m_Listeners |
bool | m_OmitScopePrefixes |
TDiagPostFlags | m_FaultPostFlags |
Additional Inherited Members | |
![]() | |
static CCgiApplication * | Instance (void) |
Singleton. More... | |
![]() | |
static CNcbiApplication * | Instance (void) |
Singleton method. More... | |
![]() | |
static CNcbiApplicationAPI * | Instance (void) |
Singleton method. More... | |
static CNcbiApplicationGuard | InstanceGuard (void) |
Singleton method. More... | |
static SSystemMutex & | GetInstanceMutex (void) |
Mutex for application singleton object. More... | |
static string | GetAppName (EAppNameType name_type=eBaseName, int argc=0, const char *const *argv=NULL) |
![]() | |
enum | EEvent { eStartRequest , eSuccess , eError , eWaiting , eException , eEndRequest , eExit , eExecutable , eWatchFile , eExitOnFail , eExitRequest } |
enum | ELogOpt { eNoLog , eLog , eLogOnError } |
Analyze registry settings ([CGI] Log) and return current logging option. More... | |
enum | EVersionType { eVersion_Short , eVersion_Full } |
enum | EAdminCommand { eAdmin_Health , eAdmin_HealthDeep , eAdmin_Unknown } |
Admin commands passed through ncbi_admin_cmd argument. More... | |
enum | ERestartReason { eSR_None = 0 , eSR_Executable = 111 , eSR_WatchFile = 112 } |
typedef list< SAcceptEntry > | TAcceptEntries |
![]() | |
enum | EPreparseArgs { ePreparse_Continue , ePreparse_Exit } |
Result of PreparseArgs() More... | |
enum | EDisableArgDesc { fDisableStdArgs = 0x01 } |
Disable argument descriptions. More... | |
enum | EHideStdArgs { fHideLogfile = CArgDescriptions::fHideLogfile , fHideConffile = CArgDescriptions::fHideConffile , fHideVersion = CArgDescriptions::fHideVersion , fHideFullVersion = CArgDescriptions::fHideFullVersion , fHideDryRun = CArgDescriptions::fHideDryRun , fHideHelp = CArgDescriptions::fHideHelp , fHideFullHelp = CArgDescriptions::fHideFullHelp , fHideXmlHelp = CArgDescriptions::fHideXmlHelp , fHideAll = CArgDescriptions::fHideAll } |
Which standard flag's descriptions should not be displayed in the usage message. More... | |
enum | EStdioSetup { fNoSyncWithStdio = 0x01 , fDefault_CinBufferSize = 0x02 , fBinaryCin = 0x04 , fBinaryCout = 0x08 , fDefault_SyncWithStdio = 0x00 } |
Flags to adjust standard I/O streams' behaviour. More... | |
enum | EExitMode { eNoExits , eExceptionalExits , eAllExits } |
When to return a user-set exit code. More... | |
enum | EAppFlags { fSkipSafeStaticDestroy = 1 << 0 } |
typedef int | TDisableArgDesc |
Binary OR of "EDisableArgDesc". More... | |
typedef int | THideStdArgs |
Binary OR of "EHideStdArgs". More... | |
typedef int | TStdioSetupFlags |
Binary OR of "EStdioSetup". More... | |
typedef int | TAppFlags |
![]() | |
static CTime | GetFileModificationTime (const string &filename) |
static ERestartReason | ShouldRestart (CTime &mtime, CCgiWatchFile *watcher, int delay) |
![]() | |
static CRWLock & | GetInstanceLock (void) |
static string | FindProgramExecutablePath (int argc, const char *const *argv, string *real_path=0) |
Find the application's executable file. More... | |
![]() | |
int | m_RequestFlags |
Bit flags for CCgiRequest. More... | |
bool | m_CaughtSigterm |
CRef< CTls< CCgiRequestProcessor > > | m_Processor |
CAtomicCounter | m_Iteration |
Definition at line 47 of file soap_server.hpp.
typedef vector<TWebMethod> CSoapServerApplication::TListeners |
Definition at line 53 of file soap_server.hpp.
typedef bool(CSoapServerApplication::* CSoapServerApplication::TWebMethod) (CSoapMessage &response, const CSoapMessage &request) |
Definition at line 50 of file soap_server.hpp.
CSoapServerApplication::CSoapServerApplication | ( | const string & | wsdl_filename, |
const string & | namespace_name | ||
) |
Definition at line 88 of file soap_server.cpp.
void CSoapServerApplication::AddMessageListener | ( | TWebMethod | listener, |
const string & | message_name, | ||
const string & | namespace_name = kEmptyStr |
||
) |
Definition at line 310 of file soap_server.cpp.
References multimap_checker< Container >::insert(), m_DefNamespace, m_Listeners, and x_FindListenersByName().
Referenced by CSampleSoapServerApplication::Init().
Definition at line 100 of file soap_server.cpp.
References m_DefNamespace.
Referenced by x_ProcessSoapRequest().
|
inline |
Definition at line 68 of file soap_server.hpp.
References m_FaultPostFlags.
|
inlineprotected |
Definition at line 76 of file soap_server.hpp.
References m_OmitScopePrefixes.
|
virtual |
This is the method you should override.
It is called whenever the CGI application gets a syntaxically valid HTTP request.
context | Contains the parameters of the HTTP request |
Implements CCgiApplication.
Definition at line 110 of file soap_server.cpp.
References ctx, CCgiResponse::Flush(), CCgiResponse::SetContentType(), x_ProcessSoapRequest(), and x_ProcessWsdlRequest().
void CSoapServerApplication::RegisterObjectType | ( | TTypeInfoGetter | type_getter | ) |
Definition at line 302 of file soap_server.cpp.
References m_Types.
Referenced by CSampleSoapServerApplication::Init().
Definition at line 96 of file soap_server.cpp.
References m_DefNamespace.
|
inline |
Definition at line 69 of file soap_server.hpp.
References flags, and m_FaultPostFlags.
|
protected |
Definition at line 331 of file soap_server.cpp.
References m_OmitScopePrefixes.
Definition at line 104 of file soap_server.cpp.
References m_Wsdl.
|
private |
Definition at line 346 of file soap_server.cpp.
References CSoapMessage::AddObject(), CSoapMessage::eMsgBody, and CSoapFault::eMustUnderstand.
Referenced by x_ProcessSoapRequest().
|
private |
Definition at line 364 of file soap_server.cpp.
References CSoapMessage::AddObject(), CSoapFault::eClient, and CSoapMessage::eMsgBody.
Referenced by x_ProcessSoapRequest().
|
private |
Definition at line 355 of file soap_server.cpp.
References CSoapMessage::AddObject(), CSoapMessage::eMsgBody, CSoapFault::eServer, and text().
Referenced by x_ProcessSoapRequest().
|
private |
Definition at line 337 of file soap_server.cpp.
References CSoapMessage::AddObject(), CSoapMessage::eMsgBody, and CSoapFault::eVersionMismatch.
Referenced by x_ProcessSoapRequest().
|
private |
Definition at line 257 of file soap_server.cpp.
References CSoapMessage::eMsgBody, eXSD, CSoapMessage::GetContent(), CAnyContentObject::GetName(), CAnyContentObject::GetNamespaceName(), i, m_DefNamespace, and x_FindListenersByName().
Referenced by x_ProcessSoapRequest().
|
private |
Definition at line 289 of file soap_server.cpp.
References multimap_checker< Container >::end(), multimap_checker< Container >::find(), and m_Listeners.
Referenced by AddMessageListener(), and x_FindListeners().
|
private |
Definition at line 151 of file soap_server.cpp.
References CSoapFault::eMustUnderstand, ERR_POST, eSerial_StdWhenDash, eSerial_Xml, CSoapFault::eVersionMismatch, GetDefaultNamespaceName(), CSoapMessage::GetFaultCode(), CCgiRequest::GetInputStream(), m_FaultPostFlags, m_OmitScopePrefixes, m_Types, CObjectIStream::Open(), CObjectOStream::Open(), out(), CCgiResponse::out(), CSoapMessage::RegisterObjectType(), CException::ReportAll(), CSoapMessage::SetDefaultObjectNamespaceName(), CCgiResponse::SetStatus(), CException::what(), CCgiResponse::WriteHeader(), x_FaultMustUnderstand(), x_FaultNoListeners(), x_FaultServer(), x_FaultVersionMismatch(), and x_FindListeners().
Referenced by ProcessRequest().
|
private |
Definition at line 123 of file soap_server.cpp.
References buf, NStr::CompareNocase(), entries, CCgiRequest::GetEntries(), CFile::GetLength(), i, int, len, m_Wsdl, CCgiResponse::out(), and CCgiResponse::WriteHeader().
Referenced by ProcessRequest().
|
private |
Definition at line 96 of file soap_server.hpp.
Referenced by AddMessageListener(), GetDefaultNamespaceName(), SetDefaultNamespaceName(), and x_FindListeners().
|
private |
Definition at line 101 of file soap_server.hpp.
Referenced by GetFaultPostFlags(), SetFaultPostFlags(), and x_ProcessSoapRequest().
|
private |
Definition at line 99 of file soap_server.hpp.
Referenced by AddMessageListener(), and x_FindListenersByName().
|
private |
Definition at line 100 of file soap_server.hpp.
Referenced by GetOmitScopePrefixes(), SetOmitScopePrefixes(), and x_ProcessSoapRequest().
|
private |
Definition at line 98 of file soap_server.hpp.
Referenced by RegisterObjectType(), and x_ProcessSoapRequest().
|
private |
Definition at line 97 of file soap_server.hpp.
Referenced by SetWsdlFilename(), and x_ProcessWsdlRequest().