webservices/wsibasicplugin/src/senbasicwebservicesession.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 
       
    26 
       
    27 
       
    28 // INCLUDE FILES
       
    29 #include "senbasicwebservicesession.h"
       
    30 #include "SenHttpTransportProperties.h" // could be system included (ADO task)
       
    31 #include "senservicesession.h"
       
    32 #include "SenSoapMessage.h"
       
    33 #include "SenSoapConstants.h"           // KSenSoapActionHeaderName
       
    34 #include "senwsdescription.h"
       
    35 #include "msencoreservicemanager.h"
       
    36 #include "msenremoteserviceconsumer.h"
       
    37 #include "SenXmlUtils.h"
       
    38 #include "SenDateUtils.h"
       
    39 #include "msentransport.h"
       
    40 #include "SenServiceConnection.h"
       
    41 #include "sendebug.h"
       
    42 #include "senlogger.h"
       
    43 #include <SenSoapFault.h>
       
    44 
       
    45 
       
    46 CSenBasicWebServiceSession* CSenBasicWebServiceSession::NewL(MSIF& aFramework)
       
    47     {
       
    48     CSenBasicWebServiceSession* pNew =
       
    49         CSenBasicWebServiceSession::NewLC(aFramework);
       
    50     CleanupStack::Pop();
       
    51     return pNew;
       
    52     }
       
    53 
       
    54 CSenBasicWebServiceSession* CSenBasicWebServiceSession::NewLC(MSIF& aFramework)
       
    55     {
       
    56     CSenBasicWebServiceSession* pNew =
       
    57         new (ELeave) CSenBasicWebServiceSession(EBasicWebServiceSession,
       
    58                                                 aFramework);
       
    59     CleanupStack::PushL(pNew);
       
    60     // bugfix 2004-09-08,
       
    61     // removed faulty call to CSenServiceSession::BaseConstructL
       
    62     pNew->ConstructL();
       
    63     return pNew;
       
    64     }
       
    65 
       
    66 CSenBasicWebServiceSession::CSenBasicWebServiceSession(
       
    67                                         TDescriptionClassType aType,
       
    68                                         MSIF& aFramework)
       
    69 :
       
    70 CSenWebServiceSession(aType, aFramework)
       
    71     {
       
    72     }
       
    73 
       
    74 void CSenBasicWebServiceSession::ConstructL()
       
    75     {
       
    76     // Sets the local name to "ServiceDescription" and initiates the inner ipElement
       
    77     CSenWebServiceSession::ConstructL();
       
    78     }
       
    79 
       
    80 CSenBasicWebServiceSession::~CSenBasicWebServiceSession()
       
    81     {
       
    82     }
       
    83 
       
    84 // Override compute status to make BWS sessions to be ALWAYS valid (ready)
       
    85 TInt CSenBasicWebServiceSession::ComputeStatusL()
       
    86     {
       
    87     // session is ready, if an endpoint is defined
       
    88     return CSenServiceSession::ComputeStatusL();
       
    89     }
       
    90     
       
    91 TInt CSenBasicWebServiceSession::InitializeFromL(MSenServiceDescription& aServiceDescription)
       
    92     {
       
    93     TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("CSenWebServiceSession::InitializeFromL")));
       
    94     
       
    95     // Call superclass method to initialize facets, transport (endpoint) cue, etc..
       
    96 	TInt retVal = CSenWebServiceSession::InitializeFromL(aServiceDescription);
       
    97     CSenWSDescription& xmlSD = (CSenWSDescription&)aServiceDescription;
       
    98     TPtrC8 transportCue = xmlSD.TransportCue();
       
    99     if( transportCue.Length() > 0 )
       
   100         {
       
   101         SetTransportCueL( transportCue );
       
   102         }
       
   103 	return retVal;
       
   104     }
       
   105     
       
   106 
       
   107 TInt CSenBasicWebServiceSession::SubmitSoapL( const TDesC8& aSoapMessage, 
       
   108                                               const TDesC8& aTransportProperties,
       
   109                                               MSenRemoteServiceConsumer& aConsumer,
       
   110                                               HBufC8*& aResponse )
       
   111     {
       
   112     CSLOG_L(aConsumer.ConnectionId()  , KMinLogLevel,"CSenWsiPlugin::RegisterServiceDescriptionL");
       
   113     CSLOG_L(aConsumer.ConnectionId() , KMinLogLevel,"CSenBasicWebServiceSession::SubmitSoapL(TDesC8&)");
       
   114 	TPtrC8 endpoint = Endpoint();
       
   115 #ifdef _SENDEBUG
       
   116     CSLOG_L(aConsumer.ConnectionId() , KMaxLogLevel,"///////////////////////////////////////////////////////");
       
   117     CSLOG_FORMAT((aConsumer.ConnectionId()  , KMinLogLevel, _L8("- Endpoint: %S"), &endpoint));
       
   118 	CSLOG_FORMAT((aConsumer.ConnectionId()  , KMaxLogLevel, _L8("- Message (%d bytes):"), aSoapMessage.Length()));
       
   119     CSLOG_ALL(aConsumer.ConnectionId() , KMaxLogLevel,( aSoapMessage ));
       
   120     CSLOG_L(aConsumer.ConnectionId() , KMaxLogLevel,"///////////////////////////////////////////////////////");
       
   121 #endif
       
   122 
       
   123     MSenTransport& transport = aConsumer.TransportL();
       
   124     SetFrameworkPropertiesL( transport );
       
   125     TInt retVal = transport.SubmitL( endpoint, aSoapMessage, aTransportProperties, aResponse, aConsumer);
       
   126     
       
   127     if(!aResponse)
       
   128         {
       
   129         // response was NULL: probably either out
       
   130         // of heap or some transport malfunction.
       
   131         return retVal;
       
   132         }
       
   133     else if(aResponse->Length() < KSenSoapEnvelopeName().Length()*2)
       
   134         {
       
   135         // no use parsing, Envelope -root element not there
       
   136         // deliver non-soap body to consumer
       
   137         return retVal;
       
   138         }
       
   139 
       
   140     CleanupStack::PushL(aResponse);
       
   141 
       
   142     CSenSoapMessage* pResponseSoapMsg = NULL;
       
   143     TInt leaveCode(KErrNone);
       
   144 
       
   145     // attempt to parse the response
       
   146     // here. SOAP faults are to be
       
   147     // searched after,
       
   148 
       
   149     TInt parseRetCode(KErrNone);
       
   150     TRAP( leaveCode, (parseRetCode =
       
   151         ParseResponseL(*aResponse, pResponseSoapMsg)) );
       
   152 
       
   153     if(leaveCode!=KErrNone)
       
   154         {
       
   155         // THE RESPONSE could not be parsed
       
   156         delete pResponseSoapMsg;
       
   157 
       
   158         // THE RESPONSE IS NOT SOAP
       
   159         if(retVal==KErrNone)
       
   160             {
       
   161             // indicate with return value, that response is
       
   162             // invalid - even though submit was ok, the
       
   163             // response could NOT be parsed!
       
   164             retVal = leaveCode;
       
   165             }
       
   166         CSLOG_L(aConsumer.ConnectionId() , KMinLogLevel,"(NOK) Response is not a SOAP message");
       
   167         }
       
   168     else
       
   169         {
       
   170 
       
   171         if (parseRetCode != KErrNone)
       
   172             {
       
   173             CSLOG_FORMAT((aConsumer.ConnectionId()  , KMinLogLevel, _L8("(NOK) Parsing SOAP msg failed (%d)"),
       
   174                     parseRetCode));
       
   175 
       
   176             if(retVal==KErrNone) // submit was ok
       
   177                 {
       
   178                 // indicate with return value, that response is
       
   179                 // invalid - even though submit was ok, the
       
   180                 // response could NOT be parsed!
       
   181                 retVal = parseRetCode;
       
   182                 }
       
   183 
       
   184             // THE RESPONSE could not be parsed
       
   185             delete pResponseSoapMsg;
       
   186             }
       
   187         else
       
   188             {
       
   189             CSLOG_L(aConsumer.ConnectionId() , KMinLogLevel,"WS-I: (OK) Response is a SOAP message");
       
   190             CleanupStack::PushL(pResponseSoapMsg);
       
   191 
       
   192             TBool completeServerMessages(ETrue);
       
   193             HasFacetL(KCompleteMessagesFacet, completeServerMessages);
       
   194 
       
   195             // response is OK and in SOAP form.
       
   196 			if(pResponseSoapMsg)
       
   197 				{
       
   198 				if (pResponseSoapMsg->IsFault())
       
   199 					{
       
   200 					// response is SOAP fault
       
   201 					CSLOG_L(aConsumer.ConnectionId() , KMinLogLevel,"WS-I: Response is a SOAP fault.");
       
   202 					retVal = KErrSenSoapFault;
       
   203 
       
   204                 if (!completeServerMessages)
       
   205                     {
       
   206                     CleanupStack::Pop(pResponseSoapMsg);
       
   207                     // try to detach the SOAP fault
       
   208                     HBufC8* pDetached = NULL;
       
   209                     retVal = HandleSoapFaultL(pResponseSoapMsg, pDetached);
       
   210                     if(retVal == KErrSenSoapFault || retVal == KErrNone)
       
   211                         {
       
   212                         // KErrNone means that original fault was handled
       
   213                         // properly and we now have the wanted result 
       
   214                         // and consumer may receive it (message body)
       
   215 
       
   216                         // Note: currently we don't handle any SOAP faults
       
   217                         // in WebServiceSession class, so KErrNone should
       
   218                         // not be returned. The OR clause (||) here is 
       
   219                         // only for future extensions.
       
   220                         delete aResponse;
       
   221                         aResponse = NULL;
       
   222                         aResponse = pDetached;
       
   223                         pDetached = NULL;
       
   224                         }
       
   225                     else if(retVal == KErrNotFound)
       
   226                         {
       
   227 
       
   228                         // SOAP fault element  could not be found
       
   229                         CSLOG_L(aConsumer.ConnectionId() , KMinLogLevel,"WS-I: Major; SOAP fault element not found \
       
   230                                     even though assumed SOAP fault.");
       
   231                         retVal = KErrSenInternal;
       
   232                         }
       
   233 
       
   234 						}
       
   235 					else
       
   236 						{
       
   237 						CleanupStack::PopAndDestroy(pResponseSoapMsg);
       
   238 						}
       
   239 					}
       
   240 				else
       
   241 					{
       
   242 					// Check complete server messages on/off
       
   243 					if (!completeServerMessages)
       
   244 						{
       
   245 						HBufC8* pBody = pResponseSoapMsg->BodyAsStringL();
       
   246 						if(pBody)
       
   247 							{
       
   248 							delete aResponse;
       
   249 							aResponse = NULL;
       
   250 							aResponse = pBody;
       
   251 							pBody = NULL;
       
   252 							CSLOG_L(aConsumer.ConnectionId() , KNormalLogLevel,"- Detached SOAP message body.");
       
   253 							}
       
   254 						}
       
   255 					CleanupStack::PopAndDestroy(pResponseSoapMsg);
       
   256 					}
       
   257 				}
       
   258 			}
       
   259 		}
       
   260 #ifdef _SENDEBUG
       
   261     if(aResponse)
       
   262         {
       
   263         CleanupStack::PushL(aResponse);
       
   264         CSLOG_L(aConsumer.ConnectionId() , KNormalLogLevel,"- Detached SOAP message body.");
       
   265         CSLOG_L(aConsumer.ConnectionId() , KMinLogLevel,"CSenBasicWebServiceSession::SubmitSoapL:");
       
   266         CSLOG_FORMAT((aConsumer.ConnectionId()  , KNormalLogLevel, _L8("- Response (%d bytes):"), 
       
   267             aResponse->Length()));
       
   268         CSLOG_ALL(aConsumer.ConnectionId() , KMaxLogLevel,(*aResponse));
       
   269         CSLOG_L(aConsumer.ConnectionId() , KMaxLogLevel,"--------------------------------------------------");
       
   270         CleanupStack::Pop(); // aResponse
       
   271         }
       
   272 #endif
       
   273     CleanupStack::Pop(); // aResponse
       
   274     return retVal;
       
   275     }
       
   276 
       
   277 TInt CSenBasicWebServiceSession::SendSoapL( const TDesC8& aSoapMessage, 
       
   278                                             const TDesC8& aTransportProperties,
       
   279                                             MSenRemoteServiceConsumer& aConsumer,
       
   280                                             TInt& aTxnId,
       
   281                                             HBufC8*& /*aRevalidationError*/ ) 
       
   282     {
       
   283 	TPtrC8 endpoint = Endpoint();
       
   284 #ifdef _SENDEBUG
       
   285     CSLOG_L(aConsumer.ConnectionId() , KMaxLogLevel,"///////////////////////////////////////////////////////");
       
   286     CSLOG_L(aConsumer.ConnectionId() , KMinLogLevel,"CSenBasicWebServiceSession::SendSoapL:");
       
   287     CSLOG_L(aConsumer.ConnectionId() , KMinLogLevel,"- Endpoint:");
       
   288 	TLSLOG(aConsumer.ConnectionId()  , KMinLogLevel,( endpoint ));
       
   289 	CSLOG_FORMAT((aConsumer.ConnectionId()  , KMaxLogLevel, _L8("- Message (%d bytes):"), aSoapMessage.Length()));
       
   290     CSLOG_ALL(aConsumer.ConnectionId() , KMaxLogLevel,(aSoapMessage));
       
   291     CSLOG_L(aConsumer.ConnectionId() , KMaxLogLevel,"///////////////////////////////////////////////////////");
       
   292 #endif
       
   293     MSenTransport& transport = aConsumer.TransportL();
       
   294     SetFrameworkPropertiesL( transport );
       
   295     TInt retVal = transport.SendL( endpoint, 
       
   296                                    aSoapMessage, 
       
   297                                    aTransportProperties, 
       
   298                                    *this, 
       
   299                                    aConsumer, 
       
   300                                    aTxnId );
       
   301     CSLOG_FORMAT((aConsumer.ConnectionId()  , KNormalLogLevel, _L8("- Transaction id: %d"), aTxnId));
       
   302     return retVal;
       
   303     }
       
   304     
       
   305 TInt CSenBasicWebServiceSession::HttpMethodFromPropertiesL( const TDesC8& aProperties,
       
   306                                                             CSenHttpTransportProperties::TSenHttpMethod& aMethod )
       
   307     {
       
   308     TInt retVal(KErrNotFound);
       
   309     if ( aProperties.Length() > 0 && aProperties.Find(KHttpMethodLocalName)!= KErrNotFound && 
       
   310         (aProperties.Find(KHttpGet)!= KErrNotFound || aProperties.Find(KHttpDelete)!= KErrNotFound) ) 
       
   311         {
       
   312         // Properties strings are found, now use CSenHttpProperties instance to validate that HTTP
       
   313         // method really is either HTTP GET or HTTP DELETE:
       
   314         CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); // push tp
       
   315         
       
   316         // Parse aProperties into HTTP transport properties object:
       
   317         TInt leaveCode( KErrNone );
       
   318         TRAP( leaveCode, pHttpProperties->ReadFromL( aProperties ); )
       
   319         if ( leaveCode == KErrNone )
       
   320             {
       
   321             CSenHttpTransportProperties::TSenHttpMethod method;
       
   322             retVal = pHttpProperties->HttpMethodL( method );
       
   323             if ( retVal == KErrNone )
       
   324                 {
       
   325                 aMethod = method;
       
   326                 }
       
   327 #ifdef _SENDEBUG            
       
   328             else 
       
   329                 {
       
   330                 // HttpMethodL failed:
       
   331                 TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase  , KMinLogLevel, _L8("- HttpMethodL call failed. Error code: (%d)"), retVal));
       
   332                 }
       
   333 #endif // _SENDEBUG            
       
   334             }
       
   335 #ifdef _SENDEBUG            
       
   336         else 
       
   337             {
       
   338             // ReadFromL leaved:
       
   339             TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase  , KMinLogLevel, _L8("- Reading (parsing) of HTTP properties failed. Leave code: (%d)"), leaveCode));
       
   340             
       
   341             }
       
   342 #endif // _SENDEBUG            
       
   343         CleanupStack::PopAndDestroy( pHttpProperties ); // de-alloc tp
       
   344         }
       
   345     return retVal;
       
   346     }
       
   347     
       
   348     
       
   349 
       
   350 /*
       
   351 * @param aMessage contains request which is parsed into a SoapEnvelope object using
       
   352 *                 CSenWebServiceSession::MessageForSendingL and then SendSoapL is called  
       
   353 */
       
   354 TInt CSenBasicWebServiceSession::SendL( const TDesC8& aMessage, 
       
   355                                         const TDesC8& aTransportProperties,
       
   356                                         MSenRemoteServiceConsumer& aConsumer,
       
   357                                         TInt& aTxnId,
       
   358                                         HBufC8*& aRevalidationError )
       
   359     {
       
   360     CSLOG_L(aConsumer.ConnectionId() , KMinLogLevel,"CSenBasicWebServiceSession::SendL(TDesC8&, ...)");
       
   361 #ifdef _SENDEBUG
       
   362     CSLOG_L(aConsumer.ConnectionId() , KMaxLogLevel,"///////////////////////////////////////////////////////");
       
   363 	TPtrC8 endpoint = Endpoint();
       
   364 	CSLOG_FORMAT((aConsumer.ConnectionId()  , KMinLogLevel, _L8("- Endpoint: %S"), &endpoint));
       
   365 	CSLOG_FORMAT((aConsumer.ConnectionId()  , KMaxLogLevel, _L8("- Message (%d bytes):"), aMessage.Length()));
       
   366     CSLOG_ALL(aConsumer.ConnectionId() , KMaxLogLevel,( aMessage ));
       
   367     CSLOG_L(aConsumer.ConnectionId() , KMaxLogLevel,"///////////////////////////////////////////////////////");
       
   368 #endif
       
   369     TInt retVal(KErrNone);
       
   370 
       
   371     // First check if HTTP GET or DELETE has been spesified via transport properties:
       
   372     // -- in such case, the raw descriptor should be sent "as it is", without wrapping
       
   373     // it inside SOAP Body. This way WS-I can support HTTP GET and DELETE and still
       
   374     // validate that response(s) are SOAP (unlike REST, which does no response validation).
       
   375 
       
   376     CSenHttpTransportProperties::TSenHttpMethod httpMethod;
       
   377     TInt readHttpMethodRetVal = HttpMethodFromPropertiesL( aTransportProperties, httpMethod );
       
   378 
       
   379     if ( readHttpMethodRetVal == KErrNone && 
       
   380          httpMethod == CSenHttpTransportProperties::ESenHttpGet || 
       
   381          httpMethod == CSenHttpTransportProperties::ESenHttpDelete )
       
   382         {
       
   383         // Perform direct call to service session (and not to web service session!)
       
   384         retVal = CSenServiceSession::SendL( aMessage, aTransportProperties, aConsumer, aTxnId, aRevalidationError);
       
   385         }
       
   386     else
       
   387         {
       
   388         // The request data (UTF-8 descriptor) is expected to be serialized content
       
   389         // for SOAP Body and HTTP GET/DELETE is not taking place. 
       
   390         // Proceed in standard way and parse the request with SOAP-ENV:
       
   391     	CSenSoapMessage* pMsg = NULL;
       
   392         retVal = CSenWebServiceSession::MessageForSendingL( aMessage, aConsumer.Id(), pMsg );
       
   393         CleanupStack::PushL( pMsg );
       
   394         if ( retVal!=KErrNone )
       
   395             {
       
   396             CSLOG_FORMAT((aConsumer.ConnectionId()  , KMinLogLevel, _L8("- MessageForSendingL returned an error: %d"), retVal));
       
   397             CleanupStack::PopAndDestroy( pMsg );
       
   398             }
       
   399         else // no error
       
   400             {
       
   401             HBufC8* pSoapMsg = pMsg->AsXmlL();
       
   402             CleanupStack::PopAndDestroy( pMsg ); 
       
   403             CleanupStack::PushL( pSoapMsg ); 
       
   404             retVal = SendSoapL( *pSoapMsg, aTransportProperties, aConsumer, aTxnId, aRevalidationError);
       
   405             CleanupStack::PopAndDestroy( pSoapMsg );
       
   406             }
       
   407         }
       
   408     return retVal;
       
   409     }
       
   410 
       
   411 /*
       
   412 * aMessage contains request which is parsed into a SoapEnvelope object using
       
   413 * CSenWebServiceSession::MessageForSendingL and then SubmitSoapL is called  
       
   414 */
       
   415 TInt CSenBasicWebServiceSession::SubmitL( const TDesC8&  aMessage, 
       
   416                                           const TDesC8&  aTransportProperties ,
       
   417                                           MSenRemoteServiceConsumer&  aConsumer ,
       
   418                                           HBufC8*& aResponse )
       
   419     {
       
   420     CSLOG_L(aConsumer.ConnectionId() , KMinLogLevel,"CSenBasicWebServiceSession::SubmitL(TDesC8&, ...)");
       
   421 #ifdef _SENDEBUG
       
   422     CSLOG_L(aConsumer.ConnectionId() , KMaxLogLevel,"///////////////////////////////////////////////////////");
       
   423 	TPtrC8 endpoint = Endpoint();
       
   424 	CSLOG_FORMAT((aConsumer.ConnectionId()  , KMinLogLevel, _L8("- Endpoint: %S"), &endpoint));
       
   425 	CSLOG_FORMAT((aConsumer.ConnectionId()  , KMaxLogLevel, _L8("- Message (%d bytes) about to submit:"), aMessage.Length()));
       
   426 	CSLOG_ALL(aConsumer.ConnectionId() , KMaxLogLevel,( aMessage ));
       
   427 	CSLOG_L(aConsumer.ConnectionId() , KMaxLogLevel,"///////////////////////////////////////////////////////");
       
   428 #endif
       
   429     TInt retVal(KErrNone);
       
   430     CSenHttpTransportProperties::TSenHttpMethod httpMethod;
       
   431     TInt readHttpMethodRetVal = HttpMethodFromPropertiesL( aTransportProperties, httpMethod );
       
   432 
       
   433     if ( readHttpMethodRetVal == KErrNone && 
       
   434          httpMethod == CSenHttpTransportProperties::ESenHttpGet || 
       
   435          httpMethod == CSenHttpTransportProperties::ESenHttpDelete )
       
   436         {
       
   437         // Perform direct call to service session (and not to web service session!)
       
   438         retVal = CSenServiceSession::SubmitL( aMessage, aTransportProperties, aConsumer, aResponse);
       
   439         }
       
   440     else
       
   441         {
       
   442         CSenSoapMessage* pMsg = NULL;
       
   443         retVal = CSenWebServiceSession::MessageForSendingL( aMessage, aConsumer.Id(), pMsg );
       
   444         CleanupStack::PushL(pMsg);
       
   445         if ( retVal!=KErrNone )
       
   446             {
       
   447             CSLOG_FORMAT((aConsumer.ConnectionId()  , KMinLogLevel, _L8("- MessageForSendingL returned an error: %d"), retVal));
       
   448             CleanupStack::PopAndDestroy( pMsg );
       
   449             }
       
   450         else // no error
       
   451             {
       
   452             HBufC8* pSoapMsg = pMsg->AsXmlL();
       
   453             CleanupStack::PopAndDestroy( pMsg ); // de-alloc SOAP object after de-serialization
       
   454             CleanupStack::PushL( pSoapMsg );
       
   455             retVal = SubmitSoapL( *pSoapMsg, aTransportProperties, aConsumer, aResponse );
       
   456             CleanupStack::PopAndDestroy( pSoapMsg );
       
   457             }
       
   458         }
       
   459 	return retVal; 
       
   460    }
       
   461 
       
   462 
       
   463 TBool CSenBasicWebServiceSession::HasSuperClass( TDescriptionClassType aType )
       
   464     {
       
   465     if( aType == MSenServiceDescription::EWebServiceSession ) // direct superclass!
       
   466         {
       
   467         // If asked type is the know *direct* father/mother, return true:
       
   468         return ETrue; 
       
   469         } 
       
   470     else
       
   471         { 
       
   472         // Otherwise, ask from direct superclass (may invoke chain of recursive calls)
       
   473         return CSenWebServiceSession::HasSuperClass( aType ); 
       
   474         }
       
   475     }
       
   476 
       
   477 
       
   478 // TEMPORARY: remove when "message context"- and "transport factory taking 
       
   479 // properties from all layers"- tasks are ready
       
   480 TInt CSenBasicWebServiceSession::SetFrameworkPropertiesL(MSenTransport& aTransport)
       
   481     {
       
   482     return iFramework.SetTransportPropertiesL(aTransport);
       
   483     }
       
   484 TInt CSenBasicWebServiceSession::HandleSoapFaultL(CSenSoapMessage* apSOAPMessage,
       
   485                                             const TInt aErrorCode,
       
   486                                             const TInt aTxnId,
       
   487                                             MSenRemoteServiceConsumer& aConsumer,
       
   488                                             MSenProperties* aResponseTransportProperties)
       
   489 	{
       
   490     LOG_WRITE_L("CSenBasicWebServiceSession::HandleSoapFaultL ");
       
   491 
       
   492     TInt retVal(KErrNone);
       
   493     
       
   494     if ( apSOAPMessage )
       
   495         {
       
   496         	CleanupStack::PushL( apSOAPMessage ); 
       
   497 	        CSenSoapFault* pDetached = apSOAPMessage->DetachFaultL();
       
   498 	        if(pDetached)
       
   499 	            {
       
   500 	            LOG_WRITE_L("Detached a SOAP fault");
       
   501 	            CleanupStack::PushL(pDetached);
       
   502 	            HBufC8* pAsXml = pDetached->AsXmlL();
       
   503 	            if(pAsXml)
       
   504 	                {
       
   505 	                aConsumer.HandleErrorL(pAsXml, KErrSenSoapFault, aTxnId, aResponseTransportProperties);
       
   506 	                }
       
   507 	            CleanupStack::PopAndDestroy();
       
   508 	            retVal = KErrNone; 
       
   509 	            }
       
   510 	        else
       
   511 	            {
       
   512 	            LOG_WRITE_L("No SOAP fault was received.");
       
   513 	            aConsumer.HandleErrorL(NULL, aErrorCode, aTxnId, aResponseTransportProperties);
       
   514 	            retVal = KErrSenInternal;
       
   515 	            }
       
   516 	   		CleanupStack::PopAndDestroy( apSOAPMessage ); 
       
   517         }
       
   518 		
       
   519 		
       
   520                 
       
   521     return retVal;
       
   522     }
       
   523 TInt CSenBasicWebServiceSession::HandleSoapFaultL(CSenSoapMessage* apSOAPMessage,
       
   524                                             HBufC8*& aResponse)
       
   525 {
       
   526 	return(CSenWebServiceSession::HandleSoapFaultL(apSOAPMessage,aResponse));
       
   527 }
       
   528 
       
   529 //  End of File