webservices/idwsfplugin/src/idwsfsoapmessage.cpp
changeset 0 62f9d29f7211
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:        
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 // INCLUDE FILES
       
    26 #include <badesca.h>
       
    27 #include <SenXmlReader.h>
       
    28 #include <s32mem.h>
       
    29 #include <utf.h>
       
    30 
       
    31 #include <SenWsSecurityHeader.h>
       
    32 
       
    33 #include "sendebug.h"
       
    34 
       
    35 #include "idwsfsoapmessage.h"
       
    36 #include "idwsfservicesession.h"
       
    37 
       
    38 
       
    39 CIdWsfSoapMessage* CIdWsfSoapMessage::NewL()
       
    40     {
       
    41     CIdWsfSoapMessage* pNew = new (ELeave) CIdWsfSoapMessage;
       
    42     CleanupStack::PushL(pNew);
       
    43     pNew->BaseConstructL();
       
    44     CleanupStack::Pop(); // pNew;
       
    45     return pNew;
       
    46     }
       
    47 
       
    48 CIdWsfSoapMessage::CIdWsfSoapMessage() :
       
    49     ipSecurityMechanismURI(NULL)
       
    50     {
       
    51     }
       
    52 
       
    53 
       
    54 CIdWsfSoapMessage::~CIdWsfSoapMessage()
       
    55     {
       
    56     }
       
    57 
       
    58 void CIdWsfSoapMessage::BaseConstructL()
       
    59     {
       
    60     CSenSoapMessage::BaseConstructL();
       
    61     }
       
    62 
       
    63 CSenWsSecurityHeader* CIdWsfSoapMessage::NewSecurityHeaderLC(
       
    64                                                         const TDesC8* aData)
       
    65     {
       
    66     /*
       
    67     CIdWsfSecurityHeader* pNew = NULL;
       
    68     if(aData)
       
    69         {
       
    70         // ID-WSF 1.0 compliant security header with credential
       
    71         pNew = CIdWsfSecurityHeader::NewL(*aData);
       
    72         }
       
    73     else
       
    74         {
       
    75         // ID-WSF 1.0 compliant security header WITHOUT credential
       
    76         pNew = CIdWsfSecurityHeader::NewL();
       
    77         }
       
    78     CleanupStack::PushL(pNew);
       
    79     return pNew;
       
    80     */
       
    81 
       
    82     CSenWsSecurityHeader* pHeader = NULL;
       
    83 
       
    84     if(ipSecurityMechanismURI && (
       
    85         (*ipSecurityMechanismURI).Compare(KSecTlsBearer11) == 0 
       
    86                                 ||
       
    87         (*ipSecurityMechanismURI).Compare(KSecNullBearer11) == 0))
       
    88         {
       
    89           SENDEBUG_L("CIdWsfSoapMessage::NewSecurityHeaderLC \
       
    90                - Setting header for ID-WSF 1.1");
       
    91             // We need to use (newer) security header for ID-WSF 1.1
       
    92             // this could be done in IdWsfSoapMessage class, if it would
       
    93             // somehow know in NewSecurityHeaderL() method, that it is
       
    94             // actually 1.0 or 1.1. But this current solution is rather
       
    95             // clear also. Each new header type, we need a new 
       
    96             // else-if code segment inside this session class method,
       
    97             // -> in here.
       
    98            
       
    99 
       
   100           if(aData)
       
   101             {
       
   102             // ID-WSF 1.1 compliant security header with credential
       
   103             pHeader = 
       
   104                 CSenWsSecurityHeader::NewL(*aData); 
       
   105             }
       
   106           else
       
   107             {
       
   108             // ID-WSF 1.1 compliant security header WITHOUT credential
       
   109             pHeader = 
       
   110                 CSenWsSecurityHeader::NewL(); 
       
   111             }
       
   112         }
       
   113        else // either no security mechanism or 1.0 some compliant mechanism
       
   114         {
       
   115            SENDEBUG_L("CIdWsfSoapMessage::NewSecurityHeaderLC \
       
   116                - Setting header for ID-WSF 1.0");
       
   117           // Add new ID-WSF 1.0 compliant (draft) security header to msg
       
   118           if(aData)
       
   119             {
       
   120             // ID-WSF 1.0 compliant security header with credential
       
   121             pHeader = 
       
   122                 CIdWsfSecurityHeader::NewL(*aData); 
       
   123             }
       
   124           else
       
   125             {
       
   126             // ID-WSF 1.0 compliant security header WITHOUT credential
       
   127             pHeader = 
       
   128                 CIdWsfSecurityHeader::NewL(); 
       
   129             }
       
   130           // Above is equal with next line, if an aMsg argument 
       
   131           // is actually SenIdWsfSoapMessage(!), ID-WSF 1.1, matmatt
       
   132           //CSenWebServiceSession::SetFrameworkHeaders(aMsg);
       
   133 
       
   134         }
       
   135     CleanupStack::PushL(pHeader);
       
   136     return pHeader;
       
   137     }
       
   138 
       
   139 
       
   140 void CIdWsfSoapMessage::SetSecurityMechanism(HBufC8* apSecurityMechanismURI)
       
   141     {
       
   142     // this method is used to indicate which security mechanism is
       
   143     // being used. Further on, this info can be used when creating
       
   144     // new security header. For example, in ID-WSF 1.0, we can
       
   145     // use the draft namespace in the header, and in ID-WSF 1.1 
       
   146     // newer (oasis) version.
       
   147     ipSecurityMechanismURI = apSecurityMechanismURI;
       
   148     }
       
   149 
       
   150 // END OF FILE
       
   151