We are currently consuming a soap based webservice in an delphi application running on an XP (yes still running XP) and porting to a windows 8.1 OS. Our current implementation also uses CAPICOM for certificate management which is now also desupported.
We are planning on upgrading from wininet to winhttp (being faster) remaining with the current version of Delphi 2010. Components I have found are: SynCrtSock , ICS and Indy. From my review, these either use wininet or dont support soap?
Any information on components and examples with the minimum of: soap support, winhttp and certificate management would be greatly appreciated.
Thanks in advance.
I now have resolved the key point of my issue in the certificate management and thought I would post my solution.
The certificate management requirements were limited to only attaching to the SOAP message, I was able to achieve the solution by using the wcrypt2 library. My original code using CAPICOM (with the help of many internet searches) was
Certificate1.Load(CertFile, certpword, CAPICOM_KEY_STORAGE_DEFAULT,
CAPICOM_CURRENT_USER_KEY);
Cert2 := Certificate1.DefaultInterface;
CertContext := Cert2 as ICertContext;
CertContext.Get_CertContext(Integer(PCertContext));
if internetsetOption(Data, INTERNET_OPTION_CLIENT_CERT_CONTEXT,
PCertContext, SizeOf(CERT_CONTEXT)) = False then
begin
'Error Handling'
end;
By using wcrypt2 I was able to read from the certificate store and attach to the soap message by a simple change to my BeforePost function with
hMyStore:=CertOpenSystemStore(0,'MY');
pCertContext:=CertFindCertificateInStore(
hMyStore,
X509_ASN_ENCODING,
0,
CERT_FIND_SUBJECT_STR,
PCHAR('KeyName'),Nil
);
if internetsetOption(Data, INTERNET_OPTION_CLIENT_CERT_CONTEXT,
PCertContext, SizeOf(CERT_CONTEXT)) = False then
begin
'error handling'
end;
And now I am compatible with Windows 8.1, as wininet is still compatible with 8.1 this is not on my critical path and have further time to deploy a solution.
Any further advice on my solution would be greatly appreciated.
Related
I'm currently trying to implement a soap client under Windows in C++. Due to some technical requirements, the http and communication layer have been implemented using the Winhttp API. Everything seems to work ok but, as soon as TLS 1.1 or 1.2 are enabled the software is unable to perform the SSL handshake. It just keeps sending TCP connection packets to the server.
I made several tests in order to find out what's happening and, so far, this is what I already know:
The software works as expected in Windows 10 Pro (no matter which TLS version is selected). That can't be said when the software is deployed in a Windows 10 ltsb 2016 (1607).
Enabling TLS support as suggested here does not work.
The winhttp code can be found here. I only added this modification at lines 351-352:
DWORD dwOpt = WINHTTP_FLAG_SECURE_PROTOCOL_ALL | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 |WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;
int res = WinHttpSetOption(pData->hInternet, WINHTTP_OPTION_SECURE_PROTOCOLS, &dwOpt, sizeof(dwOpt));
Thanks
I already found what was going on there. It turns out that the secure protocol flags does not behave the same way in Windows 10 Pro and Windows 10 2016 ltsb.
The code snippet included in the questions works as expected under Windows 10 Pro but, in Windows 10 2016 ltsb it must be:
DWORD dwOpt = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 |WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;
int res = WinHttpSetOption(pData->hInternet, WINHTTP_OPTION_SECURE_PROTOCOLS, &dwOpt, sizeof(dwOpt));
I hope this helps anyone who is struggling with similar issues.
I'm using the standard COM API of Outlook. It works perfectly well.
But since the release of Outlook 2016 in the Microsoft Store version, the COM is not accessible anymore.
Do you know any way to access it ?
I found the problem. Both things were happening, I was using a IUnknown instead of IDispatch, CoExInitialize was badly called, and my COM registration was messed up.
I wanted to extend an existing C++ application to use Evernote. I have downloaded the C++ SDK for Evernote and the Windows SDK for Evernote. The C++ SDK does not have any documentation. It just consists of a series of C++ files dating back to 2013. The Windows SDK documentation relates to C#. A great language, but not what my existing code is written in.
I have built the Thrift Library and linked it with my test application. I can get it to make an HTTP connection, but checkVersion gives me an EOF exception from THttpTransport::refill.
boost::shared_ptr User_Store_Http_Client = boost::shared_ptr(new THttpClient("sandbox.evernote.com", 443, "/edam/user"));
boost::shared_ptr User_Store_Protocol = boost::shared_ptr(new TBinaryProtocol(User_Store_Http_Client));
UserStoreClient* User_Store = new UserStoreClient(User_Store_Protocol, User_Store_Protocol);
User_Store_Http_Client->open();
User_Store->checkVersion("MyApp", evernote::edam::g_UserStore_constants.EDAM_VERSION_MAJOR, evernote::edam::g_UserStore_constants.EDAM_VERSION_MINOR);
The Windows SDK talks about EnSession objects, which don't appear in the C++ SDK? I am assuming that the C++ SDK is a raw EDAM implementation and that the C# API has a higher level to it.
Does anyone have a working example of C++ code that would help me get started? Where should I go for help on using Evernote from C++? Am I flogging a dead horse with this?
I am struggling to understand how I should use the Evernote C++ API and would appreciate some help.
I found this SDK
https://github.com/d1vanov/QEverCloud
Looks promising so far.
We have a web service scenario in which the caller(wrote in Magik(r) programming language ) uses MSXML 6.0 to send a prepared SOAP xml to a webservice. the web method is written in C# using Visual studio 2012 and is published on IIS 7.5 (windows server 2012)
Problem is : the web method does not recieve the parameters, it is called with null arguments to be exact.
It also raises an exception "Object reference not set to an instance of an object" which shows the above situation.
Could this be a compatibility issue? Since all parts are Microsoft technologies it seems a little bit odd but here is some results that may help finding out the calprit.
The caller program works perfect with other .net webservices and sends parameters flawlessly
The caller also works fine with our webservice (in scenario) if the webservice has no parameters.
The webservice works fine with callers application if they are written in .net
The problem was in defining tempuri address. Which should be similar to wsdl but since I was creating the xml myself and sending it through msxml I set the tempuri address wrong which leaded to the problem.
Strange that Microsoft is that sensetive on tempuri, axis webservice don't!
I have a (kind of) database implemented in C++.
Now I want to create a Windows service for querying it, because P-invoking it is not an option, as the database would have to be loaded with every query, which takes several minutes.
But I face several problems:
How can I create a C++ Windows Service in VS2010? The template has been removed (why???), can I use a 2008 template and convert it? If yes: where do I find such a template?
Supposed I manage to create a C++ Windows service: what are my options to communicate with this sevice (from c sharp)? What are the advantages/disadvantages?
I'd be glad for any hint!
Ben
I don't know why, but the template is really gone.
For communicating between your application and the service WCF would be an option. One advantage of WCF is, that you can easily switch the transport layer (HTTP, TCP, Shared Memory)
Have a look at this MSDN page. It describes exactly what you are trying to achieve: Host a WCF Service in a Windows Service. It even contains a simple Windows Service implementation at the end. Unfortunately no C++ but C#.
you might want to take a look at POCO Project,in particular this class. There are examples if you download the code.
you might also want to implement a web service for easy access from any client anywhere through sockets.
What I did some years ago was an COM out-of-process server which was a Windows Service. It worked fine and you can access it from C# (and many other languages ...) easily. If you have no COM experience it might become hard (depending on how complex your interface is).
You should implement the followin functions:
VOID WINAPI ServiceMain(DWORD dwArgc, LPTSTR *lpszArgv);
VOID WINAPI ServiceHandler(DWORD fdwControl);
VOID ReportSvcStatus( DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint );
More info on MSDN. An example: link.
Maybe you can use ! ATL Project and then select Service (EXE).
Best Regards