webservices/wsframework/inc/msenservicesession.h
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:        Non-public callback interface, which transports typically call
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #ifndef M_SEN_SERVICE_SESSION
       
    26 #define M_SEN_SERVICE_SESSION
       
    27 
       
    28 
       
    29 /**
       
    30  * RServiceSession is a non-public remote interface
       
    31  * only implemented by the CSenServiceSession class. 
       
    32  * These methods are typically invoked by transport
       
    33  * instancies.
       
    34  *
       
    35  * Interface equals with com.nokia.serene.framework.RServiceSession
       
    36  * 
       
    37  * @see CSenServiceSession and Jave ref-implementation
       
    38  * in com.nokia.serene.framework.ServiceSession (2005)
       
    39  */
       
    40 
       
    41  
       
    42 
       
    43 // FORWARD DECLARES
       
    44 class MSenRemoteServiceConsumer;
       
    45 class MSenRemoteHostlet;
       
    46 class MSenProperties;
       
    47 
       
    48 // CLASS DECLARATION
       
    49 class MSenServiceSession
       
    50     {
       
    51     public:
       
    52         /**
       
    53         * Send a message with transaction ID to the service consumer.
       
    54         * This method allows session implementation to perform internal
       
    55         * mechanisms prior handing the response to the actual, already
       
    56         * known consumer (MSenRemoteServiceConsumer).
       
    57         *
       
    58         * Session implementation might decide, that certain messages are
       
    59         * not delivered to consumer(s). Or, the session may validate the
       
    60         * received message and actually decide sending an error to the
       
    61         * consumer.
       
    62         * 
       
    63         * @see sendToConsumer in com.nokia.serene.framework.RServiceSession
       
    64         *
       
    65         * @param aMessage is the response message from service
       
    66         * @param aTxnId is the transaction id of this async responsed message
       
    67         * @param aConsumer is the consumer of the service. It could
       
    68         * be CSenClientSession or some subclass of CSenInternalConsumer
       
    69         * (like in Liberty ID-WSF it could be authentication service client
       
    70         * or discovery service client).
       
    71         * @param aResponseTransportProperties contains the properties related
       
    72         * to this response (from the transport plug-in).
       
    73         * @return KErrNone if message was successfully delivered to consumer(s).
       
    74         *         Otherwise, some system-wide error code.
       
    75         */
       
    76         virtual TInt SendToConsumerL(HBufC8* apMessage,
       
    77                                      const TInt aTxnId,
       
    78                                      MSenRemoteServiceConsumer& aConsumer,
       
    79                                      MSenProperties* aResponseTransportProperties = NULL) = 0; 
       
    80 
       
    81         /**
       
    82         * Send an error code and message with transaction ID to the service 
       
    83         * consumer. This method allows session implementation to perform 
       
    84         * internal mechanisms prior handing the response to the actual, 
       
    85         * already known consumer (MSenRemoteServiceConsumer).
       
    86         *
       
    87         * Session implementation might decide, that certain errors are handled
       
    88         * without notifying the consumer(s).
       
    89         *
       
    90         * @see sendFaultToConsumer in com.nokia.serene.framework.RServiceSession
       
    91         *
       
    92         * @param aErrorCode is the error code identifying this error
       
    93         * @param aError is the error message - a response from service
       
    94         * @param aConsumer is the consumer of the service. It could
       
    95         * be CSenClientSession or some subclass of CSenInternalConsumer
       
    96         * (like in Liberty ID-WSF it could be authentication service client
       
    97         * or discovery service client).
       
    98         * @param aTxnId is the transaction id of this async responsed error.
       
    99         * @return KErrNone if error message was successfully delivered to 
       
   100         *         consumer(s). Otherwise, some system-wide error code.
       
   101         */
       
   102         virtual TInt SendErrorToConsumerL(const TInt aErrorCode,
       
   103                                           HBufC8* apError,
       
   104                                           const TInt aTxnId,
       
   105                                           MSenRemoteServiceConsumer& aConsumer,
       
   106                                           MSenProperties* aResponseTransportProperties = NULL) = 0; 
       
   107 
       
   108 
       
   109         /**
       
   110         * Method allows sessions of service invocation framework to recover
       
   111         * from certain errors (like certain SOAP faults) which can be recognized
       
   112         * at (low) transport layer. This way these faults could be  processed 
       
   113         * silently between service and its session, without disturbing the 
       
   114         * actual service consumer.
       
   115         *  
       
   116         * Since this type of errors (or faults) usually consists of XML,
       
   117         * a spesific error class can also be created to parse received
       
   118         * error.
       
   119         *
       
   120         * @see Java ref-implementation: handleFault in 
       
   121         *  com.nokia.serene.framework.RServiceSession
       
   122         *
       
   123         * @param aErrorCode is the error code identifying this error
       
   124         * @param aError is the error message - actual response from service
       
   125         * @param aTxnId is the transaction id of this async responsed error.
       
   126         * @param aConsumer is the consumer of the service. It could
       
   127         * be CSenClientSession or some subclass of CSenInternalConsumer
       
   128         * (like in Liberty ID-WSF it could be authentication service client
       
   129         * or discovery service client).
       
   130         * @param aResponseTransportProperties contains the properties related
       
   131         * to this response (from the transport plug-in).
       
   132         * @return KErrNone if error message was successfully delivered to 
       
   133         *         consumer(s). Otherwise, some system-wide error code.
       
   134         */
       
   135         virtual TInt HandleErrorL(const TInt aErrorCode,
       
   136                                   HBufC8* aError,
       
   137                                   const TInt aTxnId,
       
   138                                   MSenRemoteServiceConsumer& aConsumer,
       
   139                                   MSenProperties* aResponseTransportProperties = NULL) = 0; 
       
   140 
       
   141         /**
       
   142         * Returns the currently set hostlet 
       
   143         * @return MSenRemoteHostlet pointer or NULL, if this session
       
   144         * does not interact with hostlet (local service provider 
       
   145         * application).
       
   146         */
       
   147         virtual MSenRemoteHostlet* Hostlet() const = 0;
       
   148 
       
   149                       
       
   150        /*
       
   151         * @param aReceiver is the hostlet to which the message should be delivered
       
   152         * @param aMessage is the request from service a service consumer. 
       
   153         * SIF spesific service session implementation(s) may read or manipulate this
       
   154         * message by before handling it over to the hostlet (application).
       
   155         * @param aFrom is the consumer of the service, which is sending
       
   156         * the message.
       
   157         * @param aTxnId is the transaction id of this async message
       
   158         * @return KErrNone if message was successfully delivered to consumer(s).
       
   159         *         Otherwise, some system-wide error code.
       
   160         */             
       
   161         virtual TInt SendToHostletL(MSenRemoteHostlet& aReceiver,
       
   162                                     const TDesC8& aMessage,
       
   163                                     const TInt aTxnId,
       
   164                                     MSenRemoteServiceConsumer& aFrom,
       
   165                                     MSenProperties* aProperties = NULL) = 0; 
       
   166                                                                        
       
   167     };
       
   168 #endif // M_SEN_SERVICE_SESSION