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_ENVELOPE_H 00024 #define SEN_SOAP_ENVELOPE_H 00025 00026 // INCLUDES 00027 #include <SenBaseFragment.h> 00028 #include <SenSoapConstants.h> 00029 00030 // CONSTANTS 00031 _LIT8(KSoapActionHeaderValueEmpty, "\"\""); // default, if not set 00032 00033 /* 00034 // Now declared in <SenSoapConstants.h> 00035 _LIT8(KSenSoap12ContentTypeHeaderValue, "application/soap+xml; charset=\"UTF-8\""); 00036 _LIT8(KSenSoap12AcceptHeaderValue, "application/soap+xml"); 00037 _LIT8(KSenSoapEnvelopeName, "Envelope"); 00038 _LIT8(KSenSoapEnvelopeQName, "S:Envelope"); 00039 00040 _LIT8(KSenSoapEnvelopeXmlns, "http://schemas.xmlsoap.org/soap/envelope/"); 00041 _LIT8(KSenSoap12EnvelopeXmlns, "http://www.w3.org/2003/05/soap-envelope"); 00042 _LIT8(KSenSoapEnvelopeHeaderName, "Header"); 00043 _LIT8(KSenSoapEnvelopeHeaderQName, "S:Header"); 00044 _LIT8(KSenSoapEnvelopeBodyName, "Body"); 00045 _LIT8(KSenSoapEnvelopeBodyQName, "S:Body"); 00046 _LIT8(KSenSoapFaultName, "Fault"); 00047 00048 _LIT8(KSenSoapActionHeaderName, "SOAPAction"); 00049 _LIT8(KSenSoapActionHeaderValueEmpty, "\"\""); 00050 00051 00052 const TInt KStateParsingSoapHeader = 20; // ignore state (even number) 00053 const TInt KStateParsingSoapBody = 40; // ignore state (even number) 00054 const TInt KStateParsingSoapFault = 5; // save state (odd number) 00055 00056 enum TSOAPVersion 00057 { 00058 ESOAP11 = 1, 00059 ESOAP12 00060 }; 00061 */ 00062 00063 // FORWARD DECLARATIONS 00064 class CSenSoapFault; 00065 00066 // CLASS DECLARATION 00067 00079 class CSenSoapEnvelope : public CSenBaseFragment 00080 { 00081 public: // Constructors and destructor 00082 00086 IMPORT_C static CSenSoapEnvelope* NewL(); 00087 00091 IMPORT_C virtual ~CSenSoapEnvelope(); 00092 00093 // New functions 00094 00101 IMPORT_C virtual TPtrC8 SetBodyL(const TDesC8& aBody); 00102 00108 IMPORT_C virtual CSenElement& BodyL(); 00109 00115 IMPORT_C virtual CSenElement& HeaderL(); 00116 00125 IMPORT_C virtual CSenElement& AddHeaderL(CSenElement& aHeaderElement); 00126 00132 IMPORT_C virtual HBufC8* BodyAsStringL(); 00133 00139 IMPORT_C virtual TBool IsFault(); 00140 00148 IMPORT_C virtual CSenSoapFault* DetachFaultL(); 00149 00156 IMPORT_C virtual CSenSoapFault* FaultL(); 00157 00175 IMPORT_C virtual TPtrC8 SetSoapActionL(const TDesC8& aSoapAction); 00176 00185 IMPORT_C virtual TPtrC8 SoapAction(); 00186 00195 IMPORT_C TPtrC8 SoapAction2() ; 00196 00200 IMPORT_C void ParseL(const TDesC8& aXml); 00201 00202 /* 00203 * Getter for checking whether this message has at least one 00204 * valid <Header> element 00205 * @return ETrue, if <Header> element exists, EFalse otherwise. 00206 */ 00207 IMPORT_C TBool HasHeader(); 00208 00209 /* 00210 * Getter for checking whether this message has valid <Body> element 00211 * @return ETrue, if <Body> element exists, EFalse otherwise. 00212 */ 00213 IMPORT_C TBool HasBody(); 00214 00219 IMPORT_C TSOAPVersion SoapVersion(); 00220 00221 00222 protected: 00223 00227 CSenSoapEnvelope(); 00228 00234 IMPORT_C void BaseConstructL(TSOAPVersion aVersion); 00235 00241 IMPORT_C void BaseConstructL(); 00242 00243 // New functions 00244 00257 IMPORT_C virtual void ParseHeaderL( const TDesC8& aNsUri, 00258 const TDesC8& aLocalName, 00259 const TDesC8& aQName, 00260 const RAttributeArray& aAttributes); 00261 00262 // Functions from base classes 00263 00264 // From CSenBaseFragment 00265 00284 IMPORT_C virtual void StartElementL(const TDesC8& aNsUri, 00285 const TDesC8& aLocalName, 00286 const TDesC8& aQName, 00287 const RAttributeArray& aAttributes); 00288 00298 IMPORT_C virtual void EndElementL(const TDesC8& aNsUri, 00299 const TDesC8& aLocalName, 00300 const TDesC8& aQName); 00301 00302 protected: // Data 00303 // Internal members, protected so that deriving classes have access to them. 00304 CSenBaseFragment* ipBodyFragment; 00305 CSenBaseFragment* ipHeaderFragment; 00306 HBufC8* ipSoapAction; 00307 00308 private: // Data 00309 TBool iFault; 00310 }; 00311 00312 #endif // SEN_SOAP_ENVELOPE_H 00313 00314 // End of File 00315 00316 00317