IAP Creation and connection.

Login to reply to this topic.
Tue, 2005-07-19 13:30
Joined: 2004-12-27
Forum posts: 15
Hi all,

I am creating an IAP. The creation is successful.I want to use the created IAP to retrieve data for my application.
 For testing i am creating a dummy IAP with the same settings as that of a working IAP on my device.

For creating the IAP, i create records in the OUTGOING GPRS, Network, Location, IAP, wap Access Point
Wap Ip Bearer and the Proxies Table.

For connecting the IAP i use the RConnection class. I set the connection preferences as follows.
TCommDbConnPref connectPref;

// setup preferences
connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
connectPref.SetDirection(ECommDbConnectionDirectionOutgoing);
connectPref.SetBearerSet(ECommDbBearerGPRS);
connectPref.SetIapId(aIapId);

I use
RConnection::Start(connectPref) to connect the IAP. The connection is successful.

My Problem is when used by my application i am unable to retrieve
any data from say e.g. "http://www.google.co.in"

whereas when i use the created IAP from the "WEB" or "Services" application to
connect to the same site, the retrieval is successful.

What could be going wrong ?.

Also in,
connectPref.SetIapId(aIapId);
Should this value be the COMMDB_ID of the record created in the IAP TABLE or
the COMMDB_ID of some other table. At present I am using the id of the
record from the IAP Table.

Also
What is the significance / difference between the following fields
PROXY_PORT_NUMBER(proxytable) and WAP_PROXY_PORT(wapipbearertable)

Thanks in advance,

Shashi.

Wed, 2005-07-20 09:03
Joined: 2004-12-27
Forum posts: 15
Re: IAP Creation and connection.
Just to make my problem a bit more clear Here's what i am doing.
Creating an iap with the settings of HUTCH_GPRS

SETTINGS.   
IP GATEWAY      10.10.1.100
GPRS APN                      portalnmms
GPRS_AP_TYPE      2
GPRS_IF_NETWORKS   ip
WAP_GATEWAY_ADDRESS   10.10.1.100
WAP START PAGE      http://www.hutchworld.co.in
WAP_PROXY_PORT      9401

Inserting records in the table with the settings.

OUTGOING GPRS TABLE
gprsTable->WriteTextL(TPtrC(COMMDB_NAME), iIAPName);
gprsTable->WriteTextL(TPtrC(GPRS_IP_GATEWAY), _L("10.10.1.100"));
gprsTable->WriteTextL(TPtrC(GPRS_APN), _L("portalnmms"));
gprsTable->WriteTextL(TPtrC(GPRS_IF_NETWORKS), _L("ip"));
gprsTable->WriteBoolL(TPtrC(GPRS_IF_PROMPT_FOR_AUTH), EFalse);
gprsTable->WriteUintL(TPtrC(GPRS_AP_TYPE), 2);
..
..
..

NETWORK TABLE.
nwTable->WriteTextL(TPtrC(COMMDB_NAME), iIAPName);

LOCATION TABLE
// Initialise the location table view.
CCommsDbTableView* locationTable = iCommDb->OpenTableLC(TPtrC(LOCATION));

// Scan through all the records
result = locationTable->GotoFirstRecord();

// Initialise a temp buffer to hold the location name.
TBuf<128> locationName;
while (result == KErrNone)
{
   locationTable->ReadTextL(TPtrC(COMMDB_NAME), locationName);
   if (locationName.Match(_L("Mobile"))!= KErrNotFound)
   {
      locationTable->ReadUintL(TPtrC(COMMDB_ID), iMobileLocationId);
      break;
   }
   result = locationTable->GotoNextRecord();
}
CleanupStack::PopAndDestroy(locationTable);


IAP TABLE
iapTable->WriteTextL(TPtrC(COMMDB_NAME), iIAPName);      
iapTable->WriteTextL(TPtrC(IAP_SERVICE_TYPE), TPtrC(OUTGOING_GPRS));
iapTable->WriteUintL(TPtrC(IAP_NETWORK), iNetworkId);         // ID FROM NETWORK TABLE
iapTable->WriteUintL(TPtrC(IAP_SERVICE), iGprsId);                       // ID FROM GPRS TABLE
iapTable->WriteUintL(TPtrC(IAP_LOCATION), iMobileLocationId);                   // ID FROM LOCATION TABLE.
iapTable->WriteUintL(TPtrC(IAP_NETWORK_WEIGHTING), 0);
iapTable->WriteUintL(TPtrC(IAP_BEARER), 2);
iapTable->WriteTextL(TPtrC(IAP_BEARER_TYPE), TPtrC(MODEM_BEARER));

WAP ACCESSPOINT TABLE
wapTable->WriteTextL(TPtrC(COMMDB_NAME), iIAPName);
wapTable->WriteTextL(TPtrC(WAP_CURRENT_BEARER), TPtrC(WAP_IP_BEARER));
wapTable->WriteTextL(TPtrC(WAP_START_PAGE), _L("http://www.hutchworld.co.in"));


WAP IP BEARER TABLE
wapIPTable->WriteUintL(TPtrC(WAP_ACCESS_POINT_ID), iWapId);
wapIPTable->WriteTextL(TPtrC(WAP_GATEWAY_ADDRESS), _L("10.10.1.100"));
wapIPTable->WriteUintL(TPtrC(WAP_IAP),iIapId);
wapIPTable->WriteUintL(TPtrC(WAP_PROXY_PORT), 9401);            // PORT NO. 9401   
wapIPTable->WriteBoolL(TPtrC(WAP_SECURITY), EFalse);            // security "OFF"

PROXY TABLE.
proxyTable->WriteUintL(TPtrC(PROXY_ISP),iGprsId);
proxyTable->WriteBoolL(TPtrC(PROXY_USE_PROXY_SERVER), ETrue);
proxyTable->WriteTextL(TPtrC(PROXY_SERVICE_TYPE), TPtrC(OUTGOING_GPRS));
proxyTable->WriteLongTextL(TPtrC(PROXY_SERVER_NAME), _L("10.10.1.100"));
proxyTable->WriteTextL(TPtrC(PROXY_PROTOCOL_NAME), _L("http"));
proxyTable->WriteUintL(TPtrC(PROXY_PORT_NUMBER),9401);


The creation is completed.

The connection for the CREATED IAP is established as follows.
// Declare a prefTableView Object.
CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref;

// Now we have the iap Id. Use it to connect for the connection.
// Create a connection preference variable.
TCommDbConnPref connectPref;

// setup preferences
connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);         // No pop up dialog.
connectPref.SetDirection(ECommDbConnectionDirectionOutgoing);
connectPref.SetBearerSet(ECommDbBearerGPRS);

/*****************************************************************************
*
* THE aIapId used here is the  COMMDB_ID of the created IAP from the  IAP TABLE
*
******************************************************************************/
connectPref.SetIapId(aIapId);            //

// start a synchronous connectionn
TInt errConnect = iConnection.Start(connectPref);
// Set the current state of the connection as per the return code.
if(errConnect == KErrNone)
   iConnected = ETrue;   
else
   iConnected = EFalse;


The connection is completed.I wish to use the established connection for my app. I use it as follows.
void CHttpConnection::FetchUri(const TDesC8& aUri)
{
              // Parse the uri
             TUriParser8      iUri;
             User::LeaveIfError(iUri.Parse(aUri) );

   
//
//   COMPOSE THE REQUEST HEADER.
//

   // The session state is ESessionIdle only if there has been an error. Check if the
   // session was closed , then restart the session.
   if(iSessionState != ESessionActive)
   {
      TRAPD(err,iHttpSession.OpenL());
      if(err != KErrNone)
      {
         iHttpConnCallback.ConnectFail(HTTP_TRANSACTION_ERROR,this);
         return;
      }
   }

   // Get request method string for HTTP GET
   RStringF method = iHttpSession.StringPool().StringF(HTTP::EGET, RHTTPSession::GetTable());
   
   // Initialise an http transaction using the httpsession variable.
   // receive transaction events in MHFRunL and MHFRunError.
   TRAPD(err,iHttpTransaction = iHttpSession.OpenTransactionL(iUri, *this, method));
   if(err != KErrNone)
   {
      iHttpConnCallback.ConnectFail(HTTP_TRANSACTION_ERROR,this);
      return;
   }
   
   // Set headers for request; accepted content type
   RHTTPHeaders header = iHttpTransaction.Request().GetHeaderCollection();
   SetHeaderFieldL(header, HTTP::EAccept, KAccept);
   //   SetHeaderFieldL(header, HTTP::EConnection, KConnection);

   // Submit the transaction.
   // Set the state of the http connection to EHttpRunning
   iHttpState = EHttpRunning;

//
// IAP CONNECTION.
//

#ifndef __WINS__          // only for device.

   // Associate the current connection with the CREATAED IAP(use the same IAP)
   //Set properties for session
   RStringPool strP = iHttpSession.StringPool();
   
   // create a connection Info object.
   RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();

   // set the property .
   // The socketserver and the Rconnection used here are member variables of the
   // IAP CLASS
   connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable() ),
                          THTTPHdrVal (iSocketServer.Handle()) );
   TInt connPtr = REINTERPRET_CAST(TInt, &(iConnection));

   // Set the property for the session.
   connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketConnection,
                          RHTTPSession::GetTable() ),
                          THTTPHdrVal (connPtr) );

#endif

    // Submit the request.
    iHttpTransaction.SubmitL(THTTPFilterHandle::EClient);

   return;
}


The callbacks for the RHttpTransaction events are implemented. If used with any other existing IAP
on the device, the data retrieval from the remote server works fine. But when used with the created
IAP the retrieval TIMES OUT(-33).

Also when the created IAP is used with some default application like "WEB" OR "SERVICES" the retrieval
works fine.

Am i missing some fields in the some tables in commdb.?
Am i some way missing to associate the created IAP with the retrieval(IAP ID USED TO CONNECT) ??

Any pointers to possible solutions will be helpful.

Thanks
Shashi.

 





Fri, 2005-08-26 11:46
Joined: 2005-04-08
Forum posts: 46
Re: IAP Creation and connection.
hi shashishaw , I create an iap like following,but get error -1 at  PutRecordChanges(); How did u create successfully. Can u paste some code? my sdk is uiq 2.1. thanx a lot!



  CCommsDatabase* db1=CCommsDatabase::NewL();
    CleanupStack::PushL(db1);
    CCommsDbTableView* outgoingTable = db1->OpenTableLC(TPtrC(OUTGOING_GPRS));
   
    User::LeaveIfError(outgoingTable->InsertRecord(gprsId));  //Start transaction
   
    outgoingTable->WriteTextL(TPtrC(COMMDB_NAME),aName);
    outgoingTable->WriteTextL(TPtrC(GPRS_APN) , _L("cmnet"));
    outgoingTable->WriteTextL(TPtrC(GPRS_IF_NAME)   , aName);
    //if (iGlobals->gFlag2 & GM_APN_SUPPLY_USERNAME_PASSWORD)
    {
        //outgoingTable->WriteTextL(TPtrC(GPRS_IF_AUTH_NAME), _L(""));
        //outgoingTable->WriteTextL(TPtrC(GPRS_IF_AUTH_PASS), _L(""));
    }
    outgoingTable->WriteUintL(TPtrC(GPRS_PDP_TYPE),                0);
    outgoingTable->WriteBoolL(TPtrC(GPRS_IF_PROMPT_FOR_AUTH),      EFalse);
    outgoingTable->WriteBoolL(TPtrC(GPRS_IP_ADDR_FROM_SERVER),     ETrue);
    outgoingTable->WriteBoolL(TPtrC(GPRS_IP_DNS_ADDR_FROM_SERVER), ETrue);

   CEikonEnv::Static()->InfoWinL(_L("2"),KNullDesC);   
    error = outgoingTable->PutRecordChanges();

goready

  • Login to reply to this topic.