MSenHostlet Class Reference

#include <mw/MSenHostlet.h>

Link against: SenHostConn.lib

class MSenHostlet
Public Member Functions
pure virtual TPtrC8 Contract()
virtual voidDescribeServiceL(CSenXmlServiceDescription &)
pure virtual TPtrC8 Endpoint()
virtual TPtrC8 FrameworkId()
virtual TAny *GetInterfaceByUid(TUid)
virtual voidOnServiceCompleteL(TInt, TInt, const TDesC8 &)
pure virtual TInt ServiceL(MSenHostletRequest &, MSenHostletResponse &)

Member Function Documentation

Contract ( )

TPtrC8 Contract()const [pure virtual]

Defines the service constract URI for this hostlet Note: Hostlets, which don't provide endpoint and don't have UID3, cannot create hostlet connection: instead, CSenHostletConnection constructor will leave with the following error code: KErrSenNoContractNoEndPoint

Returns: the URI identifier for the provided service, for example "urn:liberty:id-sis-pp:2003-08". Note that there might be multiple hostlets (local service providers) which all share common service type, that is, they all have same service contract URI.

DescribeServiceL ( CSenXmlServiceDescription & )

voidDescribeServiceL(CSenXmlServiceDescription &aSD)[inline, virtual]

Each Hostlet implementation may further describes its service via this callback. It is mandatory for each hostlet to define either endpoint or contract. Otherwise, the constuctor of CSenHostletConnection will leave with the following error code: KErrSenNoContractNoEndPoint - neither endpoint or contract was specified. This is illegal, since the service would lack an identifier.

ParameterDescription
aSDis the service description into which this hostlet may further define other service specific information, like facets. Note that this call back is "stronger" than Endpoint() and Contract(), and thus any value specified in this method will be in effect for the hostlet connection.

Endpoint ( )

TPtrC8 Endpoint()const [pure virtual]

Defines the service endpoint for this hostlet Note: Hostlets, which don't provide endpoint and don't have UID3, cannot create hostlet connection: instead, CSenHostletConnection constructor will leave with the following code: KErrSenNoContractNoEndPoint

If endpoint is not specified, hostlet connection itself will generate an endpoint from applications secure ID (UID3) if such is available, and consumers can invoke the service via the provided contract ("service type" identifier).

Returns: endpoint that this hostlet has specified. If hostlet implementation does not wish to define any endpoint, but to use contract only, it should return KNullDesC8 (zero-length descriptor). In such case, CSenHostletConnection constructor will attempt to resolve secure identifier (UID3) of the application, and use that to generate a locally unique endpoint. If the UID3 is not available, then the constructor of CSenHostletConnection will leave with the following error code: KErrSenNoContractNoEndPoint

FrameworkId ( )

TPtrC8 FrameworkId()const [inline, virtual]

Defines the framework for this hostlet.

Returns: the framework ID. Default inline implementation returns RESTful service invocation framework ID, KDefaultRestServicesFrameworkID, as defined in SenServiceConnection.h

GetInterfaceByUid ( TUid )

TAny *GetInterfaceByUid(TUid)[inline, virtual]

Hostlet connection calls this method several times, passing a different UID per each call. If application wants to provide particular interface to hostlet connection (web services stack), it needs to return a pointer to such M-class as a return value of this method. For any interface, that application has not implemented, it is supposed to return NULL.

Returns: value should be a valid (void) pointer to any interface implemented by the application. NULL signalizes that application does not provide interface for give UID.

OnServiceCompleteL ( TInt, TInt, const TDesC8 & )

voidOnServiceCompleteL(TInt,
TInt,
const TDesC8 &
)[inline, virtual]

This callback function is invoked each time when any hostlet connection's asynchronous RespondL is completed. Method can be used to trigger the release of some response releated system resources, as it is invoked after the response has been delivered to the consumer (application may wish to close handles to reserved file or memory).

ServiceL ( MSenHostletRequest &, MSenHostletResponse & )

TInt ServiceL(MSenHostletRequest &aRequest,
MSenHostletResponse &aResponse
)[pure virtual]

Main method for receiving incoming messages, which are typically SOAP / XML, and for providing service for these requests.

ParameterDescription
aResponseis where response data is to be set. CSenHostletConnection::ResponsdL should be called in order to send the response back to the requester (service consumer).