📄 examples_notes.txt
字号:
eSOAP toolkit demo package
--------------------------
1. Introduction
This section describes the eSOAP toolkit demo package. It consists of the eSOAP
runtime for MS Windows, the demo version of the esoapcg compiler and some
source code examples to help developers learning how to use the toolkit
( run-time ) and how to specify service interfaces using the esoap code
generator (esaopcg).
All examples are using the high level code generator for C++. The same concepts
would apply to the java back-end, but we are going to target only C++ development
at this time.
All examples here assume that a developer is using Windows as "the test bed"
platform. eSoap is available on many platforms, and all examples run fine on other
platforms, given that the proper makefiles are written.
Your feedback, inputs and comments are welcome!
2. Setup
Getting these examples working is quite easy, assuming that you have VC++ installed
on your Windows system. It is recommended to use NT or W2K.
step 1: Installing the eSoap toolkit.
You need to grab and install the eSoap binaries for Windows( VC++ ).
Please, goto this link below to download the archive with the esoap binaries.
http://esoap.embedding.net:8080/esoap/esoap-bin-windows-vc6-0.8.zip
+ Unzip the archive in some directory ( default: c:\esoap ).
NOTE: if you decide to install the esoap runtime in another location, you must
update each one of the Visual Studio workspaces. It can be hard, and it
is recommended to install, initially, in this default location.
+ Add esoapvc6.dll in the path of your system.
step 2: Installing the examples.
Please, goto the link below to download the archive with the esoap examples.
http://esoap.embedding.net:8080/esoap/esoap-examples-1.0.zip
+ Unzip the archive in some directory.
NOTE: if you install the esoap runtime in a location other than c:\esoap, you must
modify the VC++ projects accordingly.
step 3 (optional): Installing the eSoap Code Generator.
Please, to go the link below to download the archive with the code generator demo.
http://esoap.embedding.net:8080/esoap/esoapcg-windows-demo-1.08.zip
NOTE: this is one optional step. You need this to create new examples or trying to
create your own services.
+ Unzip the archive in some directory.
+ Add esoapcg.exe in the path of your system.
All files in the "auto_gen" directories of the examples are generated by the code
generator( esoapcg.exe ).
Example:
esoapcg -s -d auto_gen echo.esd
3. Examples
VERY IMPORTANT: All examples MUST be set to compile in "Release" mode because
the esoap binary is compiled, and released in this mode. To change that and to
compile in "Debug" mode, your must have access to the esoap source code.
So, before compiling each example, please make the active configuration to
be "Release".
For each example you have to run the "server" first and then use the "client"
to talk to the server. You can only run one server at the time, because they
all use the same port number. You can change these values to match your needs.
a) Echo -- Simple types handling
A simple example that "echo" an integer. The goal is to show how to use
simple types. Pay attention to echo.esd
b) Array -- Arrays & basic authentication
A simple example that "echo" an array of integers. The goal is to show eSoap
dealing with array of simple types. Pay attention to array.esd, and
esoap_Vector< x > is actually the standard C++ std::vector< x > class.
Another important thing that this example shows is how eSoap handle security
using "basic authetication".
c) Ctype -- Complex types handling
An example that shows to use esoap with user defined types. Another important
aspect of this example is how OUT parameters are used. It is important to study
the ctype.esd to see how new types are defined.
d) Binary -- binary information & files
A simple example show how "binary information" can be exchanged using eSoap.
This particular example, the server reads an image ( gif file ) called
"my_quaker.gif" in the current directory that the server is running,
and it is saved by the client program as "myImage.gif".
You can use IE to verify the image.
e) tts -- interop with others stacks
A text-to-speech convert. This client program uses the OjbectSpace Web
services from Xmethods ( www.xmethods.com ). A few fixes to the WSDL
has been done. The WSDL was used to get one ESD file, and the proxy
stubs were created.
The process is quite simple to create the proxy stubs:
saxon exttospeech.wsdl \esoapcg\wsdl2esd.xsl >texttospeech.esd
\esoapcg\esoapcg -d auto_gen texttospeech.esd
f) callback -- async events & notifications
This example is a bit more complicated and it shows how to do asynchronous
notifications ( callbacks ) using eSoap.
g) add_two -- This is the simple "add two integers" example that comes with the
eSoap distribution, but here using the high level API.
h) get_temp -- interop with others stacks
The simple "get_temp" example from Xmethods Xmethods ( www.xmethods.com ).
The process is quite simple to create the proxy stubs:
saxon get_temp.wsdl \esoapcg\wsdl2esd.xsl >get_temp.esd
\esoapcg\esoapcg -d auto_gen get_temp.esd
4. Compiling the Examples
You can use the VC++ IDE to compile each example, using each one specific
workspace, or you can use the makefile.vc6 that invokes Visual Studio for you.
Just type:
nmake -f makefile.vc6
This would build all examples.
5. Exporting WSDLs
It is very easy to export a WSDL file from the ESD file. You need a XSLT
processor. In this example, Instant-Saxon is used.
saxon \eosapcg\esd2wsdl.xsl >service.wsdl
Example for ctype.
saxon ctype.esd \esoapcg\wsd2wsdl.xsl >ctype.wsdl
6. Creating new Services
Steps to create a new Visual Studio project:
+ update the includes, add c:\esoap\include to the list of includes.
+ add the library path c:\esoap\lib to the lib path list.
+ add the esoap library to the list of libraries ( esoapvc6.lib ).
+ make sure that the macro WIN32 is defined.
+ if you are using DLL, extra care must be taken.
Select DLL + Multi-threaded options.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -