NCBI C++ ToolKit
soap_server.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: soap_server.hpp 89002 2020-02-11 15:01:11Z ucko $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: Andrei Gourianov
27  *
28  * File Description:
29  * SOAP server application class
30  *
31  */
32 
33 #ifndef SOAP_SERVER_HPP
34 #define SOAP_SERVER_HPP
35 
36 #include <cgi/cgiapp.hpp>
37 #include <cgi/cgictx.hpp>
38 #include <serial/typeinfo.hpp>
40 
42 
43 /////////////////////////////////////////////////////////////////////////////
44 // CSoapServerApplication
45 //
46 
48 {
49 public:
51  CSoapMessage& response, const CSoapMessage& request);
52 
53  typedef vector<TWebMethod> TListeners;
54 
55  CSoapServerApplication(const string& wsdl_filename,
56  const string& namespace_name);
57  virtual int ProcessRequest(CCgiContext& ctx);
58 
59  void SetDefaultNamespaceName(const string& namespace_name);
60  const string& GetDefaultNamespaceName(void) const;
61  void SetWsdlFilename(const string& wsdl_filename);
62 
63  void RegisterObjectType(TTypeInfoGetter type_getter);
64  void AddMessageListener(TWebMethod listener,
65  const string& message_name,
66  const string& namespace_name = kEmptyStr);
67 
70 
71 protected:
72  // These methods exist to provide compatibility with data object classes
73  // generated from ASN.1 specification.
74  // If you generate data object classes from Schema, you do not need them.
75  void SetOmitScopePrefixes(bool bOmit);
76  bool GetOmitScopePrefixes() const
77  {
78  return m_OmitScopePrefixes;
79  }
80 
81 private:
82  bool x_ProcessWsdlRequest(CCgiResponse& response,
83  const CCgiRequest& request) const;
84  bool x_ProcessSoapRequest(CCgiResponse& response,
85  const CCgiRequest& request);
86 
87  const TListeners* x_FindListeners(const CSoapMessage& request);
88  TListeners* x_FindListenersByName(const string& message_name,
89  const string& namespace_name);
90 
91  void x_FaultVersionMismatch(CSoapMessage& response) const;
92  void x_FaultMustUnderstand(CSoapMessage& response) const;
93  void x_FaultServer(CSoapMessage& response, const string& text) const;
94  void x_FaultNoListeners(CSoapMessage& response) const;
95 
97  string m_Wsdl;
98  vector< TTypeInfoGetter > m_Types;
102 };
103 
105 
106 #endif // SOAP_SERVER_HPP
CCgiRequest::
Definition: ncbicgi.hpp:685
TDiagPostFlags m_FaultPostFlags
const TListeners * x_FindListeners(const CSoapMessage &request)
void SetWsdlFilename(const string &wsdl_filename)
bool GetOmitScopePrefixes() const
Definition: soap_server.hpp:76
void x_FaultServer(CSoapMessage &response, const string &text) const
void x_FaultVersionMismatch(CSoapMessage &response) const
TDiagPostFlags GetFaultPostFlags(void) const
Definition: soap_server.hpp:68
void SetOmitScopePrefixes(bool bOmit)
void AddMessageListener(TWebMethod listener, const string &message_name, const string &namespace_name=kEmptyStr)
vector< TTypeInfoGetter > m_Types
Definition: soap_server.hpp:98
const string & GetDefaultNamespaceName(void) const
void SetDefaultNamespaceName(const string &namespace_name)
Definition: soap_server.cpp:96
void x_FaultMustUnderstand(CSoapMessage &response) const
void x_FaultNoListeners(CSoapMessage &response) const
vector< TWebMethod > TListeners
Definition: soap_server.hpp:53
multimap< string, pair< string, TListeners > > m_Listeners
Definition: soap_server.hpp:99
bool x_ProcessWsdlRequest(CCgiResponse &response, const CCgiRequest &request) const
void SetFaultPostFlags(TDiagPostFlags flags)
Definition: soap_server.hpp:69
CSoapServerApplication(const string &wsdl_filename, const string &namespace_name)
Definition: soap_server.cpp:88
bool(CSoapServerApplication::* TWebMethod)(CSoapMessage &response, const CSoapMessage &request)
Definition: soap_server.hpp:50
void RegisterObjectType(TTypeInfoGetter type_getter)
bool x_ProcessSoapRequest(CCgiResponse &response, const CCgiRequest &request)
TListeners * x_FindListenersByName(const string &message_name, const string &namespace_name)
virtual int ProcessRequest(CCgiContext &ctx)
This is the method you should override.
static uch flags
CS_CONTEXT * ctx
Definition: t0006.c:12
#define bool
Definition: bool.h:34
int TDiagPostFlags
Binary OR of "EDiagPostFlag".
Definition: ncbidiag.hpp:785
TTypeInfo(* TTypeInfoGetter)(void)
Definition: serialdef.hpp:63
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define kEmptyStr
Definition: ncbistr.hpp:123
static void text(MDB_val *v)
Definition: mdb_dump.c:62
Modified on Fri Sep 20 14:57:10 2024 by modify_doxy.py rev. 669887