|
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: Header declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 #ifndef M_SEN_REMOTE_SERVICE_CONSUMER_H |
|
26 #define M_SEN_REMOTE_SERVICE_CONSUMER_H |
|
27 |
|
28 |
|
29 #include <e32base.h> |
|
30 #include <e32des8.h> // HBufC8 |
|
31 #include <SenServiceConnection.h> |
|
32 |
|
33 //#include "MSenRemoteServiceSession.h" |
|
34 //#include "MSenTransport.h" |
|
35 |
|
36 // FORWARD DECLARE |
|
37 class MSenRemoteServiceSession; |
|
38 class MSenTransport; |
|
39 class CSenIdentifier; |
|
40 class CSenServiceSession; |
|
41 class CSenChunk; |
|
42 class MSenProperties; |
|
43 class MSenMessageContext; |
|
44 class CSenIdentityProvider; |
|
45 |
|
46 // CLASS DECLARATION |
|
47 class MSenRemoteServiceConsumer |
|
48 { |
|
49 public: |
|
50 |
|
51 // New functions |
|
52 |
|
53 /** |
|
54 * Getter to the ID of this service consumer. Actually this is a convenience |
|
55 * method which returns the value of the CSenIdentifier which is globally |
|
56 * identifying this consumer. This helper is handy in cases where identifier |
|
57 * type is not relevant. In more complex, global junctions, Identitifier() |
|
58 * getter method should be called. |
|
59 * @return a descriptor which locally identifies this session. This is actually |
|
60 * the value of CSenIdentifier, which is the unique identifier of this |
|
61 * consumer. |
|
62 */ |
|
63 virtual const TDesC8& Id() const = 0; |
|
64 |
|
65 virtual TInt SetSessionL(MSenRemoteServiceSession& aServiceSession) = 0; |
|
66 |
|
67 /** |
|
68 * This callback will be called when a response message is received |
|
69 * from (remote) service. The framework spesific overhead is removed |
|
70 * from the message, unless the application has indicated that it wants |
|
71 * to receive complete messages. This means that response could be only |
|
72 * the message body OR complete message with header information. In SOAP |
|
73 * spesific services, it could be either SOAP Body or complete SOAP |
|
74 * envelope. Also, in most cases, the string is actually XML. |
|
75 * |
|
76 * @param aMessage is the response from the service. Depending on client's |
|
77 * wishes, it might be complete message, or only a body of the original |
|
78 * message from which all framework spesific overhead has been removed. |
|
79 * @param aTxnId identifies what request is being responded. This transaction |
|
80 * was originally generated by the transport layer. |
|
81 * @param aTranportProperties is optional argument, which may be NULL, |
|
82 * or it could include some transport spesific information about the |
|
83 * message. In case of HTTP transport, it could include the content |
|
84 * type of the response. |
|
85 * @param aMessage - a String with the service specific part of the |
|
86 * message. |
|
87 * @return KErrNone, if this consumer was able to successfully carry out |
|
88 * and process this callback. Consumer should return an error otherwise, |
|
89 * so that the service session (or even transport) will know that |
|
90 * problems occured during the delivery. |
|
91 */ |
|
92 virtual TInt HandleMessageL(HBufC8* aMessage, |
|
93 const TInt aTxnId, |
|
94 MSenProperties* aResponseTransportProperties) = 0; |
|
95 |
|
96 /** |
|
97 * This callback will be called when an error response (marked as a fault) |
|
98 * is received from (remote) service. The framework spesific overhead is |
|
99 * removed from the error, unless the application has indicated that it |
|
100 * wants to receive complete messages. This means that response could be |
|
101 * only the fault part of message body OR complete error message with header |
|
102 * information. In SOAP spesific services, it could be either SOAP fault or |
|
103 * complete SOAP envelope. In most cases, the error string is XML. |
|
104 * |
|
105 * @param aError is the error received from the service. Depending on client's |
|
106 * wishes, it might be complete error message, or only a body of the original |
|
107 * error from which all framework spesific overhead has been removed. In SOAP |
|
108 * based services, this means that it could be either complete SOAP Envelope |
|
109 * or just the SOAP fault extracted from the SOAP body. |
|
110 * @param aErrorCode is the code identifying the error type. |
|
111 * @param aTxnId identifies what request is being responded. This transaction |
|
112 * was originally generated by the transport layer. |
|
113 * @param aTranportProperties is optional argument, which may be NULL, |
|
114 * or it could include some transport spesific information about the |
|
115 * message. In case of HTTP transport, it could include the content |
|
116 * type of the response. |
|
117 * @param aMessage - a String with the service specific part of the |
|
118 * message. |
|
119 * @return KErrNone, if this consumer was able to successfully carry out |
|
120 * and process this callback. Consumer should return an error otherwise, |
|
121 * so that the service session (or even transport) will know that |
|
122 * problems occured during the delivery. |
|
123 */ |
|
124 virtual TInt HandleErrorL(HBufC8* aError, |
|
125 const TInt aErrorCode, |
|
126 const TInt aTxnId, |
|
127 MSenProperties* aResponseTransportProperties) = 0; |
|
128 |
|
129 /** |
|
130 * This method is called when service connection status changes. |
|
131 * The status constant (TInt) may be be spesified by the actual |
|
132 * ServiceInvocationFramework implementation. The following |
|
133 * status codes are possible for *any* service invocation |
|
134 * framework (as defined in SenServiceConnection.h): |
|
135 * |
|
136 * - KSenConnectionStatusNew |
|
137 * - KSenConnectionStatusReady |
|
138 * |
|
139 * In addition, some web services frameworks might notify when |
|
140 * the service credentials get expired, by sending this status: |
|
141 * |
|
142 * - KSenConnectionStatusExpired |
|
143 * |
|
144 * @param aStatus - a code expressing new status |
|
145 */ |
|
146 virtual void SetStatusL(const TInt aStatus) = 0; |
|
147 |
|
148 |
|
149 /** |
|
150 * This method is offered for the use of service invocation frameworks |
|
151 * (SIFs) and typically for service sessions, which need handle transport |
|
152 * to pre-allocated transport instance. |
|
153 * |
|
154 * return MSenTransport the transport owned by remote client |
|
155 * |
|
156 */ |
|
157 virtual MSenTransport& TransportL() = 0; |
|
158 |
|
159 /** |
|
160 * Getter for unique identifier of this service consumer, which |
|
161 * further provides theŽidentifier type and value. |
|
162 * @return CSenIdentifier object which identifies this consumer. |
|
163 */ |
|
164 virtual CSenIdentifier& Identifier() const = 0; |
|
165 |
|
166 |
|
167 /** |
|
168 * Method for requesting a chunk behind a known, pending transaction |
|
169 * id. This method is typically called by MSenRemoteHostlet implementations, |
|
170 * when they wish to acquire handle to same RChunk -- encapsulated by CSenChunk |
|
171 * -- which was created by consumer who is sending a message to that hostlet. |
|
172 * This way, the copying of memory (payload of the message) can be avoided |
|
173 * inside Web Services Framework server process. |
|
174 * @param aTxnId is the id of known, pending transaction |
|
175 * @param aChunk is a ref-to-pointer, which will be set |
|
176 * to provide access to a chunk, if such can be find with |
|
177 * provided aTxnId |
|
178 * @return KErrNone, if successful: this means that aChunk != NULL. |
|
179 * KErrNone, if chunk was not found; aChunk will be set to NULL. |
|
180 * Method leaves with some system-wide errorcode, if a fatal situation |
|
181 * is met during the search and validation of the chunk (transaction) |
|
182 * in question. |
|
183 */ |
|
184 // INTERNAL NOTE: please be careful not to base your code on this method, as this will |
|
185 // be made obsolate (deprecated) when message context implementations are available |
|
186 virtual TInt ChunkByTxnIdL(TInt aTxnId, CSenChunk*& aChunk) = 0; |
|
187 |
|
188 |
|
189 |
|
190 inline virtual MSenMessageContext* MessageContextByTxnIdL(TInt /* aTxnId */, TInt& aError) |
|
191 { |
|
192 aError = KErrNotSupported; |
|
193 return NULL; |
|
194 } |
|
195 |
|
196 inline virtual void StateChanged(TInt /*aState*/) {}; |
|
197 |
|
198 inline virtual TBool HasAuthenticationCallback() { return EFalse;}; |
|
199 // Constantness on TInt return type has no meaning |
|
200 virtual TInt ConnectionId() { return 0; }; |
|
201 virtual void FileProgress(TInt aTxnId, TBool aIncoming, TBool aIsSoap, |
|
202 const TDesC8& aSoapOrCid, TInt aProgress) = 0; |
|
203 virtual TInt ReauthenticationNeededL(CSenIdentityProvider*& /*aIdp*/) { return 0; }; |
|
204 virtual void SetDataTrafficDetails( TSenDataTrafficDetails& aDetails) = 0; |
|
205 virtual TBool OnGetBrandIdL( const TDesC8& /* aBrandIdListAsXmlSnippet */, RBuf8& /* aSelectedBrandId */){return EFalse;}; |
|
206 virtual TBool HasCoBrandingCallback(){return EFalse;}; |
|
207 virtual TSecureId SecureId( ) {return 0;}; |
|
208 virtual TVendorId VendorId() { return 0; }; |
|
209 }; |
|
210 |
|
211 #endif // M_SEN_REMOTE_SERVICE_CONSUMER_H |
|
212 |
|
213 |
|
214 // End of file |
|
215 |
|
216 |