SenSoapEnvelope2.h

Go to the documentation of this file.
00001 /*
00002 * ==============================================================================
00003 *  Name        : SenSoapEnvelope.h
00004 *  Part of     : Web Services Framework / Utils
00005 *  Interface   :
00006 *  Description : CSenSoapEnvelope is an utility class offering capability to
00007 *                parse XML SOAP envelope and manipulation methods to alter its
00008 *                contents.
00009 *  Version     :
00010 *
00011 *  Copyright © 2002-2005 Nokia. All rights reserved.
00012 *  This material, including documentation and any related
00013 *  computer programs, is protected by copyright controlled by
00014 *  Nokia. All rights are reserved. Copying, including
00015 *  reproducing, storing, adapting or translating, any
00016 *  or all of this material requires the prior written consent of
00017 *  Nokia. This material also contains confidential
00018 *  information which may not be disclosed to others without the
00019 *  prior written consent of Nokia.
00020 * ==============================================================================
00021 */
00022 
00023 #ifndef SEN_SOAP_ENVELOPE2_H
00024 #define SEN_SOAP_ENVELOPE2_H
00025 
00026 //  INCLUDES
00027 #include <SenDomFragmentBase.h>
00028 #include <SenSoapConstants.h>
00029 #include <MSenMessage.h>
00030 
00031 // CONSTANTS
00032 /*
00033 // Now declared in <SenSoapConstants.h>
00034 _LIT8(KSenSoapEnvelopeName,             "Envelope");
00035 _LIT8(KSenSoapEnvelopePrefix,               "S");
00036 _LIT8(KSenSoapEnvelopeXmlns,            "http://schemas.xmlsoap.org/soap/envelope/");
00037 _LIT8(KSenSoap12EnvelopeXmlns,          "http://www.w3.org/2003/05/soap-envelope");
00038 _LIT8(KSenSoapEnvelopeHeaderName,       "Header");
00039 _LIT8(KSenSoapEnvelopeHeaderQName,      "S:Header");
00040 _LIT8(KSenSoapEnvelopeBodyName,         "Body");
00041 _LIT8(KSenSoapEnvelopeBodyQName,        "S:Body");
00042 _LIT8(KSenSoapFaultName,                "Fault");
00043 
00044 _LIT8(KSenSoapActionHeaderName,         "SOAPAction");
00045 _LIT8(KSenSoapActionHeaderValueEmpty,   "\"\"");
00046 
00047 const TInt KStateParsingSoapHeader  = 20; // ignore state   (even number)
00048 const TInt KStateParsingSoapBody    = 40; // ignore state   (even number)
00049 const TInt KStateParsingSoapFault   = 5;  // save state     (odd number)
00050 
00051 enum TSOAPVersion
00052                 {
00053                 ESOAP11 = 1,
00054                 ESOAP12
00055                 };
00056 */
00057 
00058 // FORWARD DECLARATIONS
00059 class CSenSoapFault2;
00060 class CSenTransportProperties;
00061 class CSenMessageContext;
00062 class MSenMessageContext;
00063 
00064 // CLASS DECLARATION
00065 
00077 class CSenSoapEnvelope2 : public CSenFragmentBase, public MSenMessage
00078     {
00079     public:  // Constructors and destructor
00080 
00084         IMPORT_C static CSenSoapEnvelope2* NewL();
00085 
00089         IMPORT_C static CSenSoapEnvelope2* NewLC();
00090 
00094         IMPORT_C static CSenSoapEnvelope2* NewL(MSenMessageContext& aContext);
00095 
00099         IMPORT_C static CSenSoapEnvelope2* NewLC(MSenMessageContext& aContext);
00100 
00104         IMPORT_C static CSenSoapEnvelope2* NewL(CSenSoapEnvelope2& aEnvelope);
00105 
00109         IMPORT_C static CSenSoapEnvelope2* NewLC(CSenSoapEnvelope2& aEnvelope);
00110 
00114         IMPORT_C virtual ~CSenSoapEnvelope2();
00115 
00116         // New functions
00117 
00124         IMPORT_C virtual TPtrC8 SetBodyL(const TDesC8& aBody);
00125 
00132         IMPORT_C virtual TXmlEngElement SetBodyL(TXmlEngElement aBodyElement);
00133 
00139         IMPORT_C virtual TXmlEngElement BodyL();
00140 
00146         IMPORT_C virtual TXmlEngElement HeaderL();
00147 
00156         IMPORT_C virtual TXmlEngElement AddHeaderL(TXmlEngElement aHeaderElement);
00157 
00163         IMPORT_C virtual HBufC8* BodyAsStringL();
00164 
00170         IMPORT_C virtual TBool IsFault();
00171 
00179         IMPORT_C virtual CSenSoapFault2* DetachFaultL();
00180 
00187         IMPORT_C virtual CSenSoapFault2* FaultL();
00188 
00206         IMPORT_C virtual TPtrC8 SetSoapActionL(const TDesC8& aSoapAction);
00207 
00216         IMPORT_C virtual TPtrC8 SoapAction();
00217 
00218         /*
00219         * Getter for checking whether this message has at least one
00220         * valid <Header> element
00221         * @return ETrue, if <Header> element exists, EFalse otherwise.
00222         */
00223         IMPORT_C TBool HasHeader();
00224 
00225         /*
00226         * Getter for checking whether this message has valid <Body> element
00227         * @return ETrue, if <Body> element exists, EFalse otherwise.
00228         */
00229         IMPORT_C TBool HasBody();
00230         
00235         IMPORT_C virtual TSOAPVersion SoapVersion();
00236 
00237     public: // From MSenMessage
00238         IMPORT_C virtual TClass Type();
00239         IMPORT_C virtual TDirection Direction();
00240         IMPORT_C virtual TInt SetContext(MSenMessageContext* apOwnedContext);
00241         IMPORT_C virtual MSenMessageContext* Context();
00242         IMPORT_C virtual TInt SetProperties(MSenProperties* apOwnedProperties);
00243         IMPORT_C virtual MSenProperties* Properties();
00244 
00245         IMPORT_C virtual TBool IsSafeToCast(TClass aType);
00246         IMPORT_C virtual TInt TxnId();
00247                 IMPORT_C virtual MSenMessage* CloneL();
00248 
00249     protected:
00250 
00254         CSenSoapEnvelope2();
00260             IMPORT_C void BaseConstructL(TSOAPVersion aVersion);
00261 
00267         IMPORT_C void BaseConstructL();
00268 
00274         IMPORT_C void BaseConstructL(MSenMessageContext& aMessage);
00275 
00281         IMPORT_C void BaseConstructL(MSenMessageContext& aMessage,
00282                                      TSOAPVersion aVersion);
00283 
00289         IMPORT_C void BaseConstructL(CSenSoapEnvelope2& aEnvelope);
00290 
00291         // New functions
00292 
00305         IMPORT_C virtual void ParseHeaderL(const RTagInfo& aElement,
00306                                            const RAttributeArray& aAttributes);
00307 
00308         // Functions from base classes
00309 
00310         // From CSenFragmentBase
00311         IMPORT_C virtual void OnStartElementL(const RTagInfo& aElement,
00312                                               const RAttributeArray& aAttributes,
00313                                               TInt aErrorCode);                                            
00314 
00315         IMPORT_C virtual void OnEndElementL(const RTagInfo& aElement,
00316                                             TInt aErrorCode);
00317 
00318         IMPORT_C virtual CSenFragmentBase* CreateBodyFragmentL(const TDesC8& aNsUri,
00319                                                        const TDesC8& aLocalName,
00320                                                        const TDesC8& aPrefix,
00321                                                        const RAttributeArray& aAttributes,
00322                                                        TXmlEngElement& aParent,
00323                                                        RSenDocument& aOwnerDocument);
00324 
00325     protected: // Data
00326         // Internal members, protected so that deriving classes have access to them.
00327         CSenFragmentBase*           ipBodyFragment;
00328         CSenFragmentBase*           ipHeaderFragment;
00329         HBufC8*                     ipSoapAction;
00330         TInt                        iTransactionId;
00331 
00332         MSenProperties*             ipProperties;      // owned => safe upward cast is performed in de-alloc
00333         MSenMessageContext*         ipNotOwnedContext; // owned => safe upward cast is performed in de-alloc
00334         
00335         TAny* ipReserved;
00336 
00337         TBool               iFault;
00338         TDirection          iDirection;
00339     };
00340 
00341 #endif // SEN_SOAP_ENVELOPE_H
00342 
00343 // End of File
00344 
00345 
00346 

Copyright © Nokia Corporation 2001-2007
Back to top