×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    6

    webservice problem

    my webservice works fine, but a access point promt apears by every connection:

    i tried follow way:

    iServicePattern = CSenServicePattern::NewL(KServiceEndpoint);
    iServicePattern->SetFrameworkIdL(KDefaultBasicWebServicesFrameworkID);
    iServicePattern->SetConsumerIapIdL( aIAP );

    CSenServiceConnection *iConnection = CSenServiceConnection::NewL(*this, *iServicePattern);

    iService = CACWSDLService::NewL(*iConnection);

    but the promt cames again...

    then i finded follow example, but on RConnection Class:

    TCommDbConnPref prefs;
    prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
    prefs.SetDirection(ECommDbConnectionDirectionOutgoing);
    prefs.SetIapId(2); //preferred IAP

    my question: how i do apply this way to my usercase? i need same for my webservice...

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146

    Re: webservice problem

    First things first, welcome to the DiBo :-)

    This is what you are looking for :-

    http://wiki.forum.nokia.com/index.ph...predefined_IAP

    Cheers,
    Mayank

  3. #3
    Registered User
    Join Date
    Apr 2009
    Posts
    6

    Re: webservice problem

    thanks for your anwser,

    but for all that i get the network promt, here is my code:

    CSenServicePattern* pattern = CSenServicePattern::NewLC();
    // pattern->SetContractL(KPpContract());
    pattern->SetConsumerIapIdL(aIAP);
    CSenServiceConnection *iConnection = CSenServiceConnection::NewL(*this, *pattern);
    iService = CACWSDLService::NewL(*iConnection);


    Th one difference ist he contract...

    please help!

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: webservice problem

    That part is OK, but what do you supply as "aIAP"? You can get some idea from the Wiki, search for select iap or something similar.

  5. #5
    Registered User
    Join Date
    Apr 2009
    Posts
    6

    Re: webservice problem

    here is the code for "aIAP":

    void CacsysContainerView::ReadDefaultIAPL(TUint32& aIAP) {
    // open the IAP communications database
    CCommsDatabase* commDB = CCommsDatabase::NewL(EDatabaseTypeIAP);
    CleanupStack::PushL(commDB);

    // initialize a view
    CCommsDbConnectionPrefTableView* commDBView =
    commDB->OpenConnectionPrefTableInRankOrderLC(ECommDbConnectionDirectionUnknown);

    // go to the first record
    User::LeaveIfError(commDBView->GotoFirstRecord());

    // Declare a prefTableView Object.
    CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref;

    // read the connection preferences
    commDBView->ReadConnectionPreferenceL(pref);
    aIAP = pref.iBearer.iIapId;

    // pop and destroy the IAP View
    CleanupStack::PopAndDestroy(commDBView);

    // pop and destroy the database object
    CleanupStack::PopAndDestroy(commDB);

    }

  6. #6
    Super Contributor
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146

    Re: webservice problem

    Well this is the code snippet and works fine for me:-

    Code:
    TInt currentIAPId;
    RConnection connection;
    RSocketServ socketServ;
    	
    //Connect to the Socket Server and open a connection
    User::LeaveIfError(socketServ.Connect());
    User::LeaveIfError(connection.Open(socketServ));
        
    TUint connectionCount;
        
    //Enumerate currently active connections across all socket servers
    User::LeaveIfError(connection.EnumerateConnections(connectionCount));
        
    if (connectionCount)
           {
            TPckgBuf<TConnectionInfoV2> connectionInfo;
            
            for (TUint count = 1; count <= connectionCount; ++count)
                {
                connection.GetConnectionInfo(count, connectionInfo);
                
                // Check for the GPRS/Generic connection type
                if(connectionInfo().ConnectionType() == EConnectionGPRS || connectionInfo().ConnectionType() == EConnectionGeneric)
    	            {
     		// Check if bearer type is GPRS. If it is GPRS, then return IAP Id. Else check for next connection
    		TInt bearerType = GetBearerType(connectionInfo().iIapId);
    				
    				if(bearerType == EApBearerTypeGPRS)
    					{
       		     			currentIAPId = connectionInfo().iIapId;					
    					break;
    					}
    	            }
                }
            }
        // Cleanup and close resource handles
        connection.Close();
        socketServ.Close();
    
    
    TApBearerType CDataPublisher::GetBearerType(TUint aIapId)
    	{
    	TInt wapId;
    	
    	TApBearerType bearerType;
    	
    	// Opens Comms database
    	CCommsDatabase *db = CCommsDatabase::NewL();
    	CleanupStack::PushL(db); //cs = 1
    	
    	// Start transaction
    	User::LeaveIfError(db->BeginTransaction());
    	
    	
    	CApDataHandler* apDataHandler = CApDataHandler::NewLC(*db); // cs = 2
    	CApUtils *apUtils = CApUtils::NewLC(*db); //cs=3
    
    	// Get WAP Id from IAP Id
    	wapId = apUtils->WapIdFromIapIdL(aIapId);
    
    	CApAccessPointItem* wlanNew = CApAccessPointItem::NewLC(); // cs = 4
    	apDataHandler->AccessPointDataL(wapId,*wlanNew); 
    	// Return the bearer type of the connection
    	bearerType = wlanNew->BearerTypeL();
    
    	User::LeaveIfError(db->CommitTransaction());    //	// End a transaction. Call after `InsertRecord()` or `UpdateRecord()`.
    	
    	CleanupStack::PopAndDestroy(4);		// cs = 0
    
    		
    	return bearerType;
    	}
    I am checking for the bearer type on GPRS, you can change it according to your requirements. Once I get the IAP id, I call SetConsumerIapIdL(currentIAPId). Otherwise the first time the selection dialog is popped up and the connection is established and I get notified in SetStatus(implemented in my class-> comes from MSenServiceConsumer), case KSenConnectionStatusReady, I call the function to store the current active iap id.

    Hope this helps..

    Cheers,
    Mayank

  7. #7
    Registered User
    Join Date
    Apr 2009
    Posts
    6

    Re: webservice problem

    Thanks you!

    i need a connection just for short time and delete the service and connection objects...


    i need follow way, in settings i need to start network promt and save the aIapId.

    Then by starting of networking the promt must not start...

    is it possible?

    If i set aIapId manual promt appers for every connection start.

    what i don't understan?

  8. #8
    Super Contributor
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146

    Re: webservice problem

    Quote Originally Posted by koni_ka View Post
    Thanks you!

    i need a connection just for short time and delete the service and connection objects...


    i need follow way, in settings i need to start network promt and save the aIapId.

    Then by starting of networking the promt must not start...

    is it possible?

    If i set aIapId manual promt appers for every connection start.

    what i don't understan?
    What do you mean in settings tou want to start network prompt? Is it that you want to show the network selection once to the user in your custom setting page, establish that connection and re-use it when doing your web services? If thats the case you can do that as well. Check the Wiki on how to create a new ap and establish connection here. You can have callbacks implemented to notify you of a connection established like this, once you have that you can read the iap id using the code I shared earlier and once you call SetConsumerIAPId with the given iap, the ap selection dialog wont open up again and again.

    Cheers,
    Mayank

  9. #9
    Registered User
    Join Date
    Apr 2009
    Posts
    6

    Re: webservice problem

    thx, i will try it...

Similar Threads

  1. Problem with CAknDoubleStyleListBox with a CAknSearchField
    By jjig in forum Symbian User Interface
    Replies: 2
    Last Post: 2009-09-17, 00:58
  2. Webservice framework authentication problem
    By niemin78 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-08-22, 10:57
  3. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  4. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  5. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×