Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

sbimpl.h

Go to the documentation of this file.
00001 
00005 /* --------------------------------------------------------------
00006 Copyright (C) 2001 LifeLine Networks BV <soap2corba@lifeline.nl>
00007 
00008 This program is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU General Public License
00010 as published by the Free Software Foundation; either
00011 version 2 of the License, or (at your option) any later
00012 version.
00013 
00014 This program is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 GNU General Public License for more details.
00018 
00019 You should have received a copy of the GNU General Public License
00020 along with this program; if not, write to the Free Software
00021 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00022 -------------------------------------------------------------- */
00023 
00024 extern CORBA::ORB_ptr orb;
00025 extern DynamicAny::DynAnyFactory_var dynFact;
00026 extern IRPLUS_H irplusHandle;
00027 extern CORBA::String_var ObjCtxMan_SIOR;
00028 extern JTCMonitor *p_struct_tm_monitor;
00029 
00031 class ParList_Holder {
00032 public:
00034     SCParamList *pParList;
00035 
00037     ParList_Holder () : pParList (NULL) { };
00039     virtual ~ParList_Holder () { delete pParList; };
00040 };
00041 
00043 class CorbaSoap
00044 {
00045 protected:
00047     SOAPBridge::ObjectContextManager_var ObjCtxMan;
00048     void DynAny2Xml (DOM_Document &doc, DOM_Node &node, SCParamValue *pParVal, DynamicAny::DynAny_ptr da,
00049         const char *ctxKey, bool needOuter = false)  throw (DOM_Document &);
00050     void FillInDynAny (HrefIdMap &Map, SCParamValue *pParVal, DynamicAny::DynAny_ptr da, DOM_Element &elm)
00051         throw (DOM_Document &);
00052     bool TypeConversion (DynamicAny::DynAny_ptr da, DOM_Element &elm, CString &Value, 
00053         SCParamValue *pParVal, CORBA::TCKind kind) throw (DOM_Document &);
00054     bool TypeConversion (DynamicAny::DynAny_ptr da, DOM_Document &doc, DOM_Node &node, 
00055         SCParamValue *pParVal, CORBA::TCKind kind) throw (DOM_Document &);
00057     CorbaSoap ();
00059     virtual ~CorbaSoap ()
00060     {
00061     };
00063     virtual void aFault (FaultCode fCode, const char *fSubCode, const char *fString) = 0;
00064     virtual void CheckTag (char *cNam, DOM_Node &node) throw (DOM_Document &) = 0;
00065 };
00066 
00068 class SOAPBridge_SOAPCall_i: public CorbaSoap, public POA_SOAPBridge::SOAPCall, public PortableServer::ServantLocator
00069 {
00070 private:
00072     CosNaming::NamingContext_ptr m_inc;
00074     CORBA::Object_ptr suppliedObject;
00076     bool useSupplied;
00077     void soapFault(DOM_Document &doc, FaultCode fCode, const char *fSubCode, const char *fString);
00078     virtual void aFault (FaultCode fCode, const char *fSubCode, const char *fString)
00079     {
00080         DOM_Document doc;
00081         soapFault (doc, fCode, fSubCode, fString);
00082         throw (doc);
00083     };
00084     void soapFault(DOM_Document &doc, FaultCode fCode, const char *fSubCode, const char *fString, 
00085         DynamicAny::DynAny_ptr da);
00086     virtual void CheckTag (char *cNam, DOM_Node &node) throw (DOM_Document &);
00087     
00088 public:
00089     SOAPBridge::SOAPCall::XMLData * Fault (FaultCode fCode, const char *fSubCode, const char *fString);
00090     SOAPBridge_SOAPCall_i (CosNaming::NamingContext_ptr inc);
00091     virtual ~SOAPBridge_SOAPCall_i ();
00092     SOAPBridge::SOAPCall::XMLData* invokeAction (const char* action, const SOAPBridge::SOAPCall::XMLData& data)
00093         throw (CORBA::SystemException, SOAPBridge::SOAPCall::InvocationFailed);
00094     SOAPBridge::SOAPCall::XMLData* invokeInstance (CORBA::Object_ptr objRef, const char* action, const SOAPBridge::SOAPCall::XMLData& data)
00095         throw (CORBA::SystemException, SOAPBridge::SOAPCall::InvocationFailed);
00096     SOAPBridge::SOAPCall::SOAPActionSeq* listActions ()
00097         throw (CORBA::SystemException);
00098     CORBA::Boolean fetchSample (const char* action, SOAPBridge::SOAPCall::XMLData_out request, SOAPBridge::SOAPCall::XMLData_out respons)
00099         throw (CORBA::SystemException);
00100 };
00101 
00105 class SOAPBridge_TypeConversions_impl : virtual public POA_SOAPBridge::TypeConversions,
00106                              virtual public PortableServer::RefCountServantBase
00107 {
00109     SOAPBridge_TypeConversions_impl(const SOAPBridge_TypeConversions_impl&);
00111     void operator=(const SOAPBridge_TypeConversions_impl&);
00113     PortableServer::POA_var poa_;
00114 
00115 public:
00117     SOAPBridge_TypeConversions_impl(PortableServer::POA_ptr);
00119     ~SOAPBridge_TypeConversions_impl();
00121     virtual PortableServer::POA_ptr _default_POA();
00122 
00123     virtual void Set(const SOAPBridge::TypeConversions::Specification& spec)
00124         throw(SOAPBridge::TypeConversions::BadSpecification,
00125               CORBA::SystemException);
00126     virtual CORBA::Boolean Get(SOAPBridge::TypeConversions::Specification& spec,
00127                                CORBA::Boolean getNext)
00128         throw(CORBA::SystemException);
00129 };
00130 
00131 class AnyInterface : public CorbaSoap, virtual public PortableServer::DynamicImplementation
00132 {
00133 private:
00134     virtual void aFault (FaultCode fCode, const char *fSubCode, const char *fString)
00135     {
00136         printf ("FAULT: %s\n", fString);
00137         throw CORBA::BAD_OPERATION ();
00138     };
00139     virtual void CheckTag (char *cNam, DOM_Node &node) throw (DOM_Document &)
00140     {
00141         // do nothing
00142     };
00143     void ErrorCallback (const char *name, const char *msg);
00144 protected:
00145     JTCMonitor monitor;
00146 public:
00147     CString m_Addr, m_Intf, m_Ctxk;
00148     SOAPBridge::CORBACallback_var m_cb;
00149 
00150     AnyInterface (const char *soapAddr, const char *intfName, const char *ctxKey,
00151                   SOAPBridge::CORBACallback_ptr cb)
00152         : CorbaSoap ()
00153         , m_Addr (soapAddr)
00154         , m_Intf (intfName)
00155         , m_Ctxk (ctxKey)
00156     {
00157         if (!CORBA::is_nil (cb)) {
00158             m_cb = SOAPBridge::CORBACallback::_duplicate (cb);
00159         } else {
00160             m_cb = SOAPBridge::CORBACallback::_nil ();
00161         }
00162     };
00163     virtual ~AnyInterface ()
00164     {
00165     };
00166     virtual CORBA::RepositoryId _primary_interface (
00167         const PortableServer::ObjectId &,
00168         PortableServer::POA_ptr);
00169     virtual CORBA::Boolean _is_a (const char *name)
00170         throw (CORBA::SystemException);
00171     virtual void invoke (CORBA::ServerRequest_ptr request) throw ();
00172 };
00173 
00175 class DOM_Holder {
00176 public:
00178     DOM_H domHdl;
00179 
00181     DOM_Holder (DOM_H hdl) : domHdl (hdl) { };
00183     virtual ~DOM_Holder () { releaseDOM (domHdl); };
00184 };
00185 
00186 namespace SOAPBridge
00187 {
00188 
00189 //
00190 // IDL:SOAPBridge/CORBACall:1.0
00191 //
00192 class CORBACall_impl : virtual public POA_SOAPBridge::CORBACall,
00193                        virtual public PortableServer::RefCountServantBase
00194 {
00195     CORBACall_impl(const CORBACall_impl&);
00196     void operator=(const CORBACall_impl&);
00197 
00198     PortableServer::POA_var poa_;
00199     CString ctxKey;
00200 
00201 public:
00202 
00203     CORBACall_impl(PortableServer::POA_ptr);
00204     ~CORBACall_impl();
00205 
00206     virtual PortableServer::POA_ptr _default_POA();
00207 
00208     //
00209     // IDL:SOAPBridge/CORBACall/contextKey:1.0
00210     //
00211     virtual char* contextKey()
00212         throw(CORBA::SystemException);
00213     virtual void contextKey(const char*)
00214         throw(CORBA::SystemException);
00215 
00216     //
00217     // IDL:SOAPBridge/CORBACall/CreateSession:1.0
00218     //
00219     virtual CORBA::Object_ptr CreateSession(const char* soapAddress,
00220                                             const char* intfName,
00221                                             CORBA::Boolean obtainContextKey,
00222                                             SOAPBridge::CORBACallback_ptr cb)
00223         throw(CORBA::SystemException);
00224 
00225     //
00226     // IDL:SOAPBridge/CORBACall/DestroySession:1.0
00227     //
00228     virtual void DestroySession(CORBA::Object_ptr sessionObject)
00229         throw(CORBA::SystemException);
00230 };
00231 
00232 }
00233 

This documentation is part of the "SOAP to CORBA bridge" project
Copyright © 2000 by Lifeline Networks bv.
All rights are reserved.