gsoap is an open source project that can be used to generate Simple Object Access Protocol (SOAP) clients and servers. mod_gsoap allows you to run these services integrated in process inside the Microsoft Internet Information server. It is implemented as an ISAPI extension dll and so can be run together with all other services on IIS.
There is an open source project at http://www.cs.fsu.edu/~engelen/soap.html which implements SOAP in C++. Servers created there can be run standalone or as cgi. This is a contribution to get a production quality Web service for MS-Internet Information Server that drives SOAP servers. All the source code and documentation is available for download.
Existing gsoap servers can be compiled without any change in the source code to run inside IIS. There is one dll, mod_gsoap.dll, an Isapi extension that serves SOAP requests. From the query string in the request the extension finds out which server should be used and the appropriate server dll (dynamic link library) is dynamically loaded at runtime, if not already present. This SOAP server creates the response which is sent back to the client by IIS.
To add more servers only the new dlls need to be compiled, the ISAPI interface need not be changed for that, the Web Service not even restarted.
This distribution contains also the standard gsoap calc.h - server to demonstrate operation. The source code of that example was not changed from the standard distribution.
Once your gsoap service works as a standalone application, you only need to recompile it as a dll and copy that dll to your IIS - virtual directory.
In spite of that instructions can be found below for debugging the IIS extension under Windows™ 2000 and XP.
To build the mod_gsoap ISAPI extension for Windows you need the following:
To run mod_gsoap ISAPI extension you need either Windows™ NT 4.0 with Windows™ NT Option Pack 4.0, Windows™ 2000 or Windows XP or higher, where IIS™ is integrated.
There is also a dime sample in the code that shows you how to send and receive dime attachments (binary files etc). This sample also shows how to use module initializer and terminators. When the dll is loaded into IIS for the first time the function mod_gsoap_init is called. Here you can initialize database connections or whatever you like. mod_gsoap_terminate is called when the dll is unloaded again. A good place to clean up.
The URL for the new servers is always "http://localhost/gsoap/mod_gsoap.dll?mydll" where mydll is the name of our dll without the .dll extension.
If you have problems creating the virtual root as descibed above here a short how-to: Open from control panel "Administrative Tools" and then "Internet Services Manager" (under Windows™ NT 4.0 you find it in the Option Pack submenus). Click with the right mouse button on "Default Web Site", then select "New" and "Virtual Directory". Click "Next" and enter as Alias the name you want to give to the url, e.g. "soap", press "Next" again. Then browse for the directory where your dll that you have built in the previous step is, for example "c:\Inetpub\wwwroot\gsoap". Press "Next", then in the access permissions, disable all permissions except "Excute (such as ISAPI applications or CGI)", this must be enabled. Click "Next" and "Finish". For testing it might be a good idea to enable the "Browse" permission and then browse to "http://localhost/gsoap".
The ISAPI SOAP Binding can run together with all other Internet services on your machine on port 80 (or any other, as configured in IIS). It is an extension for IIS. The request your SOAP client must submit is made up of 2 parts. Here is an example:
"http://127.0.0.1/gsoap/mod_gsoap.dll?mySoap"
The part before the question mark '?' is the url for the isapi binding dll. This is evaluated by IIS. In this sample the service is on the same machine as the server. Instead of "127.0.0.1" you can use the DNS address of your server, of course. gsoap is the virtual root created above and mod_gsoap.dll is the generic ISAPI binding from this contribution. The extension mod_gsoap.dll evaluates the part behind the '?', which is in this example mySoap. To this the string ".dll" is appended and the dll is loaded. Due to security reasons only dlls from the same directory are allowed. If you want to do special initialization in your dll you may want to add and export a "DllMain" function, which will be called when the IIS process attaches to your all and before it detaches it. Do not rely on the Thread attach/detach callback, in my experience IIS does not always call DllMain in your dll if these threads were already in the thread pool before your dll was loaded. Use thread local storage instead.
There are a lot to say about debugging of course. Please make sure that your gsoap server works as a standalone server and client before you continue to use it inside IIS.
For Debugging with Win2000 I added two .reg files, that switch debugging of IIS on and off (see Q273639 and related), and a start and stop command in the Makefile to start and stop iis debugging. Make sure that the path to msdev is in the System environment variables ("PATH") of the system account (not only of your own user account, this is not seen by IISAdmin).
If you want to debug, you must set the dll to run in-proccess. Right-click on the gsoap virtual root in internet service manager and set the "Appication Protection" to "Low (IIS Process)". Remove the "Enable Session State" and buffering and Parent Paths. Don't forget to allow the IISAdmin and WWW Service to interact with desktop.
I added some commands to a Windoze "Makefile". To make live easier. See the Makefile yourself, there are commands to start and stop debugging of IIS and cleaning the directory. The very advanced Windoze user can even compile everything without a mouse by running one command. Be sure that msdev.exe and nmake.exe are in your PATH. Then enter from the commandline:
nmake
Such advanced users should also consider to use the linux/unix version mod_gsoap.so, also available on this site. ;-)
Enjoy!
with best regards Christian Aberger
C:\>calcclnt.exe add 3 5
SOAP FAULT: SOAP-ENV:Client
"End of file or no input"
Detail: http://localhost/gsoap/mod_gsoap.dll?calc
Answer:
Step one: Could you please compile calcclnt.exe with the DEBUG option.
(in Preprocessor Definitions add DEBUG).
Delete all .log files from the current directory if any. Then run
again calcclnt.exe add 3 5
Then you should get 3 files with the extension ".log" in the current
directory. Please read what is in there.
Step two: Make sure that dumpbin.exe is in your PATH (it can be found
somewhere in Visual Studio 6.0 binaries).
Open a command shell, change to the directory where mod_gsoap.dll is
located (C:\Inetpub\wwwroot\gsoap) and type the following:
dumpbin /exports calc.dll. This output should contain the exported symbols that are listed
in the stdsoap2.def file. If you don't find these symbols you propably forgot to add the stdsoap2.def file
described here.