Skip to content

Commit bc6658d

Browse files
committed
FIx netlicensing_client_demo
1 parent aa8b3ff commit bc6658d

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

client_demo/netlicensing_client_demo.cc

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,39 @@ int main(int argc, char* argv[]) {
2323
try {
2424
Context ctx;
2525
ctx.set_base_url("https://go.netlicensing.io/core/v2/rest/");
26+
std::cout << "NetLicensing URL: https://go.netlicensing.io/core/v2/rest/" << std::endl;;
2627
ctx.set_username("demo");
28+
std::cout << "Account:demo" << std::endl;;
2729
ctx.set_password("demo");
2830

2931
if (licensee_number.empty()) {
30-
std::cout << "Please enter a valid licensee number for validation (choose licensee in demo account): " << std::endl;
31-
if (!std::getline(std::cin, licensee_number)) { return -1; }
32-
33-
if (!licensee_number.empty()) {
34-
std::cout << "start validation for " << licensee_number << std::endl;
35-
ValidationResult vres = LicenseeService::validate(ctx, licensee_number);
36-
std::cout << "got validation results:\n" << vres.toString() << std::endl;
37-
}
38-
else {
39-
std::cout << "Invalid licensee number for validation." << std::endl;
40-
return -1;
41-
}
32+
do
33+
{
34+
std::cout << "Please enter a valid licensee number for validation (choose licensee in demo account): " << std::endl;
35+
std::getline(std::cin, licensee_number);
4236

37+
} while (licensee_number.empty());
38+
39+
std::cout << "start validation for " << licensee_number << std::endl;
40+
ValidationResult vres = LicenseeService::validate(ctx, licensee_number);
41+
std::cout << "got validation results:\n" << vres.toString() << std::endl;
42+
43+
std::cout << "Please press enter key for exit" << std::endl;
44+
std::cin.ignore();
4345
}
4446
}
4547
catch (const RestException& e) {
4648
std::cerr << e.what() << " code " << e.http_code() << std::endl;
4749
for (auto det : e.get_details()) {
4850
std::cerr << det.to_string() << std::endl;
4951
}
52+
std::cout << "Please press enter key for exit" << std::endl;
5053
std::cin.ignore();
5154
return 2;
5255
}
5356
catch (const std::runtime_error& err) {
5457
std::cerr << err.what() << std::endl;
58+
std::cout << "Please press enter key for exit" << std::endl;
5559
std::cin.ignore();
5660
return 1;
5761
}

0 commit comments

Comments
 (0)