-
Notifications
You must be signed in to change notification settings - Fork 28
1.1 Create an OData V4 client app in Visual Studio 2012
Note: This section is being worked on and is not finished
This section is a tutorial about how to create a client application for the OData V4 service with ODataCpp using Visual Studio 2012. The ODataCpp client libraries currently only supports Visual Studio 2012. We'll add more support soon.
Suppose you already have your ODataCpp client libraries and code generation tools built. If you haven't, please refer to the README file for instructions.
(1) Navigate to the path of where the built libraries and tool are located
Open Command Prompt (cmd.exe) or PowerShell and type in the following command to navigate to the location:
cd <Home>\odatacpp\output\<Configuration>
<Home>
is the path where your odatacpp folder is located and <Configuration>
is the build configuration you've chosen to build your library (either "Debug" or "Release"). In this tutorial, we chose "Release" as the build configuration.
(2) Run the code generation tool to generate the proxy
Type in the following command in Command Prompt or PowerShell
.\odata_codegen_tool.vs11.exe <ServiceURL> <ProxyFileName> <Username> <Password>
<ProxyFileName>
is the name you want for the .h and .cpp files of the proxy code. <ServiceURL>
is the URL of the service document of the target OData service. <Username>
and <Password>
are the credential for accessing the service in case it requires authentication.
In this tutorial, we want to build a client application for the TripPin service published on www.odata.org and it doesn't require authentication, so we type in the following command:
.\odata_codegen_tool.vs11.exe http://services.odata.org/v4/TripPinServiceRW TripPinService
and we get the following two proxy files:
(1) Open Visual Studio 2012 and create an empty C++ project
(2) Copy the header files, library files and proxy files to the project folder
The files to add are: 1. all the files in <Home>\odatacpp\include
. 2. "odata_client.vs11.dll", "odata_client.vs11.lib", "odata_library.vs11.dll", "odata_library.vs11.lib", "utilities.vs11.dll" and "utilites.vs11.lib" in <Home>\odatacpp\output\Release
. 3. "TripPinService.h" and "TripPinService.cpp" that generated.
After the copying, the project structure should look like following: