0

I am having trouble working with third party dll's, libs and header files. I am trying to call a function and have it return a value with no luck. Here is the function that is suppose to be called.

bool COAuthSDK::GetRequestToken(CClientDetails &objClientDetails)

It has this info of what it needs

Name IN/OUT Description m_environment IN Optional. Possible values are SANDBOX (default) and LIVE. m_strConsumerKey IN OAuth consumer key provided by E*TRADE m_strConsumerSecret IN OAuth consumer secret provided by E*TRADE m_strToken OUT Returned by the function if successful m_strTokenSecret OUT Returned by the function if successful m_strCallback IN Optional; default value is "oob"

Here is the COAuthSDK header.

#ifndef _OAUTHSDK_H_INCLUDED_
#define _OAUTHSDK_H_INCLUDED_

#include "ETCOMMON\CommonDefs.h"
#include "ETCOMMON\OAuthHelper.h"
using namespace std;

#ifdef OAUTH_LIBRARY_EXPORT // inside DLL
#   define OAUTH_API   __declspec(dllexport)
#else //outside DLL
#   define OAUTH_API   __declspec(dllimport)
#endif  //OAUTH_LIBRARY_EXPORT

class OAUTH_API COAuthSDK
{
public:
COAuthSDK(void);
virtual ~COAuthSDK(void);

bool GetRequestToken(CClientDetails &objClientDetails) throw (...);
bool GetAccessToken(CClientDetails &objClientDetails,string strVerifier) throw (...);
void RenewToken(CClientDetails &objClientDetails) throw (...);
void RevokeToken(CClientDetails &objClientDetails) throw (...);
string AuthorizeUrl(CClientDetails &objClientDetails) throw (...);

string GetProtectedResourse(CClientDetails &objClientDetails,string strUrl,       HttpMethodConstants httpMethod = GETMethod, string postParameters = NULL) throw (...);

};

#endif//_OAUTHSDK_H_INCLUDED_

and the CClientDetails header

#pragma once

#ifndef _CLIENTDETAILS_H_INCLUDED_
#define _CLIENTDETAILS_H_INCLUDED_

using namespace std;

#include "CommonDefs.h"

#ifdef COMMON_LIBRARY_EXPORT // inside DLL
#   define COMMON_API   __declspec(dllexport)
#else // outside DLL
#   define COMMON_API   __declspec(dllimport)
#endif  // COMMON_LIBRARY_EXPORT

class COMMON_API CClientDetails
{
public:
CClientDetails();
CClientDetails(string strConsumerKey,string strConsumerSecret,Environment environment);
virtual ~CClientDetails ();

Environment GetEnv();
void SetEnv(Environment env);

string GetConsumerKey();
void SetConsumerKey(string consumerKey);

string GetConsumerSecret();
void SetConsumerSecret(string consumerSecret);

string GetToken();
void SetToken(string token);

string GetTokenSecret();
void SetTokenSecret(string tokenSecret);

private :
Environment m_environment;
string m_strConsumerKey;
string m_strConsumerSecret;
string m_strToken;
string m_strTokenSecret;
string m_strCallback;
};
#endif//_CLIENTDETAILS_H_INCLUDED

and my main CPP.

int _tmain(int argc, _TCHAR* argv[]){CClientDetails clientDetails;

CClientDetails objClientDetails;
GetRequestToken(CClientDetails &objClientDetails);
objClientDetails.SetEnv(SANDBOX);
objClientDetails.SetConsumerKey("1f5328f725dee654e0a4499f161b8fe4c6e");
objClientDetails.SetConsumerSecret("d39a8043cc0c7686920fd0655e47281e6a5");
objClientDetails.GetToken();
objClientDetails.GetTokenSecret();
cin.get();
cin.get();
return 0;

  }`

When I try to build the function it says that its in the dll's so I know I have to call it. If anyone could help that would be greatly appreciated. Here is the link to the build site if needed https://us.etrade.com/ctnt/dev-portal/getContent?contentUri=V0_Code-SDKGuides-VC

Ravid Goldenberg
  • 2,119
  • 4
  • 39
  • 59

1 Answers1

0
GetRequestToken(CClientDetails &objClientDetails);

is not good. You need something like

COAuthSDK sdk;
sdk.GetRequestToken(objClientDetails);

note that it's just some likely correct syntax, you shall figure out from dox how to obtain an sdk instance for use.

Balog Pal
  • 16,195
  • 2
  • 23
  • 37