cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The PTC Community email address has changed to community-mailer@ptc.com. Learn more.

C++ REST Client Library

HellerKoch
5-Regular Member

C++ REST Client Library

Hei Community,

we're searching for a suitable c++ library to perform REST requests and parse Json to integrate into toolkit dlls.

Are there any recomendations?

 

We tryed cpprest/casablanca from microsoft already. We build a sample client without creo and everthing works fine until we integrate it into our creo dll. With this library the dll is not able to be started in creo anymore.

 

Thanks for your suggestions.

9 REPLIES 9

One suggestion would be. You can create Jlink application and do REST operation in Java. If you do not find suitable API in Jlink, you will have to create toolkit application. There are jlink API's to load dll and call C++ methods.

 

I have not tried it. This is my guess.

sully7
13-Aquamarine
(To:HellerKoch)

For parsing/building JSON messages - I've used RapidJson in the past before. It is very reliable, very fast, and really has great functionality. It is also a header-only library, which is REALLY NICE if you have to compile across multiple versions of Creo.

Then for performing REST requests, the biggest name on the block is really libcurl, which we compile alongside openssl

Past that, I've heard of others that can be helpful such as POCO: https://pocoproject.org/pro/docs/00153-RemotingNGTutorialPart4.html

 

Hope this helps!

 

James Sullivan

President & Founder
CadActive Technologies - www.cadactive.com
Eike_Hauptmann
13-Aquamarine
(To:sully7)

Hi

 

we are using CURL and JSON CPP ... precompiled as a .lib and then linked into the build.

 

https://github.com/open-source-parsers/jsoncpp

 

Br,

Eike

HellerKoch
5-Regular Member
(To:sully7)

Hei sully7,

thanks for your answer. I tryed to build curl along open ssl but also didn't manage to get it to work. Are there manuals you recomment?

 

HellerKoch
5-Regular Member
(To:HellerKoch)

OK, after struggling for hours I got this compiling.

Unfortunately I got exactly the same issue when loading the dll to creo ;-(

HellerKoch
5-Regular Member
(To:sully7)

Hei @sully7 ,

we're using Creo 4.0 and Visual Studio 2015 (14). I didn't manage to get curl running. I'm nearly shure that the issue is, that the current libraries are compiled for newer versions of VS. 

Can you please tell us how you compile curl with openssl step by step? 

 

What we want to have is a single lib plus header files that can be easily linked to in our VS 2015 project (in an ideal world there are no dependencies in this lib). 

 

Appreciate yout tipps very much. Thanks a lot.

 

 

Hi @HellerKoch 

 

There are multiple step by step instructions online. But I also struggled with it a little bit at the beginning.

 

I have 4 libs after compiling everything that I need to put into my compiler:

- lib_json.lib

- libcurl.lib

- libeay32.lib

- ssleay32.lib

 

I didn't link it into one lib ... I don't think it's needed also other librarys could need ssl so I think its a better way to not link these together. I put my compiling results as attachment ... they are for VS 2015 / 64 bit / MT. We use /FORCE:MULTIPLE inside some of our projects ... so it could be that libeay and protk_dll_NU.lib have pqueue_free and proqueue_pop inside.

 

Br,

Eike

HellerKoch
5-Regular Member
(To:Eike_Hauptmann)

Thanks - that brought me on the right track. Got it compiling now with vcpkg manager. curl and ssl are compiled separately as static library now. With that we are able to link it into MS VS v140 Projects. Thanks Guys. Appreciate your work.

CREOSON already does this using JSON over HTTP.  (Any language... including C++)

 

It is OpenSource -- so if you wanted to use that core as a foundation and extend using your own DLLs - I am sure it would be pretty easy.

 

Dave

Top Tags