|
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: CSenServiceConnection offers public API for |
|
15 * service consumers to access invocable services, |
|
16 * as a part of the Web Services Framework (WSF). |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 #ifndef SEN_SERVICE_CONNECTION_H |
|
32 #define SEN_SERVICE_CONNECTION_H |
|
33 |
|
34 // INCLUDES |
|
35 #include <e32base.h> // for CActive |
|
36 #include <MSenServiceConsumer.h> |
|
37 #include <MSenServiceDescription.h> |
|
38 |
|
39 #include <MSenAuthenticationProvider.h> |
|
40 |
|
41 #include <SenSoapMessage.h> |
|
42 #include <SenSoapMessage2.h> |
|
43 //#include <SenAtomEntry.h> |
|
44 |
|
45 |
|
46 #include <MSenMessage.h> |
|
47 |
|
48 // CONSTANTS |
|
49 const TInt KErrSenNotInitialized = -30291; |
|
50 const TInt KErrSenServiceConnectionBusy = -30292; |
|
51 const TInt KErrConnectionInitializing = -30293; |
|
52 const TInt KErrConnectionExpired = -30294; |
|
53 const TInt KErrSubmitting = -30295; |
|
54 const TInt KErrSenSoapFault = -30296; |
|
55 const TInt KErrSenInternal = -30297; |
|
56 const TInt KErrSenNoEndpoint = -30298; |
|
57 const TInt KErrSenNoContract = -30299; |
|
58 |
|
59 const TInt KErrSenProviderIdInUseByAnotherEndpoint = -30305; |
|
60 const TInt KErrSenNoContractNoEndPoint = -30306; |
|
61 |
|
62 const TInt KErrSenBrokenSoapEnvelope = -30307; |
|
63 const TInt KErrSenBrokenSoapFault = -30308; |
|
64 const TInt KErrSenCancelled = -30309; |
|
65 |
|
66 |
|
67 // HTTP transport error codes: |
|
68 const TInt KErrSenNoHttpResponseBody = -30310; |
|
69 const TInt KErrSenNoHttpContentType = -30311; |
|
70 const TInt KErrSenHttpRedirectRequiresConfirmation = -30312; |
|
71 |
|
72 // SOAP message verification error codes: |
|
73 const TInt KErrSenNoSoapBody = -30313; |
|
74 const TInt KErrSenNoSoapHeader = -30314; |
|
75 const TInt KErrSenNoPermission = -30315; |
|
76 |
|
77 const TInt KErrSenHostNotAvailable = -30318; |
|
78 |
|
79 const TInt KErrSenAuthenticationFault = -30319; |
|
80 const TInt KErrSenNoEndUserPermission = -30321; |
|
81 const TInt KErrSenBrandNotSupported = -30322; |
|
82 |
|
83 const TInt KSenConnectionStatusCreateFailed = -1; // post-state |
|
84 const TInt KSenConnectionStatusNew = 0; // post-state |
|
85 const TInt KSenConnectionStatusReady = 1; // post-state |
|
86 const TInt KSenConnectionStatusExpired = 2; // post-state |
|
87 const TInt KSenConnectionStatusAuthentication = 3; // pre-state |
|
88 const TInt KSenConnectionStatusDiscovery = 4; // pre-state |
|
89 const TInt KSenConnectionStatusMetadataExchange = 5; // pre-state |
|
90 |
|
91 _LIT8(KDefaultBasicWebServicesFrameworkID, "WS-I"); |
|
92 _LIT8(KDefaultIdWsfFrameworkID, "ID-WSF"); |
|
93 _LIT8(KDefaultRestServicesFrameworkID, "REST"); |
|
94 _LIT8(KDefaultWSStarFrameworkID, "WS-STAR"); |
|
95 _LIT8(KDefaultAtomPubFrameworkID, "ATOM-PUB"); |
|
96 _LIT8(KDefaultOviFrameworkID, "OVI"); |
|
97 |
|
98 const TInt KSenTransportStatusCodeOffsetBaseHttp = 1000; |
|
99 const TInt KSenTransportStatusCodeOffsetBaseVtcp = 2000; |
|
100 |
|
101 const TInt KSenTransportStatusCodeVtcpInit = 2001; // KSenTransportStatusCodeOffsetBaseVtcp +1 |
|
102 const TInt KSenTransportStatusCodeVtcpActive = 2002; // KSenTransportStatusCodeOffsetBaseVtcp +2 |
|
103 const TInt KSenTransportStatusCodeVtcpSuspended = 2003; // KSenTransportStatusCodeOffsetBaseVtcp +3 |
|
104 const TInt KSenTransportStatusCodeVtcpInactive = 2004; // KSenTransportStatusCodeOffsetBaseVtcp +4 |
|
105 const TInt KSenTransportStatusCodeVtcpUnavailable = 2005; // KSenTransportStatusCodeOffsetBaseVtcp +5 |
|
106 |
|
107 // FORWARD DECLARATIONS |
|
108 class CSenServicePattern; |
|
109 class CSenIdentityProvider; |
|
110 |
|
111 struct TSenDataTrafficDetails |
|
112 { |
|
113 public: |
|
114 |
|
115 TSenDataTrafficDetails():iTotalBytesSent(0), |
|
116 iTotalBytesRecieved(0) |
|
117 { |
|
118 } |
|
119 |
|
120 TBool operator==(TSenDataTrafficDetails& rhs) |
|
121 { |
|
122 if( (this->iTotalBytesSent == rhs.iTotalBytesSent) && |
|
123 (this->iTotalBytesRecieved == rhs.iTotalBytesRecieved) ) |
|
124 return ETrue; |
|
125 else |
|
126 return EFalse; |
|
127 } |
|
128 |
|
129 TSenDataTrafficDetails& operator=(TSenDataTrafficDetails& rhs) |
|
130 { |
|
131 if(*this == rhs) |
|
132 return *this; |
|
133 this->iTotalBytesSent = rhs.iTotalBytesSent; |
|
134 this->iTotalBytesRecieved = rhs.iTotalBytesRecieved; |
|
135 return *this; |
|
136 } |
|
137 |
|
138 TSenDataTrafficDetails& operator+=(TSenDataTrafficDetails& rhs) |
|
139 { |
|
140 this->iTotalBytesSent += rhs.iTotalBytesSent; |
|
141 this->iTotalBytesRecieved += rhs.iTotalBytesRecieved; |
|
142 return *this; |
|
143 } |
|
144 |
|
145 TUint iTotalBytesSent ; |
|
146 TUint iTotalBytesRecieved ; |
|
147 private: |
|
148 TAny* iReserved; |
|
149 }; |
|
150 |
|
151 struct TSenDataTrafficOperations |
|
152 { |
|
153 public: |
|
154 TSenDataTrafficOperations(): iReset(EFalse) |
|
155 { |
|
156 } |
|
157 TBool iReset; |
|
158 private: |
|
159 TAny* iReserved; |
|
160 }; |
|
161 |
|
162 // CLASS DECLARATION |
|
163 |
|
164 /** |
|
165 * The class for connecting to service providers |
|
166 * through Web Services Framework (WSF). |
|
167 * |
|
168 * The class offers asynchronous construction of a |
|
169 * service connection. Further, there are asynchronous |
|
170 * and synchronous interaction methods for e.g. sending |
|
171 * and receiving data from (possibly remote) service. |
|
172 * |
|
173 * WSF offers two default frameworks: |
|
174 * |
|
175 * 1. Identity Based Web Services Framework |
|
176 * (ID-WSF). The framework ID for this is |
|
177 * KDefaultIdWsfFrameworkID ("ID-WSF"). |
|
178 * |
|
179 * 2. Basic Web Services Framework. Framework |
|
180 * ID is KDefaultBasicWebServicesFrameworkID |
|
181 * ("WS-I"). |
|
182 * |
|
183 * The most typical use of CSenServiceConnection |
|
184 * is to interact with a service of certain type |
|
185 * through some invocable framework and submitting |
|
186 * and receiving messages. |
|
187 * |
|
188 * In case of WebServices, the actual service is remote |
|
189 * and submitted messages are SOAP envelopes. However, |
|
190 * CSenServiceConnection supports accessing any |
|
191 * ServiceInvocationFramework which ECOM plug-in |
|
192 * implementation is present. These plug-ins may |
|
193 * further communicate with some service, including |
|
194 * local services. |
|
195 * |
|
196 * The link between CSenServiceConnection and any plug-in |
|
197 * implementation interacting with some service is the |
|
198 * framework ID, which is a property of ServiceDescription (SD) |
|
199 * and accessible via MSenServiceDescription interface, which |
|
200 * each SD class must implement. |
|
201 * |
|
202 * When creating a connection, one offers predefined SD as |
|
203 * an argument for asynchronous constructor. Or, optionally |
|
204 * only a Liberty Alliance ID-WSF specific contract string |
|
205 * - typically some URN. If only contract is offered, then |
|
206 * the created connection defaults to ID-WSF service and |
|
207 * ID-WSF framework (ID) will be used. |
|
208 * |
|
209 * The WSF further uses the offered framework ID while looking |
|
210 * up any matching framework plug-in implementation. As a |
|
211 * result the SD might be offered to several plug-ins. |
|
212 * |
|
213 * @lib SenServConn.lib |
|
214 * @since Series60 3.0 |
|
215 */ |
|
216 |
|
217 class CSenServiceConnection : public CActive, public MSenFragment |
|
218 { |
|
219 public: // Constructors and destructor |
|
220 |
|
221 /** |
|
222 * Two-phased constructor intended for Identity based service |
|
223 * consumers (like ID-WSF). The pointer is left on the cleanup stack. |
|
224 * This constructor is ASYNCHRONOUS and the actual state of |
|
225 * created connection has to be observed from SetStatus() AND |
|
226 * HandleErrorL() functions. |
|
227 * If service is found, the SetStatus() call-back is performed |
|
228 * with a status value KSenConnectionStatusReady (1). |
|
229 * Contract of the service (typically some URN) is provided. |
|
230 * Authentication for the Web Service Provider (WSP) connection |
|
231 * is resolved using one of the identity providers which have |
|
232 * been associated with this contract (typically an URN). |
|
233 * |
|
234 * This constructor is ASYNCHRONOUS and the actual state of newly |
|
235 * created connection has to be observed from SetStatus() AND |
|
236 * HandleErrorL() functions. |
|
237 * If service is found, a SetStatus call-back with value |
|
238 * KSenConnectionStatusReady (1) is executed. |
|
239 * If some error occurs, HandleErrorL() will be called to inform the |
|
240 * creator of this connection (service consumer application) |
|
241 * |
|
242 * For example, if service is not found, a system wide error |
|
243 * code of -1 is deliver via HandleErrorL() to WSC. |
|
244 * |
|
245 * Second example: server response HTTP 501 means, that this error |
|
246 * code. 501 will be delivered via HandleErrorL() to WSC. |
|
247 * This can happen in ID-WSF connection being initialized, if |
|
248 * either Authentication Service (AS) or Discovery Service (DS) |
|
249 * cannot be reached. |
|
250 * |
|
251 * @param aConsumer (web) service consumer (for call-backs) |
|
252 * @param aContract contract of the service, typically an URI. |
|
253 * @return a pointer to a CSenServiceConnection instance. |
|
254 * |
|
255 */ |
|
256 IMPORT_C static CSenServiceConnection* NewL(MSenServiceConsumer& aConsumer, |
|
257 const TDesC8& aContract); |
|
258 |
|
259 /** |
|
260 * Two-phased constructor intended for Identity based service |
|
261 * consumers (like ID-WSF). |
|
262 * This constructor is ASYNCHRONOUS and the actual state of |
|
263 * created connection has to be observed from SetStatus() and |
|
264 * HandleErrorL() functions. |
|
265 * If service is found, the SetStatus() call-back is performed |
|
266 * with a status value KSenConnectionStatusReady (1). |
|
267 * Contract of the service (typically some URN) is provided. |
|
268 * Authentication for the Web Service Provider (WSP) connection |
|
269 * is resolved using one of the identity providers which have |
|
270 * been associated with this contract (typically an URN). |
|
271 * This constructor is ASYNCHRONOUS and the actual state of newly |
|
272 * created connection has to be observed from SetStatus() AND |
|
273 * HandleErrorL() functions. |
|
274 * If service is found, a SetStatus call-back with value |
|
275 * KSenConnectionStatusReady (1) is executed. |
|
276 * If some error occurs, HandleErrorL() will be called to inform the |
|
277 * creator of this connection (service consumer application) |
|
278 * |
|
279 * For example, if service is not found, a system wide error |
|
280 * code of -1 is deliver via HandleErrorL() to WSC. |
|
281 * |
|
282 * Second example: server response HTTP 501 means, that this error |
|
283 * code. 501 will be delivered via HandleErrorL() to WSC. |
|
284 * This can happen in ID-WSF connection being initialized, if |
|
285 * either Authentication Service (AS) or Discovery Service (DS) |
|
286 * cannot be reached. |
|
287 * |
|
288 * @param aConsumer (web) service consumer (for call-backs) |
|
289 * @param aContract contract of the service, typically an URI. |
|
290 * @return a pointer to a CSenServiceConnection instance. |
|
291 * The pointer is left on the cleanup stack. |
|
292 */ |
|
293 IMPORT_C static CSenServiceConnection* NewLC(MSenServiceConsumer& aObserver, |
|
294 const TDesC8& aContract); |
|
295 |
|
296 /** |
|
297 * Two-phased constructor using a service description. |
|
298 * This constructor is ASYNCHRONOUS and the actual state of |
|
299 * created connection has to be observed from SetStatus() and |
|
300 * HandleErrorL() functions. |
|
301 * If service is found, the SetStatus() call-back is executed |
|
302 * with a status value KSenConnectionStatusReady (1) |
|
303 * For ID-WSF connections, the authentication for the Web Service |
|
304 * Provider (WSP) connection is resolved using one of the identity |
|
305 * providers which have been associated with the contract found in |
|
306 * the SD. At minimum, the contract of the service (typically some URN) |
|
307 * has to provided in the SD. |
|
308 * Basic Web Service consumers instantiate a SD where an endpoint |
|
309 * and framework ID KDefaultBasicWebServicesFrameworkID are defined. |
|
310 * @param aObserver connection observer. |
|
311 * @param aServiceDescription is the description used to |
|
312 * obtain a service connection. |
|
313 * @return a pointer to a CSenServiceConnection instance. |
|
314 */ |
|
315 IMPORT_C static CSenServiceConnection* NewL(MSenServiceConsumer& aObserver, |
|
316 MSenServiceDescription& aServiceDescription); |
|
317 |
|
318 /** |
|
319 * Two-phased constructor using a service description. The pointer |
|
320 * is left on the cleanup stack. |
|
321 * This constructor is ASYNCHRONOUS and the actual state of |
|
322 * created connection has to be observed from SetStatus() AND |
|
323 * HandleErrorL() functions. |
|
324 * If service is found, the SetStatus() call-back is executed |
|
325 * with a status value KSenConnectionStatusReady (1) |
|
326 * For ID-WSF connections, the authentication for the Web Service |
|
327 * Provider (WSP) connection is resolved using one of the identity |
|
328 * providers which have been associated with the contract found in |
|
329 * the SD. At minimum, the contract of the service (typically some URN) |
|
330 * has to provided in the SD. |
|
331 * Basic Web Service consumers instantiate a SD where an endpoint |
|
332 * and framework ID KDefaultBasicWebServicesFrameworkID are defined. |
|
333 * @param aObserver connection observer. |
|
334 * @param aServiceDescription is the description used to |
|
335 * obtain a service connection. |
|
336 * @return a pointer to a CSenServiceConnection instance. |
|
337 * The pointer is left on the cleanup stack. |
|
338 */ |
|
339 IMPORT_C static CSenServiceConnection* NewLC(MSenServiceConsumer& aObserver, |
|
340 MSenServiceDescription& aServiceDescription); |
|
341 |
|
342 /* |
|
343 * The ServicePattern version of two phased constructor. |
|
344 * Note, that this method is intended to be used by service consumers |
|
345 * wishing to initialize connection in specific context called |
|
346 * consumer policy. In consumer policy, certain properties |
|
347 * can be set to further define what kind of connection is acceptable |
|
348 * and how the connection interacts with transport (for example, which |
|
349 * Internet Access Point (IAP) will be used). |
|
350 * However, any ConsumerPolicy feature is applicable in |
|
351 * one-policy-per-client scope and not used as a common policy. |
|
352 * To set permanent information about known WSP, please use the |
|
353 * CSenXmlServiceDescription, which implements MSenProviderPolicy |
|
354 * interface. |
|
355 * This constructor is ASYNCHRONOUS and the actual state of |
|
356 * created connection has to be observed from SetStatus() and |
|
357 * HandleErrorL() functions. |
|
358 * If service is found, the SetStatus() call-back is executed |
|
359 * with a status value KSenConnectionStatusReady (1) |
|
360 * For ID-WSF connections, the authentication for the Web Service |
|
361 * Provider (WSP) connection is resolved using one of the identity |
|
362 * providers which have been associated with the contract found in |
|
363 * the SD. At minimum, the contract of the service (typically some URN) |
|
364 * has to provided in the SD. |
|
365 * Basic Web Service consumers instantiate a SD where an endpoint |
|
366 * and framework ID KDefaultBasicWebServicesFrameworkID are defined. |
|
367 * @param aObserver connection observer. |
|
368 * @param aServiceDescription is the description used to |
|
369 * obtain a service connection. |
|
370 * @return a pointer to a CSenServiceConnection instance. |
|
371 */ |
|
372 IMPORT_C static CSenServiceConnection* NewL(MSenServiceConsumer& aObserver, |
|
373 CSenServicePattern& aServicePattern); |
|
374 |
|
375 /* |
|
376 * The ServicePattern version of two phased constructor. |
|
377 * Note, that this method is intended to be used by service consumers |
|
378 * wishing to initialize connection in specific context called |
|
379 * consumer policy. In consumer policy, certain properties |
|
380 * can be set to further define what kind of connection is acceptable |
|
381 * and how the connection interacts with transport (for example, which |
|
382 * Internet Access Point (IAP) will be used). |
|
383 * However, any ConsumerPolicy feature is applicable in |
|
384 * one-policy-per-client scope and not used as a common policy. |
|
385 * To set permanent information about known WSP, please use the |
|
386 * CSenXmlServiceDescription, which implements MSenProviderPolicy |
|
387 * interface. |
|
388 * This constructor is ASYNCHRONOUS and the actual state of |
|
389 * created connection has to be observed from SetStatus() and |
|
390 * HandleErrorL() functions. |
|
391 * If service is found, the SetStatus() call-back is executed |
|
392 * with a status value KSenConnectionStatusReady (1) |
|
393 * For ID-WSF connections, the authentication for the Web Service |
|
394 * Provider (WSP) connection is resolved using one of the identity |
|
395 * providers which have been associated with the contract found in |
|
396 * the SD. At minimum, the contract of the service (typically some URN) |
|
397 * has to provided in the SD. |
|
398 * Basic Web Service consumers instantiate a SD where an endpoint |
|
399 * and framework ID KDefaultBasicWebServicesFrameworkID are defined. |
|
400 * @param aObserver connection observer. |
|
401 * @param aServiceDescription is the description used to |
|
402 * obtain a service connection. |
|
403 * @return a pointer to a CSenServiceConnection instance. |
|
404 * The pointer is left on the cleanup stack. |
|
405 */ |
|
406 IMPORT_C static CSenServiceConnection* NewLC(MSenServiceConsumer& aObserver, |
|
407 CSenServicePattern& aServicePattern); |
|
408 |
|
409 /** |
|
410 * Two-phased constructor intended for Identity based service |
|
411 * consumers (like ID-WSF). The pointer is left on the cleanup stack. |
|
412 * This constructor is ASYNCHRONOUS and the actual state of |
|
413 * created connection has to be observed from SetStatus() AND |
|
414 * HandleErrorL() functions. |
|
415 * If service is found, the SetStatus() call-back is performed |
|
416 * with a status value KSenConnectionStatusReady (1). |
|
417 * Contract of the service (typically some URN) is provided. |
|
418 * Authentication for the Web Service Provider (WSP) connection |
|
419 * is resolved using one of the identity providers which have |
|
420 * been associated with this contract (typically an URN). |
|
421 * |
|
422 * This constructor is ASYNCHRONOUS and the actual state of newly |
|
423 * created connection has to be observed from SetStatus() AND |
|
424 * HandleErrorL() functions. |
|
425 * If service is found, a SetStatus call-back with value |
|
426 * KSenConnectionStatusReady (1) is executed. |
|
427 * If some error occurs, HandleErrorL() will be called to inform the |
|
428 * creator of this connection (service consumer application) |
|
429 * |
|
430 * For example, if service is not found, a system wide error |
|
431 * code of -1 is deliver via HandleErrorL() to WSC. |
|
432 * |
|
433 * Second example: server response HTTP 501 means, that this error |
|
434 * code. 501 will be delivered via HandleErrorL() to WSC. |
|
435 * This can happen in ID-WSF connection being initialized, if |
|
436 * either Authentication Service (AS) or Discovery Service (DS) |
|
437 * cannot be reached. |
|
438 * |
|
439 * @param aConsumer (web) service consumer (for call-backs) |
|
440 * @param aContract contract of the service, typically an URI. |
|
441 * @return a pointer to a CSenServiceConnection instance. |
|
442 * @param aAuthProvider Authentication Provider |
|
443 */ |
|
444 IMPORT_C static CSenServiceConnection* NewL(MSenServiceConsumer& aConsumer, |
|
445 const TDesC8& aContract, |
|
446 MSenExtendedConsumerInterface& aExtendedConsumer); |
|
447 /** |
|
448 * Two-phased constructor intended for Identity based service |
|
449 * consumers (like ID-WSF). |
|
450 * This constructor is ASYNCHRONOUS and the actual state of |
|
451 * created connection has to be observed from SetStatus() and |
|
452 * HandleErrorL() functions. |
|
453 * If service is found, the SetStatus() call-back is performed |
|
454 * with a status value KSenConnectionStatusReady (1). |
|
455 * Contract of the service (typically some URN) is provided. |
|
456 * Authentication for the Web Service Provider (WSP) connection |
|
457 * is resolved using one of the identity providers which have |
|
458 * been associated with this contract (typically an URN). |
|
459 * This constructor is ASYNCHRONOUS and the actual state of newly |
|
460 * created connection has to be observed from SetStatus() AND |
|
461 * HandleErrorL() functions. |
|
462 * If service is found, a SetStatus call-back with value |
|
463 * KSenConnectionStatusReady (1) is executed. |
|
464 * If some error occurs, HandleErrorL() will be called to inform the |
|
465 * creator of this connection (service consumer application) |
|
466 * |
|
467 * For example, if service is not found, a system wide error |
|
468 * code of -1 is deliver via HandleErrorL() to WSC. |
|
469 * |
|
470 * Second example: server response HTTP 501 means, that this error |
|
471 * code. 501 will be delivered via HandleErrorL() to WSC. |
|
472 * This can happen in ID-WSF connection being initialized, if |
|
473 * either Authentication Service (AS) or Discovery Service (DS) |
|
474 * cannot be reached. |
|
475 * |
|
476 * @param aConsumer (web) service consumer (for call-backs) |
|
477 * @param aContract contract of the service, typically an URI. |
|
478 * @param aAuthProvider Authentication Provider |
|
479 * @return a pointer to a CSenServiceConnection instance. |
|
480 * The pointer is left on the cleanup stack. |
|
481 */ |
|
482 IMPORT_C static CSenServiceConnection* NewLC(MSenServiceConsumer& aConsumer, |
|
483 const TDesC8& aContract, |
|
484 MSenExtendedConsumerInterface& aExtendedConsumer); |
|
485 |
|
486 /** |
|
487 * Two-phased constructor using a service description. |
|
488 * This constructor is ASYNCHRONOUS and the actual state of |
|
489 * created connection has to be observed from SetStatus() and |
|
490 * HandleErrorL() functions. |
|
491 * If service is found, the SetStatus() call-back is executed |
|
492 * with a status value KSenConnectionStatusReady (1) |
|
493 * For ID-WSF connections, the authentication for the Web Service |
|
494 * Provider (WSP) connection is resolved using one of the identity |
|
495 * providers which have been associated with the contract found in |
|
496 * the SD. At minimum, the contract of the service (typically some URN) |
|
497 * has to provided in the SD. |
|
498 * Basic Web Service consumers instantiate a SD where an endpoint |
|
499 * and framework ID KDefaultBasicWebServicesFrameworkID are defined. |
|
500 * @param aConsumer connection observer. |
|
501 * @param aServiceDescription is the description used to |
|
502 * obtain a service connection. |
|
503 * @param aAuthProvider Authentication Provider |
|
504 * @return a pointer to a CSenServiceConnection instance. |
|
505 */ |
|
506 IMPORT_C static CSenServiceConnection* NewL(MSenServiceConsumer& aConsumer, |
|
507 MSenServiceDescription& aServiceDescription, |
|
508 MSenExtendedConsumerInterface& aExtendedConsumer); |
|
509 |
|
510 /** |
|
511 * Two-phased constructor using a service description. The pointer |
|
512 * is left on the cleanup stack. |
|
513 * This constructor is ASYNCHRONOUS and the actual state of |
|
514 * created connection has to be observed from SetStatus() AND |
|
515 * HandleErrorL() functions. |
|
516 * If service is found, the SetStatus() call-back is executed |
|
517 * with a status value KSenConnectionStatusReady (1) |
|
518 * For ID-WSF connections, the authentication for the Web Service |
|
519 * Provider (WSP) connection is resolved using one of the identity |
|
520 * providers which have been associated with the contract found in |
|
521 * the SD. At minimum, the contract of the service (typically some URN) |
|
522 * has to provided in the SD. |
|
523 * Basic Web Service consumers instantiate a SD where an endpoint |
|
524 * and framework ID KDefaultBasicWebServicesFrameworkID are defined. |
|
525 * @param aConsumer connection observer. |
|
526 * @param aServiceDescription is the description used to |
|
527 * obtain a service connection. |
|
528 * @param aAuthProvider Authentication Provider |
|
529 * @return a pointer to a CSenServiceConnection instance. |
|
530 * The pointer is left on the cleanup stack. |
|
531 */ |
|
532 IMPORT_C static CSenServiceConnection* NewLC(MSenServiceConsumer& aConsumer, |
|
533 MSenServiceDescription& aServiceDescription, |
|
534 MSenExtendedConsumerInterface& aExtendedConsumer); |
|
535 |
|
536 /* |
|
537 * The ServicePattern version of two phased constructor. |
|
538 * Note, that this method is intended to be used by service consumers |
|
539 * wishing to initialize connection in specific context called |
|
540 * consumer policy. In consumer policy, certain properties |
|
541 * can be set to further define what kind of connection is acceptable |
|
542 * and how the connection interacts with transport (for example, which |
|
543 * Internet Access Point (IAP) will be used). |
|
544 * However, any ConsumerPolicy feature is applicable in |
|
545 * one-policy-per-client scope and not used as a common policy. |
|
546 * To set permanent information about known WSP, please use the |
|
547 * CSenXmlServiceDescription, which implements MSenProviderPolicy |
|
548 * interface. |
|
549 * This constructor is ASYNCHRONOUS and the actual state of |
|
550 * created connection has to be observed from SetStatus() and |
|
551 * HandleErrorL() functions. |
|
552 * If service is found, the SetStatus() call-back is executed |
|
553 * with a status value KSenConnectionStatusReady (1) |
|
554 * For ID-WSF connections, the authentication for the Web Service |
|
555 * Provider (WSP) connection is resolved using one of the identity |
|
556 * providers which have been associated with the contract found in |
|
557 * the SD. At minimum, the contract of the service (typically some URN) |
|
558 * has to provided in the SD. |
|
559 * Basic Web Service consumers instantiate a SD where an endpoint |
|
560 * and framework ID KDefaultBasicWebServicesFrameworkID are defined. |
|
561 * @param aConsumer connection observer. |
|
562 * @param aServiceDescription is the description used to |
|
563 * obtain a service connection. |
|
564 * @param aAuthProvider Authentication Provider |
|
565 * @return a pointer to a CSenServiceConnection instance. |
|
566 */ |
|
567 IMPORT_C static CSenServiceConnection* NewL(MSenServiceConsumer& aConsumer, |
|
568 CSenServicePattern& aServicePattern, |
|
569 MSenExtendedConsumerInterface& aExtendedConsumer); |
|
570 |
|
571 /* |
|
572 * The ServicePattern version of two phased constructor. |
|
573 * Note, that this method is intended to be used by service consumers |
|
574 * wishing to initialize connection in specific context called |
|
575 * consumer policy. In consumer policy, certain properties |
|
576 * can be set to further define what kind of connection is acceptable |
|
577 * and how the connection interacts with transport (for example, which |
|
578 * Internet Access Point (IAP) will be used). |
|
579 * However, any ConsumerPolicy feature is applicable in |
|
580 * one-policy-per-client scope and not used as a common policy. |
|
581 * To set permanent information about known WSP, please use the |
|
582 * CSenXmlServiceDescription, which implements MSenProviderPolicy |
|
583 * interface. |
|
584 * This constructor is ASYNCHRONOUS and the actual state of |
|
585 * created connection has to be observed from SetStatus() and |
|
586 * HandleErrorL() functions. |
|
587 * If service is found, the SetStatus() call-back is executed |
|
588 * with a status value KSenConnectionStatusReady (1) |
|
589 * For ID-WSF connections, the authentication for the Web Service |
|
590 * Provider (WSP) connection is resolved using one of the identity |
|
591 * providers which have been associated with the contract found in |
|
592 * the SD. At minimum, the contract of the service (typically some URN) |
|
593 * has to provided in the SD. |
|
594 * Basic Web Service consumers instantiate a SD where an endpoint |
|
595 * and framework ID KDefaultBasicWebServicesFrameworkID are defined. |
|
596 * @param aConsumer connection observer. |
|
597 * @param aServiceDescription is the description used to |
|
598 * obtain a service connection. |
|
599 * @param aAuthProvider Authentication Provider |
|
600 * @return a pointer to a CSenServiceConnection instance. |
|
601 * The pointer is left on the cleanup stack. |
|
602 */ |
|
603 IMPORT_C static CSenServiceConnection* NewLC(MSenServiceConsumer& aConsumer, |
|
604 CSenServicePattern& aServicePattern, |
|
605 MSenExtendedConsumerInterface& aExtendedConsumer); |
|
606 |
|
607 // New functions |
|
608 |
|
609 /** |
|
610 * Send an ASYNCHRONOUS request to a service. |
|
611 * In ID-WSF, the request data is a SOAP Body. |
|
612 * Response message is received either via |
|
613 * HandleMessageL() or HandleErrorL() callback. |
|
614 * There are two default frameworks available - |
|
615 * the Identity Based Web Service Framework (which ID is "ID-WSF") |
|
616 * and the Basic Web Services Framework (which ID is "WS-I"). |
|
617 * Please note, that Basic Web Services framework does NOT support this method. |
|
618 * Instead, one should send complete SOAP envelopes using SendL(CSenSoapEnvelope&). |
|
619 * So, currently this method is supported only in ID-WSF. |
|
620 * @param aRequest outgoing request message. |
|
621 * @return Transaction ID (positive integer) or error code, if method fails. |
|
622 * Transaction ids: |
|
623 * Positive integers SendL returns transaction ID of the request, |
|
624 * which can be later on utilized inside |
|
625 * HandleMessageL and HandleErrorL methods, |
|
626 * in order to map request and its response |
|
627 * together. |
|
628 * Error codes: |
|
629 * KErrSenNotInitialized Connection has not been initialized. |
|
630 * KErrSenServiceConnectionBusy Connection is already busy with another |
|
631 * request. |
|
632 * KErrConnectionInitializing Connection is still initializing and |
|
633 * cannot yet process commands. |
|
634 * KErrConnectionExpired Credential for the connection is |
|
635 * expired and needs to be renewed. |
|
636 * This can be done by instantiating a new |
|
637 * ServiceConnection. |
|
638 * KErrSubmitting An error occurred |
|
639 * KErrNoMemory Not enough memory to process the message. |
|
640 * Other error codes are system-wide Symbian error codes. |
|
641 */ |
|
642 virtual TInt SendL(const TDesC8& aRequest) = 0; |
|
643 |
|
644 |
|
645 /** |
|
646 * Submit a synchronous request to a service |
|
647 * (in ID-WSF, the SOAP message Body) and receive a response as XML. |
|
648 * There are two default frameworks available - |
|
649 * the Identity Based Web Service Framework (which ID is "ID-WSF") |
|
650 * and the Basic Web Services Framework (which ID is "WS-I"). |
|
651 * Please note, that Basic Web Services framework does NOT support this method. |
|
652 * Instead, one must send complete SOAP envelopes using SubmitL(CSenSoapEnvelope&). |
|
653 * So, currently this method is supported only in ID-WSF. |
|
654 * @param aRequest outgoing request message. |
|
655 * @param aResponse the resolved response message. |
|
656 * The ownership of the aResponse is transfered to the caller. |
|
657 * The response is service specific part of the response. |
|
658 * For ID-WSF services response contents is the SOAP Body, or complete SOAP |
|
659 * envelope as XML, depending on the complete server messages on/off setting |
|
660 * (default is off). |
|
661 * @return status/error code. |
|
662 * Status codes: |
|
663 * KErrNone ok |
|
664 * Error codes: |
|
665 * KErrSenNotInitialized Connection has not been initialized. |
|
666 * KErrSenServiceConnectionBusy Connection is already busy with another request. |
|
667 * KErrConnectionInitializing Connection is still initializing and |
|
668 * cannot yet process commands. |
|
669 * KErrConnectionExpired Credential for the connection is |
|
670 * expired and needs to be renewed. |
|
671 * This can be done by instantiating a new |
|
672 * ServiceConnection. |
|
673 * KErrSubmitting An internal error occurred. |
|
674 * KErrSenInternal Internal state is invalid. |
|
675 * Other error codes are system-wide Symbian error codes. |
|
676 */ |
|
677 virtual TInt SubmitL(const TDesC8& aRequest, HBufC8*& aResponse) = 0; |
|
678 |
|
679 |
|
680 /** |
|
681 * Consumer application can use this method to check that |
|
682 * service connection is in ready state. |
|
683 * In ID-WSF, this means that WSF interprets that credentials |
|
684 * for the service connection are valid (not expired). |
|
685 * @param aReady indicates that the connection is ready to be used. |
|
686 * @return status/error code. |
|
687 * Status codes: |
|
688 * KErrNone ok |
|
689 * Error codes are system-wide Symbian error codes. |
|
690 */ |
|
691 virtual TInt IsReady(TBool& aReady) = 0; |
|
692 |
|
693 |
|
694 /** |
|
695 * Check if the underlying service connection has a certain characteristic |
|
696 * called a facet. |
|
697 * Currently, only ID-WSF framework supports facets. |
|
698 * For example, if consumer application is interested to resolve if |
|
699 * initialized service connection has a facet indicating that service |
|
700 * is free of charge (for e.g. "urn:framework.com.free:cost"), the |
|
701 * method used to check this would be: |
|
702 * _LIT8(KFacetOfFreeService, "urn:some.service.free:cost"); |
|
703 * int err = HasFacetL(KFacetOfFreeService, hasFacet); |
|
704 * |
|
705 * In the service session of initialed connection, this would be the form |
|
706 * of the facet element: |
|
707 * <Facet name="urn:framework.com.free:cost"/> |
|
708 * |
|
709 * If there is no facet in the service connection then the element is not |
|
710 * present. |
|
711 * @param aURI the name of the facet |
|
712 * @param aHasFacet will indicate if underlying service has a certain |
|
713 * characteristic. |
|
714 * @return status/error code. |
|
715 * Status codes: |
|
716 * KErrNone ok |
|
717 * Error codes: |
|
718 * KErrSenNotInitialized Connection has not been initialized. |
|
719 * KErrConnectionInitializing Connection is still initializing and |
|
720 * cannot yet process commands. |
|
721 * KErrConnectionExpired Connection is expired and needs to be |
|
722 * renewed. |
|
723 * KErrBadDescriptor The aUri parameter was an invalid |
|
724 * descriptor. |
|
725 * Other error codes are system-wide Symbian error codes. |
|
726 */ |
|
727 virtual TInt HasFacetL(const TDesC8& aURI, TBool& aHasFacet) = 0; |
|
728 |
|
729 |
|
730 /** |
|
731 * Consumer application can use this method to set flag which defines |
|
732 * whether or not the consumer wishes to receive complete SOAP envelope |
|
733 * from the service. |
|
734 * If complete server messages mode is off, then only the <Body> element |
|
735 * is received from the SOAP envelope, otherwise full SOAP envelope. |
|
736 * Note: Calling this function must not be done before connection is |
|
737 * initialized (the observer's SetStatus() has been called with value |
|
738 * KSenConnectionStatusReady). |
|
739 * Calling this function should be done before sending or submitting |
|
740 * anything. |
|
741 * @param aCompleteOnOff defines the content of HandleMessageL() callback. |
|
742 * If set to ETrue (ON), then complete SOAP envelopes are |
|
743 * received, including <Header> element. |
|
744 * If set to EFalse (OFF), only the service specific |
|
745 * content - SOAP envelope <Body> element - is received. |
|
746 * In WSF frameworks the default settings are: |
|
747 * 1. In ID-WSF, the complete server messages is OFF. |
|
748 * 2. In Basic Web Services, the default is ON. |
|
749 * @return status/error code. |
|
750 * Status codes: |
|
751 * KErrNone ok |
|
752 * Error codes: |
|
753 * KErrSenNotInitialized Connection has not been initialized. |
|
754 * KErrConnectionInitializing Connection is still initializing and |
|
755 * cannot yet process commands. |
|
756 * KErrConnectionExpired Connection is expired and needs to be |
|
757 * renewed. |
|
758 * Other error codes are system-wide Symbian error codes. |
|
759 */ |
|
760 virtual TInt CompleteServerMessagesOnOff(const TBool& aCompleteOnOff) = 0; |
|
761 |
|
762 |
|
763 /* |
|
764 * Sends a SOAP message to the service. The SOAP envelope may contain |
|
765 * proprietary headers. The system will augment the message with the |
|
766 * appropriate headers specified in the service invocation framework, |
|
767 * so a client application should add only non-standard headers; and |
|
768 * if it doesn't need to set such headers it is strongly recommended |
|
769 * to use SendL(TDesC8&), which is meant for that. |
|
770 * This is an asynchronous function, that returns immediately. |
|
771 * When the service responds, the SOAP envelope content will |
|
772 * be received via HandleMessageL() callback. In case of an |
|
773 * error - like a SOAP fault - HandleErrorL() will be called |
|
774 * with appropriate error code. |
|
775 * There are two default frameworks available - |
|
776 * the Identity Based Web Service Framework (which ID is "ID-WSF") |
|
777 * and the Basic Web Services Framework (which ID is "WS-I"). |
|
778 * Please note, that ID-WSF does NOT support this method. |
|
779 * Instead, one should send SOAP envelope Bodies using |
|
780 * SendL(const TDesC8&). |
|
781 * So, currently this method is supported only in Basic Web Services framework. |
|
782 * @param aMessage The service specific message - a full SOAP envelope |
|
783 * @return Transaction ID (positive integer) or error code, if method fails. |
|
784 * Transaction ids: |
|
785 * Positive integers SendL returns transaction ID of the request, |
|
786 * which can be later on utilized inside |
|
787 * HandleMessageL and HandleErrorL methods, |
|
788 * in order to map request and its response |
|
789 * together. |
|
790 * Error codes: |
|
791 * KErrSenNotInitialized Connection has not been initialized. |
|
792 * KErrSenServiceConnectionBusy Connection is already busy with another |
|
793 * request. |
|
794 * KErrConnectionInitializing Connection is still initializing and |
|
795 * cannot yet process commands. |
|
796 * KErrConnectionExpired Connection is expired and needs to be |
|
797 * renewed. |
|
798 * KErrSubmitting An internal error has occurred. |
|
799 * KErrNoMemory Not enough memory to process the |
|
800 * message. |
|
801 * Other error codes are system-wide Symbian error codes. |
|
802 */ |
|
803 virtual TInt SendL(CSenSoapEnvelope& aMessage) = 0; |
|
804 |
|
805 |
|
806 /* |
|
807 * Submits a SOAP message to the service. This is a synchronous call, |
|
808 * returning a SOAP envelope that was received from the service. |
|
809 * There are two default frameworks available: |
|
810 * the Identity Based Web Service Framework (which ID is "ID-WSF") |
|
811 * and the Basic Web Services Framework (which ID is "WS-I"). |
|
812 * Please note, that ID-WSF does NOT support this method. |
|
813 * Instead, one should send SOAP envelope Bodies using SendL(const TDesC8&). |
|
814 * So, currently this method is supported only in Basic Web Services framework. |
|
815 * @param aMessage SOAPEnvelope with the service specific message |
|
816 * without any framework wrapping |
|
817 * @param aResponseTo This is a ref-to-pointer where response |
|
818 * from the service will be allocated. If the |
|
819 * complete server messages mode is set to OFF, |
|
820 * then only <Body> element will be returned, |
|
821 * otherwise a complete SOAP envelope. |
|
822 * The ownership of aResponse is transfered to |
|
823 * the caller. |
|
824 * @return status/error code |
|
825 * Status codes: |
|
826 * KErrNone ok |
|
827 * Error codes: |
|
828 * KErrSenNotInitialized Connection has not been initialized. |
|
829 * KErrSenServiceConnectionBusy Connection is already busy with another |
|
830 * request. |
|
831 * KErrConnectionInitializing Connection is still initializing and |
|
832 * cannot yet process commands. |
|
833 * KErrConnectionExpired Connection is expired and needs to be |
|
834 * renewed. |
|
835 * KErrSubmitting An internal error has occurred. |
|
836 * KErrNoMemory Not enough memory to process the |
|
837 * message. |
|
838 * KErrSenInternal Internal state is invalid. |
|
839 * Other error codes are system-wide Symbian error codes. |
|
840 */ |
|
841 virtual TInt SubmitL(CSenSoapEnvelope& aMessage, HBufC8*& aResponseTo) = 0; |
|
842 |
|
843 |
|
844 /** |
|
845 * Gets service description of current connection. |
|
846 * @param aServiceDescription Contains the service description on return |
|
847 * @return status/error code. |
|
848 * Status codes: |
|
849 * KErrNone ok |
|
850 * Error codes: |
|
851 * KErrSenNotInitialized Connection has not been initialized. |
|
852 * KErrSenServiceConnectionBusy Connection is already busy with another |
|
853 * request. |
|
854 * KErrConnectionInitializing Connection is still initializing and |
|
855 * cannot yet process commands. |
|
856 * KErrConnectionExpired Connection is expired and needs to be |
|
857 * renewed. |
|
858 * KErrUnderFlow Server side returned invalid service |
|
859 * description. |
|
860 * KErrUnknown Client-Server request mismatch. |
|
861 * Other error codes are system-wide Symbian error codes. |
|
862 */ |
|
863 virtual TInt ServiceDescriptionL(HBufC8*& aServiceDescription) = 0; |
|
864 |
|
865 |
|
866 /** |
|
867 * Starts an application level transaction. The consumer may now start |
|
868 * to communicate with some service withing a chain of correlated messages. |
|
869 * When responding to a certain SOAP message inside a transaction, the last |
|
870 * received message ID is used as "refToMessageId". |
|
871 * From default frameworks, only ID-WSF supports transactions. |
|
872 * @return KErrNone if no errors occur. |
|
873 * Other error codes are system-wide Symbian error codes. |
|
874 */ |
|
875 virtual TInt StartTransaction() = 0; |
|
876 |
|
877 |
|
878 /** |
|
879 * Stops application level transaction by resetting the "refToMessageId". |
|
880 * After stopping a transaction the next message will have no |
|
881 * "refToMessageId" |
|
882 * @return KErrNone if no errors occur. |
|
883 * Other error codes are system-wide Symbian error codes. |
|
884 */ |
|
885 virtual TInt TransactionCompleted() = 0; |
|
886 |
|
887 |
|
888 /* |
|
889 * Returns the transasction ID of this message or error. Id is guaranteed |
|
890 * to return unique ID when called from inside HandleMessageL() or |
|
891 * HandleErrorL callback. This transasction ID may be used to map the |
|
892 * response with the preceedeing SendL() call (a request). |
|
893 * @return TInt transaction ID, or KErrNotFound, if no transaction is |
|
894 * on-going. |
|
895 */ |
|
896 virtual TInt TxnId() = 0; |
|
897 |
|
898 |
|
899 /** |
|
900 * Sets transport specific properties which apply as long as this connection |
|
901 * is alive (session). Furthermore, the properties are effective for this session |
|
902 * in cumulative manner: each property has unique key (name) which is associated |
|
903 * to the actual value of that property. When SetTransportPropertiesL method is |
|
904 * called multiple times - in sequence - the last value for each key overrides any |
|
905 * previous definitions. If any latter call introduces new keys (property names), |
|
906 * they are appended to the list of currently effective properties. |
|
907 * Also note, that it is also possible to set message specific properties when making |
|
908 * a SendL/SubmitL call. If such transport properties for message are provided, and |
|
909 * those include updates to some properties, the new ones are effective only for that |
|
910 * certain message, i.e. those are transaction specific. For any following message, |
|
911 * that is sent over a service connection, the session specific properties apply, |
|
912 * assuming that the new message does not (again) override some of the property values. |
|
913 * @param aProperties contains the transport properties in serialized (UTF-8) form. |
|
914 * With HTTP, this descriptor is typically created by utilizing CSenHttpProperties class. |
|
915 * @return KErrNone if successful or otherwise some system-wide error code. |
|
916 */ |
|
917 virtual TInt SetTransportPropertiesL(const TDesC8& aProperties) = 0; |
|
918 |
|
919 |
|
920 /* |
|
921 * Method returns currently effective transport properties as a serialized |
|
922 * descriptor. With HTTP, one may utilize CSenHttpProperities class in |
|
923 * order to read this data into properties object. Note that returned |
|
924 * list of properties also includes properties, which are defined as default |
|
925 * for certain transport in the webservice framework. |
|
926 */ |
|
927 virtual TInt TransportPropertiesL(HBufC8*& aProperties) = 0; |
|
928 |
|
929 |
|
930 /** |
|
931 * Send an ASYNCHRONOUS request to a service. |
|
932 * In ID-WSF, the request data is a SOAP Body. |
|
933 * Response message is received either via |
|
934 * HandleMessageL() or HandleErrorL() callback. |
|
935 * There are two default frameworks available - |
|
936 * the Identity Based Web Service Framework (which ID is "ID-WSF") |
|
937 * and the Basic Web Services Framework (which ID is "WS-I"). |
|
938 * Please note, that Basic Web Services framework does NOT support this method. |
|
939 * Instead, one should send complete SOAP envelopes using SendL(CSenSoapEnvelope&). |
|
940 * So, currently this method is supported only in ID-WSF. |
|
941 * @param aRequest outgoing request message. |
|
942 * @param aProperties contains transport spesific properties, serialized |
|
943 * into descriptor. With HTTP, one can create this by utilizing specialized |
|
944 * CSenHttpProperties class. |
|
945 * @return Transaction ID (positive integer) or error code, if method fails. |
|
946 * Transaction ids: |
|
947 * Positive integers SendL returns transaction ID of the request, |
|
948 * which can be later on utilized inside |
|
949 * HandleMessageL and HandleErrorL methods, |
|
950 * in order to map request and its response |
|
951 * together. |
|
952 * Error codes |
|
953 * KErrSenNotInitialized Connection has not been initialized. |
|
954 * KErrSenServiceConnectionBusy Connection is already busy with another |
|
955 * request. |
|
956 * KErrConnectionInitializing Connection is still initializing and |
|
957 * cannot yet process commands. |
|
958 * KErrConnectionExpired Credential for the connection is |
|
959 * expired and needs to be renewed. |
|
960 * This can be done by instantiating a new |
|
961 * ServiceConnection. |
|
962 * KErrSubmitting An error occurred |
|
963 * KErrNoMemory Not enough memory to process the message. |
|
964 * Other error codes are system-wide Symbian error codes. |
|
965 */ |
|
966 virtual TInt SendL(const TDesC8& aRequest, const TDesC8& aProperties) = 0; |
|
967 |
|
968 |
|
969 /** |
|
970 * Submit a request via SYNCHRONOUS call to a service |
|
971 * (in ID-WSF, the SOAP message Body) and receive a response as XML. |
|
972 * There are two default frameworks available - |
|
973 * the Identity Based Web Service Framework (which ID is "ID-WSF") |
|
974 * and the Basic Web Services Framework (which ID is "WS-I"). |
|
975 * Please note, that Basic Web Services framework does NOT support this method. |
|
976 * Instead, one must send complete SOAP envelopes using SubmitL(CSenSoapEnvelope&). |
|
977 * So, currently this method is supported only in ID-WSF. |
|
978 * @param aRequest outgoing request message. |
|
979 * @param aResponse the resolved response message. |
|
980 * The ownership of the aResponse is transfered to the caller. |
|
981 * The response is service specific part of the response. |
|
982 * For ID-WSF services response contents is the SOAP Body, or complete SOAP |
|
983 * envelope as XML, depending on the complete server messages on/off setting |
|
984 * (default is off). |
|
985 * @param aProperties contains transport spesific properties, serialized |
|
986 * into descriptor. With HTTP, one can create this by utilizing specialized |
|
987 * CSenHttpProperties class. |
|
988 * @return status/error code. |
|
989 * Status codes: |
|
990 * KErrNone ok |
|
991 * Error codes: |
|
992 * KErrSenNotInitialized Connection has not been initialized. |
|
993 * KErrSenServiceConnectionBusy Connection is already busy with another request. |
|
994 * KErrConnectionInitializing Connection is still initializing and |
|
995 * cannot yet process commands. |
|
996 * KErrConnectionExpired Credential for the connection is |
|
997 * expired and needs to be renewed. |
|
998 * This can be done by instantiating a new |
|
999 * ServiceConnection. |
|
1000 * KErrSubmitting An internal error occurred. |
|
1001 * KErrSenInternal Internal state is invalid. |
|
1002 * Other error codes are system-wide Symbian error codes. |
|
1003 */ |
|
1004 virtual TInt SubmitL(const TDesC8& aRequest, const TDesC8& aProperties, HBufC8*& aResponse) = 0; |
|
1005 |
|
1006 |
|
1007 /* |
|
1008 * Sends a SOAP message to the service. The SOAP envelope may contain |
|
1009 * proprietary headers. The system will augment the message with the |
|
1010 * appropriate headers specified in the service invocation framework, |
|
1011 * so a client application should add only non-standard headers; and |
|
1012 * if it doesn't need to set such headers it is strongly recommended |
|
1013 * to use SendL(TDesC8&), which is meant for this. |
|
1014 * This is an asynchronous function, that returns immediately. |
|
1015 * When the service responds, the SOAP envelope content will |
|
1016 * be received via HandleMessageL() callback. In case of an |
|
1017 * error - like a SOAP fault - HandleErrorL() will be called |
|
1018 * with appropriate error code. |
|
1019 * There are two default frameworks available - |
|
1020 * the Identity Based Web Service Framework (which ID is "ID-WSF") |
|
1021 * and the Basic Web Services Framework (which ID is "WS-I"). |
|
1022 * Please note, that ID-WSF does NOT support this method. |
|
1023 * Instead, one should send SOAP envelope Bodies using |
|
1024 * SendL(const TDesC8&). |
|
1025 * So, currently this method is supported only in Basic Web Services framework. |
|
1026 * |
|
1027 * NOTE: |
|
1028 * Message is send as serialized XML or Soap message to SendL |
|
1029 * aProperties could be "HTTP GET" or "HTTP DELETE" |
|
1030 * HTTP GET or HTTP DELETE transport property has been enabled via CSenHttpTransportProperties. |
|
1031 * This scenario is not supported |
|
1032 * |
|
1033 * @param aMessage The service specific message - a full SOAP envelope |
|
1034 * @param aProperties contains transport spesific properties, serialized |
|
1035 * into descriptor. With HTTP, one can create this by utilizing specialized |
|
1036 * CSenHttpProperties class. |
|
1037 * @return Transaction ID (positive integer) or error code, if method fails. |
|
1038 * Transaction ids: |
|
1039 * Positive integers SendL returns transaction ID of the request, |
|
1040 * which can be later on utilized inside |
|
1041 * HandleMessageL and HandleErrorL methods, |
|
1042 * in order to map request and its response |
|
1043 * together. |
|
1044 * Error codes: |
|
1045 * KErrSenNotInitialized Connection has not been initialized. |
|
1046 * KErrSenServiceConnectionBusy Connection is already busy with another |
|
1047 * request. |
|
1048 * KErrConnectionInitializing Connection is still initializing and |
|
1049 * cannot yet process commands. |
|
1050 * KErrConnectionExpired Connection is expired and needs to be |
|
1051 * renewed. |
|
1052 * KErrSubmitting An internal error has occurred. |
|
1053 * KErrNoMemory Not enough memory to process the |
|
1054 * message. |
|
1055 * KErrNotSupported HTTP GET or HTTP DELETE is enabled |
|
1056 * Other error codes are system-wide Symbian error codes. |
|
1057 */ |
|
1058 virtual TInt SendL(CSenSoapEnvelope& aMessage, const TDesC8& aProperties) = 0; |
|
1059 |
|
1060 /* |
|
1061 * Submits a SOAP message to the service. This is a synchronous call, |
|
1062 * returning a SOAP envelope that was received from the service. |
|
1063 * There are two default frameworks available: |
|
1064 * the Identity Based Web Service Framework (which ID is "ID-WSF") |
|
1065 * and the Basic Web Services Framework (which ID is "WS-I"). |
|
1066 * Please note, that ID-WSF does NOT support this method. |
|
1067 * Instead, one should send SOAP envelope Bodies using SendL(const TDesC8&). |
|
1068 * So, currently this method is supported only in Basic Web Services framework. |
|
1069 * |
|
1070 * NOTE: |
|
1071 * Message is send as serialized XML or Soap message to SubmitL |
|
1072 * aProperties could be "HTTP GET" or "HTTP DELETE" |
|
1073 * HTTP GET or HTTP DELETE transport property has been enabled via CSenHttpTransportProperties. |
|
1074 * This scenario is not supported |
|
1075 * |
|
1076 * @param aMessage SOAPEnvelope with the service specific message |
|
1077 * without any framework wrapping |
|
1078 * @param aProperties contains transport spesific properties, serialized |
|
1079 * into descriptor. With HTTP, one can create this by utilizing specialized |
|
1080 * CSenHttpProperties class. |
|
1081 * @param aResponseTo This is a ref-to-pointer where response |
|
1082 * from the service will be allocated. If the |
|
1083 * complete server messages mode is set to OFF, |
|
1084 * then only <Body> element will be returned, |
|
1085 * otherwise a complete SOAP envelope. |
|
1086 * The ownership of aResponse is transfered to |
|
1087 * the caller. |
|
1088 * @return status/error code |
|
1089 * Status codes: |
|
1090 * KErrNone ok |
|
1091 * Error codes: |
|
1092 * KErrSenNotInitialized Connection has not been initialized. |
|
1093 * KErrSenServiceConnectionBusy Connection is already busy with another |
|
1094 * request. |
|
1095 * KErrConnectionInitializing Connection is still initializing and |
|
1096 * cannot yet process commands. |
|
1097 * KErrConnectionExpired Connection is expired and needs to be |
|
1098 * renewed. |
|
1099 * KErrSubmitting An internal error has occurred. |
|
1100 * KErrNoMemory Not enough memory to process the |
|
1101 * message. |
|
1102 * KErrSenInternal Internal state is invalid. |
|
1103 * KErrNotSupported HTTP GET or HTTP DELETE is enabled |
|
1104 * Other error codes are system-wide Symbian error codes. |
|
1105 */ |
|
1106 virtual TInt SubmitL(CSenSoapEnvelope& aMessage, const TDesC8& aProperties, HBufC8*& aResponseTo) = 0; |
|
1107 |
|
1108 /* |
|
1109 * Sends a SOAP message to the service. The SOAP envelope may contain |
|
1110 * proprietary headers. The system will augment the message with the |
|
1111 * appropriate headers specified in the service invocation framework, |
|
1112 * so a client application should add only non-standard headers. |
|
1113 * This is an asynchronous function, that returns immediately. |
|
1114 * When the service responds, the SOAP envelope content will |
|
1115 * be received via HandleMessageL() callback. In case of an |
|
1116 * error - like a SOAP fault - HandleErrorL() will be called |
|
1117 * with appropriate error code. |
|
1118 * There are two default frameworks available - |
|
1119 * the Identity Based Web Service Framework (which ID is "ID-WSF") |
|
1120 * and the Basic Web Services Framework (which ID is "WS-I"). |
|
1121 * Please note, that ID-WSF does NOT support this method. |
|
1122 * Instead, one should send SOAP envelope Bodies using |
|
1123 * SendL(const TDesC8&). |
|
1124 * So, currently this method is supported only in Basic Web Services framework. |
|
1125 * |
|
1126 * @param aMessage The service specific message - a full SOAP envelope |
|
1127 * @return Transaction ID (positive integer) or error code, if method fails. |
|
1128 * Transaction ids: |
|
1129 * Positive integers SendL returns transaction ID of the request, |
|
1130 * which can be later on utilized inside |
|
1131 * HandleMessageL and HandleErrorL methods, |
|
1132 * in order to map request and its response |
|
1133 * together. |
|
1134 * Error codes: |
|
1135 * KErrSenNotInitialized Connection has not been initialized. |
|
1136 * KErrSenServiceConnectionBusy Connection is already busy with another |
|
1137 * request. |
|
1138 * KErrConnectionInitializing Connection is still initializing and |
|
1139 * cannot yet process commands. |
|
1140 * KErrConnectionExpired Connection is expired and needs to be |
|
1141 * renewed. |
|
1142 * KErrSubmitting An internal error has occurred. |
|
1143 * KErrNoMemory Not enough memory to process the |
|
1144 * message. |
|
1145 * KErrNotSupported HTTP GET or HTTP DELETE is enabled |
|
1146 * Other error codes are system-wide Symbian error codes. |
|
1147 */ |
|
1148 virtual TInt SendL(MSenMessage& aMessage) = 0; |
|
1149 |
|
1150 /* |
|
1151 * Submits a SOAP message to the service. This is a synchronous call, |
|
1152 * returning a SOAP envelope that was received from the service. |
|
1153 * There are two default frameworks available: |
|
1154 * the Identity Based Web Service Framework (which ID is "ID-WSF") |
|
1155 * and the Basic Web Services Framework (which ID is "WS-I"). |
|
1156 * Please note, that ID-WSF does NOT support this method. |
|
1157 * Instead, one should send SOAP envelope Bodies using SendL(const TDesC8&). |
|
1158 * So, currently this method is supported only in Basic Web Services framework. |
|
1159 * |
|
1160 * @param aMessage SOAPEnvelope with the service specific message |
|
1161 * without any framework wrapping |
|
1162 * @param aResponseTo This is a ref-to-pointer where response |
|
1163 * from the service will be allocated. If the |
|
1164 * complete server messages mode is set to OFF, |
|
1165 * then only <Body> element will be returned, |
|
1166 * otherwise a complete SOAP envelope. |
|
1167 * The ownership of aResponse is transfered to |
|
1168 * the caller. |
|
1169 * @return status/error code |
|
1170 * Status codes: |
|
1171 * KErrNone ok |
|
1172 * Error codes: |
|
1173 * KErrSenNotInitialized Connection has not been initialized. |
|
1174 * KErrSenServiceConnectionBusy Connection is already busy with another |
|
1175 * request. |
|
1176 * KErrConnectionInitializing Connection is still initializing and |
|
1177 * cannot yet process commands. |
|
1178 * KErrConnectionExpired Connection is expired and needs to be |
|
1179 * renewed. |
|
1180 * KErrSubmitting An internal error has occurred. |
|
1181 * KErrNoMemory Not enough memory to process the |
|
1182 * message. |
|
1183 * KErrSenInternal Internal state is invalid. |
|
1184 * KErrNotSupported HTTP GET or HTTP DELETE is enabled |
|
1185 * Other error codes are system-wide Symbian error codes. |
|
1186 */ |
|
1187 virtual TInt SubmitL(MSenMessage& aMessage, CSenSoapEnvelope2*& aResponseTo) = 0; |
|
1188 |
|
1189 /** |
|
1190 * Getter for currently active transaction (service response) that is |
|
1191 * being handled by the service consumer. |
|
1192 * @return a pointer to currently active transaction (service response). |
|
1193 * It is guarenteed, that the method returns a pointer to |
|
1194 * transaction only when called inside HandleMessageL or |
|
1195 * HandleErrorL callback methods of MSenServiceConsumer, |
|
1196 * otherwise it will return NULL. |
|
1197 */ |
|
1198 virtual MSenMessage* Response() = 0; |
|
1199 |
|
1200 /** |
|
1201 * Cancels any active request, if pending transaction |
|
1202 * (txn) can be found with given txn ID. |
|
1203 * @param aTransactionID is the transaction ID to be cancelled. This id has earlier been |
|
1204 * acquired from a call to some of the asynchronous SendL variants. |
|
1205 |
|
1206 * @return KErrNone on success |
|
1207 * KErrNotFound, if there is no pending transaction (active request), |
|
1208 * or some of the system-wide error codes otheriwise. |
|
1209 */ |
|
1210 virtual TInt CancelTransaction(TInt aTransactionID) = 0; |
|
1211 |
|
1212 /** |
|
1213 * Getter for the identity provider (XML) service description. |
|
1214 * @param apIdentityProvider will point to a new IDP instance, |
|
1215 * if such is associated with this connection (and this connection |
|
1216 * was ready before calling this method), or NULL otherwise. |
|
1217 * @return KErrNone if IDP description can be found, or some |
|
1218 * of the system wide error code otherwise. |
|
1219 */ |
|
1220 virtual TInt IdentityProviderL(CSenIdentityProvider*& apIdentityProvider) = 0; |
|
1221 |
|
1222 /** |
|
1223 * Getter for the identifier of this connection. |
|
1224 * @return the identifier as integer. |
|
1225 */ |
|
1226 virtual TInt Identifier() = 0; |
|
1227 |
|
1228 /** |
|
1229 * Registers observer of BLOBs transfer progress. |
|
1230 * |
|
1231 * @param aFilesObserver Implementation of transfer progress observer. |
|
1232 */ |
|
1233 |
|
1234 virtual void DataTrafficDetails(TSenDataTrafficDetails& aDetails, |
|
1235 TSenDataTrafficOperations& aOperations) = 0; |
|
1236 |
|
1237 /** |
|
1238 * Service Consumer can call this method to acquire a new interface, |
|
1239 * which is identified by unique ID (UID). |
|
1240 * @param aUID is the UID of the interface being requested |
|
1241 * @return TAny* pointer to the interface, or if no interface to |
|
1242 * given UID exists, function returns NULL. In typical cases, returned |
|
1243 * pointer should be cast to some preknown M-class pointer (the actual |
|
1244 * new interface). |
|
1245 * |
|
1246 * List of currently supported interfaces: |
|
1247 * KSenInterfaceUidAlrServiceConnection => MSenAlrServiceConnection |
|
1248 */ |
|
1249 virtual TAny* InterfaceByUid( TUid aUID ) = 0; |
|
1250 |
|
1251 /* |
|
1252 * Sends a RFile Handle to the service. |
|
1253 * the Identity Based Web Service Framework (which ID is "ID-WSF") |
|
1254 * and the Basic Web Services Framework (which ID is "WS-I"). |
|
1255 * Please note, that ID-WSF does NOT support this method. |
|
1256 * SendL(const TDesC8&). |
|
1257 * So, currently this method is supported only in Basic Web Services framework. |
|
1258 * @param aMessage The service specific message - a full SOAP envelope |
|
1259 * @return Transaction ID (positive integer) or error code, if method fails. |
|
1260 * Transaction ids: |
|
1261 * Positive integers SendL returns transaction ID of the request, |
|
1262 * which can be later on utilized inside |
|
1263 * HandleMessageL and HandleErrorL methods, |
|
1264 * in order to map request and its response |
|
1265 * together. |
|
1266 * Error codes: |
|
1267 * KErrSenNotInitialized Connection has not been initialized. |
|
1268 * KErrArgument RFile handle is NULL ( Specified file doesnot exist) |
|
1269 * KErrSenServiceConnectionBusy Connection is already busy with another |
|
1270 * request. |
|
1271 * KErrConnectionInitializing Connection is still initializing and |
|
1272 * cannot yet process commands. |
|
1273 * KErrConnectionExpired Connection is expired and needs to be |
|
1274 * renewed. |
|
1275 * KErrSubmitting An internal error has occurred. |
|
1276 * KErrNoMemory Not enough memory to process the |
|
1277 * message. |
|
1278 * Other error codes are system-wide Symbian error codes. |
|
1279 */ |
|
1280 virtual TInt SendL(RFile& aFileHandle) = 0; |
|
1281 |
|
1282 /* |
|
1283 * Submits a RFile Handle to the service. This is a synchronous call, |
|
1284 * returning a SOAP envelope that was received from the service. |
|
1285 * There are two default frameworks available: |
|
1286 * @param aResponseTo This is a ref-to-pointer where response |
|
1287 * from the service will be allocated. If the |
|
1288 * complete server messages mode is set to OFF, |
|
1289 * then only <Body> element will be returned, |
|
1290 * otherwise a complete SOAP envelope. |
|
1291 * The ownership of aResponse is transfered to |
|
1292 * the caller. |
|
1293 * @return status/error code |
|
1294 * Status codes: |
|
1295 * KErrNone ok |
|
1296 * Error codes: |
|
1297 * KErrSenNotInitialized Connection has not been initialized. |
|
1298 * KErrSenServiceConnectionBusy Connection is already busy with another |
|
1299 * request. |
|
1300 * KErrConnectionInitializing Connection is still initializing and |
|
1301 * cannot yet process commands. |
|
1302 * KErrConnectionExpired Connection is expired and needs to be |
|
1303 * renewed. |
|
1304 * KErrSubmitting An internal error has occurred. |
|
1305 * KErrNoMemory Not enough memory to process the |
|
1306 * message. |
|
1307 * KErrArgument RFile handle is NULL ( Specified file doesnot exist) |
|
1308 * KErrSenInternal Internal state is invalid. |
|
1309 * Other error codes are system-wide Symbian error codes. |
|
1310 */ |
|
1311 virtual TInt SubmitL(RFile& aFileHandle, HBufC8*& aResponseTo) = 0; |
|
1312 |
|
1313 protected: |
|
1314 |
|
1315 /** |
|
1316 * C++ default constructor. |
|
1317 */ |
|
1318 CSenServiceConnection(); |
|
1319 |
|
1320 }; |
|
1321 |
|
1322 #endif //SEN_SERVICE_CONNECTION_H |
|
1323 |
|
1324 // End of File |
|
1325 |