websrv_pub/web_service_connection_api/inc/SenSoapMessage.h
changeset 0 62f9d29f7211
child 12 20aafbbfb68e
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:        CSenSoapMessage is an utility class offering capability to
       
    15 *                 parse XML SOAP envelope and manipulation methods to alter its
       
    16 *                 contents.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 #ifndef SEN_SOAP_MESSAGE_H
       
    28 #define SEN_SOAP_MESSAGE_H
       
    29 
       
    30 //  INCLUDES
       
    31 #include <SenWsSecurityHeader.h>
       
    32 #include <SenSoapEnvelope.h>
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 * CSenSoapMessage extends basic SOAP envelope functionality by
       
    38 * offering methods to set the security header and security token.
       
    39 * @lib SenUtils.lib
       
    40 * @since Series60 3.0
       
    41 */
       
    42 class CSenSoapMessage : public CSenSoapEnvelope
       
    43     {
       
    44     public:  // Constructors and destructor
       
    45         
       
    46         /**
       
    47         * Two-phase constructor.
       
    48         */
       
    49         IMPORT_C static CSenSoapMessage* NewL();
       
    50 
       
    51         /**
       
    52         * Two-phase constructor.
       
    53         * @param    aVersion version of SOAP (1.1 or 1.2)
       
    54         * @since Series60 4.0
       
    55         */
       
    56         IMPORT_C static CSenSoapMessage* NewL(TSOAPVersion aVersion);
       
    57         
       
    58         /**
       
    59         * Two-phase constructor.
       
    60         * @param    aVersion version of SOAP (1.1 or 1.2)
       
    61         * @param    aSecurityNs seurity namespace version . 
       
    62         *           KSecuritySchemeXmlNs from 2003 , or KSecurityXmlNs from 2004
       
    63         * @since Series60 4.0
       
    64         */
       
    65         IMPORT_C static CSenSoapMessage* NewL(TSOAPVersion aVersion, const TDesC8& aSecurityNs);
       
    66         
       
    67         /**
       
    68         * Destructor.
       
    69         */
       
    70         IMPORT_C virtual ~CSenSoapMessage();
       
    71 
       
    72         // New functions
       
    73         
       
    74         /**
       
    75         * Sets a new security header for the soap message. If existant, the
       
    76         * old security header is deleted and new one with given data is added.
       
    77         * @since Series60 3.0
       
    78         * @param    aData    Data to be used in the security header.
       
    79         */
       
    80         IMPORT_C void SetSecurityHeaderL(const TDesC8& aData);
       
    81         
       
    82         /**
       
    83         * Adds new token (content) to current security header, 
       
    84         * appending to existing. The token is appended after the
       
    85         * current content of security token. Method instantiates
       
    86         * and adds default security header (without data), if 
       
    87         * such was not set in beforehand.
       
    88         * @since Series60 3.0
       
    89         * @param    aNewToken    Token to be inserted.
       
    90         * @return    KErrNone or some system-wide Symbian error codes.
       
    91         */
       
    92         IMPORT_C TInt AddSecurityTokenL(const TDesC8& aNewToken);    
       
    93         
       
    94     protected:  
       
    95     
       
    96         /**
       
    97          *    C++ default constructor.
       
    98          */
       
    99         IMPORT_C CSenSoapMessage::CSenSoapMessage();
       
   100 
       
   101         // New functions
       
   102         
       
   103         /**
       
   104         * Helper function to make a new security header.
       
   105         * @since Series60 3.0
       
   106         * @param    aData    Default=NULL. Data to be set in the security header.
       
   107         * @return    new security header, which is located in the cleanup stack.
       
   108         *            Caller takes ownership.
       
   109         */
       
   110         IMPORT_C virtual CSenWsSecurityHeader* NewSecurityHeaderLC(
       
   111                                                     const TDesC8* aData=NULL);
       
   112 
       
   113         // Functions from base classes
       
   114         
       
   115         // From CSenSoapEnvelope 
       
   116         
       
   117         /**
       
   118         * Implements functionality to parse SOAP header if one is found
       
   119         * during parsing the envelope.
       
   120         * Extends basic functionality from SOAP envelope by recognizing
       
   121         * and parsing <Security> element under following namespace:
       
   122         * http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
       
   123         * All other headers are parsed using superclass (SOAP envelope)
       
   124         * functionality.
       
   125         * @since Series60 3.0
       
   126         * @param aNsUri            The namespace URI of the new element
       
   127         * @param aLocalName        The local name of the new element
       
   128         * @param aQName            The qualified name of the new element
       
   129         * @param aAttributes    The attributes of the new element
       
   130         */
       
   131         IMPORT_C virtual void ParseHeaderL(const TDesC8& aNsUri,
       
   132                                            const TDesC8& aLocalName,
       
   133                                            const TDesC8& aQName,
       
   134                                            const RAttributeArray& aAttributes);
       
   135 
       
   136         /**
       
   137         * This method should be called from the deriving classes ConstructL() methods. 
       
   138         * @since Series60 3.0
       
   139         */
       
   140         IMPORT_C void BaseConstructL();
       
   141 
       
   142         /**
       
   143         * This method should be called from the deriving classes ConstructL() methods. 
       
   144         * @since Series60 4.0
       
   145         */
       
   146         IMPORT_C void BaseConstructL(TSOAPVersion aVersion);
       
   147         
       
   148         /**
       
   149         * This method should be called from the deriving classes ConstructL() methods.
       
   150         * @param    aVersion version of SOAP (1.1 or 1.2)
       
   151         * @param    aSecurityNs seurity namespace version . 
       
   152         *           KSecuritySchemeXmlNs from 2003 , or KSecurityXmlNs from 2004
       
   153         * @since Series60 4.0
       
   154         */
       
   155         IMPORT_C void BaseConstructL(TSOAPVersion aVersion, const TDesC8& aSecurityNs);
       
   156 
       
   157     protected: // Data
       
   158         // Owned, but element not owned
       
   159         CSenWsSecurityHeader* ipSecurityHeader; 
       
   160     };
       
   161 
       
   162 #endif // SEN_SOAP_MESSAGE_H
       
   163 
       
   164 // End of File
       
   165 
       
   166