|
1 /* |
|
2 * Copyright (c) 2006-2006 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 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 #include "wsstarenveloperhandler.h" |
|
31 #include "senlogger.h" |
|
32 |
|
33 // Create instance of concrete ECOM interface implementation |
|
34 CWSStarEnveloperHandler* CWSStarEnveloperHandler::NewL(TAny* aHandlerCtx) |
|
35 { |
|
36 |
|
37 MSenHandlerContext* handlerCtx = |
|
38 reinterpret_cast<MSenHandlerContext*>(aHandlerCtx); |
|
39 CWSStarEnveloperHandler* self = new (ELeave) CWSStarEnveloperHandler(*handlerCtx); |
|
40 CleanupStack::PushL (self); |
|
41 self->ConstructL(); |
|
42 CleanupStack::Pop(self); |
|
43 return self; |
|
44 } |
|
45 |
|
46 // Constructor |
|
47 CWSStarEnveloperHandler::CWSStarEnveloperHandler(MSenHandlerContext& aCtx):CSenMessageHandler(aCtx) |
|
48 { |
|
49 } |
|
50 |
|
51 // Destructor |
|
52 CWSStarEnveloperHandler::~CWSStarEnveloperHandler() |
|
53 { |
|
54 TLSLOG(KSenCoreServiceManagerLogChannelBase , KMinLogLevel,(_L("CWSStarEnveloperHandler::~CWSStarEnveloperHandler()"))); |
|
55 } |
|
56 |
|
57 // Second phase construction. |
|
58 void CWSStarEnveloperHandler::ConstructL() |
|
59 { |
|
60 } |
|
61 |
|
62 TInt CWSStarEnveloperHandler::InvokeL(MSenMessageContext& aCtx) |
|
63 { |
|
64 TLSLOG(KSenCoreServiceManagerLogChannelBase , KMinLogLevel,(_L("CWSStarEnveloperHandler::InvokeL(MSenMessageContext& aCtx)"))); |
|
65 const TInt* soapVersion = aCtx.GetIntL(WSStarContextKeys::KSoapVersion); |
|
66 const TDesC8* securityVersion = iHandlerContext.GetDesC8L(HandlerContextKey::KVersion); |
|
67 CSenSoapMessage* message; |
|
68 TPtrC8 secVersion(KSecurityXmlNs); |
|
69 if (securityVersion |
|
70 && (*securityVersion == KSecuritySchemeXmlNs || *securityVersion == KSecurityXmlNs)) |
|
71 { |
|
72 secVersion.Set(*securityVersion); |
|
73 } |
|
74 if (soapVersion) |
|
75 { |
|
76 //old SOAP version force to use old sec spec |
|
77 if ((TSOAPVersion)*soapVersion == ESOAP11) |
|
78 { |
|
79 secVersion.Set(KSecuritySchemeXmlNs); |
|
80 } |
|
81 message = CSenSoapMessage::NewL((TSOAPVersion)*soapVersion, secVersion); |
|
82 } |
|
83 else |
|
84 { |
|
85 message = CSenSoapMessage::NewL(ESOAP12, secVersion); |
|
86 ((MSenContext&)aCtx).Add(WSStarContextKeys::KSoapVersion,ESOAP12); |
|
87 } |
|
88 CleanupStack::PushL(message); |
|
89 CSenElement* elemBody = |
|
90 const_cast<CSenElement*>(aCtx.GetSenElementL(WSStarContextKeys::KBodyElement)); |
|
91 if (elemBody) |
|
92 { |
|
93 message->BodyL().AddElementL(*elemBody); |
|
94 aCtx.Remove(WSStarContextKeys::KBodyElement); |
|
95 } |
|
96 else |
|
97 { |
|
98 const TDesC8* content = aCtx.GetDesC8L(WSStarContextKeys::KBody); |
|
99 if (content) |
|
100 { |
|
101 message->SetBodyL(*content); |
|
102 } |
|
103 } |
|
104 CleanupStack::Pop(message); |
|
105 aCtx.Update(SenContext::KSenCurrentSoapMessageCtxKey, message); |
|
106 return KErrNone; |
|
107 } |
|
108 |
|
109 SenHandler::THandlerDirection CWSStarEnveloperHandler::Direction() const |
|
110 { |
|
111 TLSLOG(KSenCoreServiceManagerLogChannelBase , KMinLogLevel,(_L("CWSStarEnveloperHandler::Direction()"))); |
|
112 return SenHandler::EOutgoing; |
|
113 }; |
|
114 SenHandler::THandlerPhase CWSStarEnveloperHandler::Phase() |
|
115 { |
|
116 TLSLOG(KSenCoreServiceManagerLogChannelBase , KMinLogLevel,(_L("CWSStarEnveloperHandler::Phase()"))); |
|
117 return SenHandler::EMessage; |
|
118 }; |
|
119 |
|
120 TInt CWSStarEnveloperHandler::InitL(MSenHandlerContext& aCtx) |
|
121 { |
|
122 iHandlerContext = aCtx; |
|
123 return KErrNone; |
|
124 } |
|
125 RFileLogger* CWSStarEnveloperHandler::Log() const |
|
126 { |
|
127 RFileLogger* pLog = NULL; |
|
128 TRAP_IGNORE( pLog = (RFileLogger*)iHandlerContext.GetAnyL(HandlerContextKey::KLogger); ) |
|
129 return pLog; |
|
130 } |
|
131 // END OF FILE |
|
132 |