@ -3,7 +3,7 @@ A lightweight C++ SOAP client library.
## Usage
## Usage
Firstly, please install SoapUI if you don't have it. We need SoapUI to help us parse the WSDL and generate sample requests for each web service API. The open source version is good enough.
Firstly, please install SoapUI if you don't have it. We need SoapUI to generate sample requests for each web service operation. The open source version is good enough.
Take the calculator web service provided by ParaSoft as an example. Download the WSDL from http://ws1.parasoft.com/glue/calculator.wsdl, create a SOAP project within SoapUI (remember to check "Create sample requests for all operations?"), you will see the sample request for "add" operation as the following:
Take the calculator web service provided by ParaSoft as an example. Download the WSDL from http://ws1.parasoft.com/glue/calculator.wsdl, create a SOAP project within SoapUI (remember to check "Create sample requests for all operations?"), you will see the sample request for "add" operation as the following:
```xml
```xml
@ -21,11 +21,9 @@ Take the calculator web service provided by ParaSoft as an example. Download the
In order to call the "add" operation, we have to send a HTTP request with the above SOAP envelope as the content. Let's see how to do this with csoap.
In order to call the "add" operation, we have to send a HTTP request with the above SOAP envelope as the content. Let's see how to do this with csoap.
```cpp
```cpp
bool Call() {
bool All() {
std::string operation = "add";
// Create a SOAP request.
csoap::SoapRequest soap_request("add");
// Create a SOAP request which abstracts the SOAP envelope.
// Send the HTTP request and get the HTTP response.
// Send the HTTP request and get the HTTP response.
@ -76,16 +74,16 @@ bool Call() {
}
}
```
```
It's not that complicated. But you can't code like this for each operation. You have to do some encapsulation, make a general function, add a base class, etc. Check the "demo" folder for the detailed example.
It's not that complicated. But you can't code like this for each operation. You have to do some encapsulation, make a general function, add a base class, and so on. Check the "demo" folder for the detailed example.
## Limitations
## Limitations
- Only support HTTP 1.1.
- Only support HTTP 1.1.
- Only support int, double, bool and string parameters.
- Only support `int`, `double`, `bool` and `string` parameters.
- Only support UTF-8 content.
- Only support UTF-8 encoded content.
## Dependencies
## Dependencies
- The TCP socket client is based on Boost.Asio.
- The TCP socket client is based on Boost.Asio.
- The XML parsing is based on TinyXml or PugiXml, a macro CSOAP_USE_TINYXML controls which one to use.
- The XML parsing is based on TinyXml or PugiXml, a macro CSOAP_USE_TINYXML controls which one to use.
- Build system is CMake, but it should be easy to add into your project.
- Build system is CMake, but it should be easy to integrate into your project.