webservices/wsframework/inc/senwsdescription.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:        Class implements the most common value object used in WSF,
       
    15 *                which is used to  describe some invocable service.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 #ifndef SEN_WS_DESCRIPTION_H
       
    27 #define SEN_WS_DESCRIPTION_H
       
    28 
       
    29 //  INCLUDES
       
    30 #include "SenXmlServiceDescription.h"
       
    31 
       
    32 /*
       
    33 *  @lib SenServDesc.lib
       
    34 *  @since Series60 3.0
       
    35 */
       
    36 class CSenWSDescription : public CSenXmlServiceDescription
       
    37     {
       
    38     public:  // Constructors and destructor
       
    39 
       
    40         /**
       
    41         * Standard 2 phase constructor
       
    42         * @return a pointer to a new CSenWSDescription instance.
       
    43         */
       
    44         IMPORT_C static CSenWSDescription* NewL();
       
    45 
       
    46         /**
       
    47         * Standard 2 phase constructor
       
    48         * @return a pointer to a new CSenWSDescription instance,
       
    49         *        which is left on cleanup stack.
       
    50         */
       
    51         IMPORT_C static CSenWSDescription* NewLC();
       
    52 
       
    53         /**
       
    54         * Standard 2 phase constructor
       
    55         * @param aNamespaceURI namespace URI for the service description.
       
    56         * @return a pointer to a new CSenWSDescription instance
       
    57         */
       
    58         IMPORT_C static CSenWSDescription* NewL(const TDesC8& aNamespaceURI);
       
    59 
       
    60         /**
       
    61         * Standard 2 phase constructor
       
    62         * @param aNamespaceURI namespace URI for the service description.
       
    63         * @return a pointer to a new CSenWSDescription instance,
       
    64         *        which is left on cleanup stack.
       
    65         */
       
    66         IMPORT_C static CSenWSDescription* NewLC(const TDesC8& aNamespaceURI);
       
    67 
       
    68         /**
       
    69         * Standard 2 phase constructors
       
    70         * @param aEndpoint the service endpoint. Note that endpoint cannot
       
    71         *        include characters which are illegal in XML. If endpoint
       
    72         *        is an URL which contains illegal characters (like '&'-char),
       
    73         *        those need to be encoded into XML entity form (like &).
       
    74         *        EncodeHttpCharactersLC() method from XmlUtils can be used
       
    75         *        for encoding of basic XML entities.
       
    76         * @param aContract identifies the service type.
       
    77         * @return a pointer to a new CSenWSDescription instance
       
    78         */
       
    79         IMPORT_C static CSenWSDescription* NewL(const TDesC8& aEndPoint,
       
    80                                                         const TDesC8& aContract);
       
    81 
       
    82         /**
       
    83         * Standard 2 phase constructors
       
    84         * @param aEndpoint the service endpoint. Note that endpoint cannot
       
    85         *        include characters which are illegal in XML. If endpoint
       
    86         *        is an URL which contains illegal characters (like '&'-char),
       
    87         *        those need to be encoded into XML entity form (like &).
       
    88         *        EncodeHttpCharactersLC() method from XmlUtils can be used
       
    89         *        for encoding of basic XML entities.
       
    90         * @param aContract identifies the service type.
       
    91         * @return a pointer to a new CSenWSDescription instance,
       
    92         *        which is left on cleanup stack.
       
    93         */
       
    94         IMPORT_C static CSenWSDescription* NewLC(const TDesC8& aEndPoint,
       
    95                                                          const TDesC8& aContract);
       
    96 
       
    97         /**
       
    98         * Destructor.
       
    99         */
       
   100         IMPORT_C virtual ~CSenWSDescription();
       
   101 
       
   102         // New functions
       
   103         /**
       
   104         * Method returns ETrue if the primary keys of this service description
       
   105         * are equal. Definition of primary keys varies on concrete implementations.
       
   106         *
       
   107         * In a typical XML sub class implementation the primary keys are Contract
       
   108         * and Endpoint elements.
       
   109         *
       
   110         * Difference to Match() method is that primary keys - often descriptors -
       
   111         * MUST be equal both in this service description and in aCandidate, unlike
       
   112         * in Match(), where argument is more like wildcard pattern matching even
       
   113         * in cases where it includes fewer fields (less information).
       
   114         *
       
   115         * @since Series60
       
   116         * @param    aCandidate is a service description, which primary keys are
       
   117         *           checked in this comparison.
       
   118         *
       
   119         * @return TBool ETrue if primary keys are equal, EFalse otherwise.
       
   120         */
       
   121         IMPORT_C virtual TBool HasEqualPrimaryKeysL(MSenServiceDescription& aCandidate);
       
   122 
       
   123         /*
       
   124         * Method checks specific pieces of information to determine, whether this
       
   125         * service description is local or not. Typically this is defined by the
       
   126         * endpoint's scheme, which is KSenTransportSchemeLocal in most of the cases,
       
   127         * when this method returns true.
       
   128         * @return boolean indicating whether this endpoint is local or not.
       
   129         */
       
   130         IMPORT_C virtual TBool IsLocalL(); 
       
   131 
       
   132 
       
   133         /*
       
   134         * Method for binding transport plug-in type with the endpoint in question.
       
   135         * Function adds/sets XML attribute called "cue" for <Endpoint> element:
       
   136         *
       
   137         *  <ServiceDescription>
       
   138         *    <Endpoint cue="com.nokia.wsf.transport.plugin.hostlet">
       
   139         *      urn:nokia.com.test.hostlet
       
   140         *    </Endpoint>
       
   141         *  </ServiceDescription>
       
   142         *
       
   143         * In above example, eventhough endpoint scheme "local://" would normally
       
   144         * invoke different type of plug-in, the "cue" attribute overrides this, and
       
   145         * forces hostlet transport plugin to be loaded.
       
   146         *
       
   147         * Transport plug-in types (cues):
       
   148         *
       
   149         *    _LIT8(KSenTransportCueHTTP,              "com.nokia.wsf.transport.plugin.httpchannel");
       
   150         *    _LIT8(KSenTransportCueVirtualTCP,        ""); 
       
   151         *    _LIT8(KSenTransportCueLocalEcom,         "com.nokia.wsf.transport.plugin.local");
       
   152         *    _LIT8(KSenTransportCueHostletConnection, "com.nokia.wsf.transport.plugin.hostlet");
       
   153         *
       
   154         *
       
   155         * Note that this method does not attempt to load the plug-in - it might not
       
   156         * even exist in the system. Neither is this attribute checked when XML service
       
   157         * description is parsed. As a conclusion, if non-existant plug-ins are bind
       
   158         * to endpoints, they will be ignored, and the transport is created in normal
       
   159         * way and plug-in is chosen based on endpoint scheme and/or defaults.
       
   160         *
       
   161         * @param aTransportCue is the ECOM cue of CSenTransport implementation.
       
   162         * @return KErrNone on success
       
   163         *         KErrSenNoEndpoint, if actual endpoint element does not exist
       
   164         *
       
   165         */
       
   166         IMPORT_C virtual TInt SetTransportCueL(const TDesC8& aTransportCue);
       
   167 
       
   168 
       
   169         /**
       
   170         * Getter for transport cue, assuming that attribute has been set,
       
   171         * and that has "cue" -attribute.
       
   172         * @return transport plug-in ECOM cue, or KNullDesC8, if it has
       
   173         * not been set in this service description.
       
   174         */
       
   175         IMPORT_C virtual TPtrC8 TransportCue();
       
   176 
       
   177         /**
       
   178         * Method provides convenient way to ensure up-casting of a subclass instance,
       
   179         * when it is seen via CSenWSDescription handle.
       
   180         * Each subclass has to implement this method.
       
   181         * @return boolean indicating whether the class in question has a super class
       
   182         * of requested type. ETrue is returned if any super class up in the inheritance
       
   183         * chain has mathing parent, via recursion. Method returns EFalse, if none of the
       
   184         * classes in the inheritance chain derives from requested type.
       
   185         */
       
   186         IMPORT_C virtual TBool HasSuperClass( TDescriptionClassType aType );
       
   187 
       
   188         /**
       
   189         * Getter for (web) service policy
       
   190         * @return pointer to service policy, or NULL, if it is not available
       
   191         */
       
   192         IMPORT_C virtual MSenServicePolicy* ServicePolicy();
       
   193 
       
   194         /**
       
   195         * Method provides convenient way to add a new value in Client Policy
       
   196         * This method will add attributes such as <SOAP12> or <UsernameTokenOverTLS>
       
   197         * in the Policy to be used by stack. Infact this method adds a new element
       
   198         * in xml representation of ServicePolicy.
       
   199         * @param aName is the Name of the attribute.
       
   200         * @return KErrNone on success, KErrArgument if any of the arguments
       
   201         * (descriptors) is of zero-length, or one of the system-wide
       
   202         * error codes otherwise.
       
   203         */
       
   204         IMPORT_C virtual TInt SetPolicyL(const TDesC8& aName);
       
   205 
       
   206         /**
       
   207         * Method provides convenient way to add a new value in Client Policy
       
   208         * This method will add attributes such as <Addressing>
       
   209         * in the Policy to be used by stack. Infact this method adds a new element
       
   210         * in xml representation of ServicePolicy and adds its value as contents of the element.
       
   211         * <Addressing>http://schemas.xmlsoap.org/ws/2004/03/addressing</Addressing>
       
   212         * @param aName is the Name of the Policy attribute.
       
   213         * @param aValue is the Contents of the Policy attribute.
       
   214         * @return KErrNone on success, KErrArgument if any of the arguments
       
   215         * (descriptors) is of zero-length, or one of the system-wide
       
   216         * error codes otherwise.
       
   217         */
       
   218 
       
   219         IMPORT_C virtual TInt SetPolicyL(const TDesC8& aName, const TDesC8& aValue);
       
   220         /**
       
   221         * Method provides convenient way to add a new value in Client Policy
       
   222         * This method will add attributes such as <Addressing>
       
   223         * in the Policy to be used by stack. Infact this method adds a new element
       
   224         * in xml representation of ServicePolicy and adds its value as contents of the element.
       
   225         * <MetadataEndpoint method = "GET">http://www.mypolicyendpoint.com/policy2/</MetadataEndpoint>
       
   226         * @param aName is the Name of the Policy attribute.
       
   227         * @param aValue is the Contents of the Policy attribute.
       
   228         * @param aAttribName is the Name of the attribute in element aName
       
   229         * @param aAttribValue is the Contents of the aAttribName attribute.
       
   230         * @return KErrNone on success, KErrArgument if any of the arguments
       
   231         * (descriptors) is of zero-length, or one of the system-wide
       
   232         * error codes otherwise.
       
   233         */
       
   234 
       
   235         IMPORT_C virtual TInt SetPolicyL(const TDesC8& aName, const TDesC8& aValue, const TDesC8& aAttribName, const TDesC8& aAttribValue);
       
   236 
       
   237         /**
       
   238         * Setter for (identity) provider ID
       
   239         * @since Series60 5.0
       
   240         * @param aProviderID the unique identifier of the (identity) provider
       
   241         * @return KErrNone on success, KErrArgument if aProviderID is of zero-length,
       
   242         * or one of the system-wide Symbian error codes otherwise.
       
   243         */
       
   244         IMPORT_C virtual TInt SetProviderIdL( const TDesC8& aProviderID );
       
   245 
       
   246         /**
       
   247         * Getter for (identity) provider ID
       
   248         * @since Series60 5.0
       
   249         * @return the (locally) unique identifier of the (identity) provider
       
   250         * @return KErrNone on success, KErrArgument if aProviderID is of zero-length,
       
   251         * or one of the system-wide Symbian error codes otherwise.
       
   252         */
       
   253         IMPORT_C TPtrC8 ProviderId();
       
   254 
       
   255         /**
       
   256         * Setter for userinfo attribute, which determinates whether the username
       
   257         * - password notifier dialog is shown to end-user or not, when authentication
       
   258         * fails (due wrong, or incomplete userinfo).
       
   259         * @param aPromptUserInfoMode
       
   260         *  EFalse dictates that an error must be returned when creating
       
   261         *         a service connection and userinfo is not accepted by
       
   262         *         (remote) authentication, instead of showing the dialog.
       
   263         *  ETrue (or if attribute does not exist in this XML SD) means that
       
   264         *         end-user should be prompted (default behaviour). The number
       
   265         *         of retry attempts (each showing a dialog) is service invocation
       
   266         *         framework spesific; typically 3 retries are permitted.
       
   267         */
       
   268         IMPORT_C void SetPromptUserInfoL( TBool aPromptUserInfoMode );
       
   269 
       
   270         /**
       
   271         * Getter for current userinfo mode (attribute).
       
   272         * @return Boolean that indicates the mode:
       
   273         *  EFalse means that end-user prompts (notifier dialogs) have been
       
   274         *  explicitely surpressed, and thus will not be shown to end-user:
       
   275         *  attribute value is exactly as follows: "false"
       
   276         *  ETrue means that attribute does not exist (default), or it has ANY OTHER
       
   277         *  value, but NOT "false"
       
   278         */
       
   279         IMPORT_C TBool PromptUserInfo();
       
   280 
       
   281     protected:  // New functions
       
   282 
       
   283         /**
       
   284         * C++ default constructor.
       
   285         * @param aType enumeration defining the type of this class.
       
   286         */
       
   287         IMPORT_C CSenWSDescription(TDescriptionClassType aType);
       
   288 
       
   289 	public:
       
   290 		/**
       
   291         * Sets the SNAP ID.
       
   292         * @param aSnapId  A Snap ID
       
   293         */
       
   294 	   	IMPORT_C virtual void SetSnapIdL(TUint32 aSnapId); 
       
   295 		/**
       
   296         * Gets the SNAP ID.
       
   297         * @param aCurrentSnapId  A TUint32 reference to be filled in with the
       
   298         *                       value of the SNAP ID.
       
   299         * @return               KErrNone if no error, or some of the system
       
   300         *                       wide error codes.
       
   301         */
       
   302        IMPORT_C virtual TInt SnapId(TUint32& aCurrentSnapId); 	
       
   303 
       
   304     private: // Data
       
   305         CSenServicePolicy* 	iServicePolicy;
       
   306     };
       
   307 
       
   308 #endif // SEN_WS_DESCRIPTION_H
       
   309 
       
   310 // End of File
       
   311 
       
   312