Genivia Home Documentation
The WinInet plugin

updated Wed Jun 15 2016
 
The WinInet plugin

Table of Contents

By Jack Kustanowitz, Brodie Thiesfield, and Robert van Engelen.

Overview

The WinInet plugin for gSOAP enables client applications (not servers) to communicate through Microsoft's WinInet API on Windows. This offers all of the advantages of WinInet managed through the Internet Options control panel of Windows, such as HTTP (proxy) authentication, TLS/SSL, and HTTP compression. Therefore, "if IE works, gSOAP works." since these options are shared by IE.

The WinInet project home is at http://code.google.com/p/gsoapwininet.

This plugin is licensed differently than the other plugins for gSOAP. It is licensed under the MIT license and can be used with GPLv2 and the commercial license for gSOAP.

Features

Limitations

Using the WinInet plugin with gSOAP

Add the gsoapWinInet2.h and gsoapWinInet2.cpp files to your project. If you have a C project, change the extension to .c. Disable "precompiled headers" for the .cpp file.

In your source code for the client, register the WinInet plugin with soap_register_plugin(soap, wininet_plugin) after creation and initialization of the soap context.

For example, when using a proxy object in C++ generated with soapcpp2 -j:

#include "gsoapWinInet.h"
#include "soapProxy.h"
Proxy proxy;
proxy.soap->connect_timeout = 15; // 15 sec: this will be used by wininet too
proxy.soap->recv_timeout = 10; // 10 sec: this will be used by wininet too
proxy.soap->send_timeout = 10; // 10 sec: this will be used by wininet too
soap_register_plugin(proxy.soap, wininet_plugin);
...
proxy.destroy(); // delete deserialized data

and in plain C/C++, that is, without a proxy object:

#include "soapH.h"
#include "gsoapWinInet.h"
struct soap soap;
soap_init(&soap);
soap.connect_timeout = 15; // 15 sec: this will be used by wininet too
soap.recv_timeout = 10; // 10 sec: this will be used by wininet too
soap.send_timeout = 10; // 10 sec: this will be used by wininet too
soap_register_plugin(&soap, wininet_plugin);
...
soap_destroy(&soap); // delete deserialized data
soap_end(&soap); // delete temporary and C-based deserialized data
soap_done(&soap);

Please make sure to compile all sources in C++ compilation mode. If you migrate to a project file such as .vcproj, please set CompileAs="2" in your .vcproj file.

WinInet plugin options

To control the WinInet's HttpOpenRequest options, register the WinInet plugin with soap_register_plugin_arg() and supply an argument that is passed on to HttpOpenRequest. For example:

soap_register_plugin_arg(&soap, wininet_plugin,
(void*)INTERNET_FLAG_IGNORE_CERT_CN_INVALID);

See the MSDN documentation on HttpOpenRequest for details of the HttpOpenRequest flags. The wininet.h header must be included to use these flags.

If there are errors in sending the HTTP request which would cause a dialog box to be displayed in IE (for instance, invalid certificates on an HTTPS connection), then a dialog will also be displayed by this library. At the moment is is not possible to disable the UI. If you wish to remove the UI then you will need to hack the source to remove the dialog box and resolve the errors programmatically, or supply the appropriate flags to soap_register_plugin_arg() to disable the unwanted warnings.

License

The licence text below is the boilerplate "MIT Licence" used from: http://www.opensource.org/licenses/mit-license.php

Copyright (c) 2009, Jack Kustanowitz, Brodie Thiesfield, Robert van Engelen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contributors