Commit ed08af5a authored by Andreas Tille's avatar Andreas Tille
Browse files

New upstream version 3.0.5

parent 452abde7
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+10 −0
Original line number Diff line number Diff line
libzeep_Data/
obj
.vscode/ipch
*.a
*.so*
compile_commands.json
doc/bin
debian/
.pc
libzeep-*.tgz

.travis.yml

0 → 100644
+17 −0
Original line number Diff line number Diff line
dist: xenial

before_install:
  - sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu xenial universe"
  - sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu xenial main"
  - sudo apt-get install debian-keyring debian-archive-keyring
  - sudo apt-key update
  - sudo apt-get update
  - sudo apt-get install libboost-all-dev

install: true

language: cpp

compiler: clang

script: make && make -C tests
+82 −33
Original line number Diff line number Diff line
Libzeep was developed to make it easy to create SOAP servers. And since working with SOAP means working with XML and no decent C++ XML library existed on my radar I've created a full XML library as well.

The XML part of libzeep consists of a validating parser, a DOM(-like) node implementation, an XPath search engine and a XML writer/formatter. The validation works based on DOCTYPE definitions, XML schema support will be added in a later release.

The performance of the parser is not optimal yet although it performs very decently. If speed is critical and you really need that few percent saving you can choose to use expat as a parser instead.

Please note that libzeep aims to provide a fully compliant XML processor as specified by the W3 organisation (see: http://www.w3.org/TR/xml ). This means it is as strict as the standard requires and it stops processing a file when a validation of the well-formedness is encountered, or when a document appears to be invalid when it is in validating mode. Error reporting is done in this case, although I admit that error reporting should be improved.

The SOAP server part of libzeep makes it very easy to create a SOAP server software in C++. You use it to export a C++ object's methods as SOAP actions. The library generates a WSDL on-the-fly for the exported actions and it also has a REST style interface.

libzeep requires the Boost libraries and currently requires at least version 1.36 of Boost since it uses the new asio library for network I/O. The current version of libzeep has been tested with boost 1.39 and newer only.

To use libzeep, you have to edit the makefile and make sure the paths to your installation of boost libraries are correct. After this you simply type 'make zeep-test' and a 'zeep-test' executable is build. You can also cd into the tests directory and build the two test applications called xpath-test and parser-test. For Windows users there's a VC solution file in the msvc directory.

XML Library -- usage

Using the XML library of libzeep is fairly trivial. The first class you use is the zeep::xml::document class. You can use this class to read XML files and write them out again. Reading and writing is strictly done using stl iostreams. Make sure you open these streams in binary mode, random parsing errors will occur if you don't when running in Windows.
[![Build Status](https://travis-ci.org/mhekkel/libzeep.svg?branch=master)](https://travis-ci.org/mhekkel/libzeep)

About libzeep
=============

Libzeep was developed to make it easy to create SOAP servers. And since
working with SOAP means working with XML and no decent C++ XML library
existed on my radar I've created a full XML library as well.

The XML part of libzeep consists of a validating parser, a DOM(-like) node
implementation, an XPath search engine and a XML writer/formatter. The
validation works based on DOCTYPE definitions, XML schema support will be
added in a later release.

The performance of the parser is not optimal yet although it performs very
decently. If speed is critical and you really need that few percent saving
you can choose to use expat as a parser instead.

Please note that libzeep aims to provide a fully compliant XML processor as
specified by the W3 organisation (see: http://www.w3.org/TR/xml ). This means
it is as strict as the standard requires and it stops processing a file when
a validation of the well-formedness is encountered, or when a document
appears to be invalid when it is in validating mode. Error reporting is done
in this case, although I admit that error reporting should be improved.

The SOAP server part of libzeep makes it very easy to create a SOAP server
software in C++. You use it to export a C++ object's methods as SOAP actions.
The library generates a WSDL on-the-fly for the exported actions and it also
has a REST style interface.

libzeep requires the Boost libraries and currently requires at least version
1.36 of Boost since it uses the new asio library for network I/O. The current
version of libzeep has been tested with boost 1.55 and newer only.

To use libzeep, you have to edit the makefile and make sure the paths to your
installation of boost libraries are correct. After this you simply type
`make zeep-test` and a `zeep-test` executable is build. You can also cd into
the tests directory and build the two test applications called xpath-test and
parser-test. For Windows users there's a VC solution file in the msvc
directory.

Full documentation for libzeep in docbook format can be found at
[www.hekkelman.com/libzeep-doc](http://www.hekkelman.com/libzeep-doc/)

## XML Library -- usage

Using the XML library of libzeep is fairly trivial. The first class you use
is the `zeep::xml::document` class. You can use this class to read XML files
and write them out again. Reading and writing is strictly done using stl
iostreams. Make sure you open these streams in binary mode, random parsing
errors will occur if you don't when running in Windows.

	#include <fstream>
	#include "zeep/xml/document.hpp"
@@ -29,22 +63,34 @@ Using the XML library of libzeep is fairly trivial. The first class you use is t
	ifstream file("/...", ios::binary); // avoid CRLF translation
	file >> doc;
	
Now that you have a document, you can walk its content which is organised in nodes. There are several nodes classes, the most interesting for most is xml::element. These elements can have children, some of which are also elements.
Now that you have a document, you can walk its content which is organised in
nodes. There are several nodes classes, the most interesting for most is
`xml::element`. These elements can have children, some of which are also
elements.

Internally the nodes are stored as linked lists. However, to conform to STL coding practices, xml::element can used like a container. The iterator of xml::element (which it inherits from its base class xml::container) only returns child xml::element objects skipping over comments and processing instructions.
Internally the nodes are stored as linked lists. However, to conform to STL
coding practices, `xml::element` can used like a container. The iterator of
`xml::element` (which it inherits from its base class `xml::container`) only
returns child `xml::element` objects skipping over comments and processing
instructions.

So, to iterate over all elements directly under the first element of a document, we do something like this:
So, to iterate over all elements directly under the first element of a
document, we do something like this:

	xml::element& first = *doc.child();
	for (xml::document::iterator e = first.begin(); e != first.end(); ++e)
		cout << e.name() << endl;

Likewise you can iterate over the attributes of an xml::element, like this:
Likewise you can iterate over the attributes of an `xml::element`, like this:

	for (xml::element::attribute_iterator a = e.attr_begin(); a != e.attr_end(); ++a)
		cout << a->name() << endl;

More often you're interested in a specific element among many others. Now you can recursively iterate the tree until you've found what you're looking for, but it is way easier to use xpaths in that case. Let say you need the element 'book' having an attribute 'title' with value 'Du côté de chez Swann', you could do this:
More often you're interested in a specific element among many others. Now you
can recursively iterate the tree until you've found what you're looking for,
but it is way easier to use xpaths in that case. Let say you need the element
`book` having an attribute `title` with value *Du côté de chez Swann*, you
could do this:

	xml::element* book = doc.find("//book[@title='Du côté de chez Swann']");

@@ -56,15 +102,18 @@ And the content, contained in the text nodes of an element:
	
	cout << book->content() << endl;

And writing out an XML file again can be done by writing an xml::document:
And writing out an XML file again can be done by writing an `xml::document`:

	cout << doc;
	
Or by using xml::writer directly.
Or by using `xml::writer` directly.

libzeep has XML Namespace support. The qname method of the nodes returns a qualified name, that is the namespace prefix, a colon and the localname contatenated. (Something like 'ns:book'). The method name() returns the qname() with its prefix stripped off.
libzeep has XML Namespace support. The qname method of the nodes returns a
qualified name, that is the namespace prefix, a colon and the localname
contatenated. (Something like `ns:book`). The method name() returns the
qname() with its prefix stripped off.

SOAP Server -- usage
## SOAP Server -- usage

Have a look at the zeep-test.cpp file to see how to create a server. This
example server is not entirely trivial since it has three exported methods
@@ -86,7 +135,7 @@ that allow more than one value.

The steps to create a server are:

Create a new server object that derives from soap::server. The constructor
Create a new server object that derives from `soap::server`. The constructor
of this object should call the inherited constructor passing it the
namespace and the service name for this new SOAP server as well as the
internet address and port to listen to.
@@ -102,11 +151,11 @@ action in the WSDL. To the outside world this method will look like it has
multiple output parameters. This was done to be compatible with another
popular SOAP tool but the result may be a bit confusing at times.

To register the methods you have to call the inherited 'register_action'
To register the methods you have to call the inherited `register_action`
method which takes four parameters:

- the name of the action as it is published
- the pointer for your server object, usually it is 'this'.
- the pointer for your server object, usually it is `this`.
- a pointer to the method of your server object you want to export
- an array of pointers to the exported names for each of the parameters
	of the exported method/action. The size of this array should be exactly
@@ -133,14 +182,14 @@ The next thing you need for each struct is to set its exported name using the
SOAP_XML_SET_STRUCT_NAME macro.

And that's it. The moment the constructor is done, your server is ready to
run. You can start it by calling the 'run' method, normally you do this from
run. You can start it by calling the `run` method, normally you do this from
a new thread. The servers will start listening to the address and port you
specified. Beware though that the server is multithreaded and so your exported
methods should be reentrant. The number of threads the server will use can be
specified in the constructor of the soap::server base class.
specified in the constructor of the `soap::server` base class.

If your server is behind a reverse proxy, you set the actual location in the
WSDL from which it is accessible by calling the server's set_location method.
WSDL from which it is accessible by calling the server's `set_location` method.

Inside your server method you have access to the ostream object used to write
out log entries by using the inherited log() member function.
@@ -148,6 +197,6 @@ out log entries by using the inherited log() member function.
That's it.

This is a first release, please send all the problems and/or bugs you encounter
to: m.hekkelman@cmbi.ru.nl
to: maarten@hekkelman.com

-maarten hekkelman
+0 −46
Original line number Diff line number Diff line
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Macro SOAP_SERVER_HAS_PREFORK</title>
<link rel="stylesheet" href="boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="libzeep 3.0">
<link rel="up" href="index/s05.html#header..home.maarten.projects.libzeep.zeep.config_hpp" title="Header &lt;/home/maarten/projects/libzeep/zeep/config.hpp&gt;">
<link rel="prev" href="SOAP_XML_HAS_EXPAT_SUPPORT.html" title="Macro SOAP_XML_HAS_EXPAT_SUPPORT">
<link rel="next" href="zeep/dispatcher.html" title="Class dispatcher">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="SOAP_XML_HAS_EXPAT_SUPPORT.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="index/s05.html#header..home.maarten.projects.libzeep.zeep.config_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="zeep/dispatcher.html"><img src="images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="SOAP_SERVER_HAS_PREFORK"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Macro SOAP_SERVER_HAS_PREFORK</span></h2>
<p>SOAP_SERVER_HAS_PREFORK</p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="index/s05.html#header..home.maarten.projects.libzeep.zeep.config_hpp" title="Header &lt;/home/maarten/projects/libzeep/zeep/config.hpp&gt;">/home/maarten/projects/libzeep/zeep/config.hpp</a>&gt;

</span>SOAP_SERVER_HAS_PREFORK</pre></div>
<div class="refsect1">
<a name="idp35662064"></a><h2>Description</h2>
<p>The http server implementation in libzeep can use a preforked mode. That means the main process listens to a network port and passes the socket to a client process for doing the actual handling. The advantages for a setup like this is that if the client fails, the server can detect this and restart the client thereby guaranteeing a better uptime. </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2012 Maarten L. Hekkelman<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="SOAP_XML_HAS_EXPAT_SUPPORT.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="index/s05.html#header..home.maarten.projects.libzeep.zeep.config_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="zeep/dispatcher.html"><img src="images/next.png" alt="Next"></a>
</div>
</body>
</html>

doc/html/SOAP_XML_ADD_ENUM.html

deleted100644 → 0
+0 −50
Original line number Diff line number Diff line
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Macro SOAP_XML_ADD_ENUM</title>
<link rel="stylesheet" href="boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="libzeep 3.0">
<link rel="up" href="index/s05.html#header..home.maarten.projects.libzeep.zeep.xml.serialize_hpp" title="Header &lt;/home/maarten/projects/libzeep/zeep/xml/serialize.hpp&gt;">
<link rel="prev" href="SOAP_XML_SET_STRUCT_NAME.html" title="Macro SOAP_XML_SET_STRUCT_NAME">
<link rel="next" href="zeep/xml/unicode.html" title="Type definition unicode">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="SOAP_XML_SET_STRUCT_NAME.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="index/s05.html#header..home.maarten.projects.libzeep.zeep.xml.serialize_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="zeep/xml/unicode.html"><img src="images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="SOAP_XML_ADD_ENUM"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Macro SOAP_XML_ADD_ENUM</span></h2>
<p>SOAP_XML_ADD_ENUM &#8212; A macro to add the name of an enum value to the serializer. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="index/s05.html#header..home.maarten.projects.libzeep.zeep.xml.serialize_hpp" title="Header &lt;/home/maarten/projects/libzeep/zeep/xml/serialize.hpp&gt;">/home/maarten/projects/libzeep/zeep/xml/serialize.hpp</a>&gt;

</span>SOAP_XML_ADD_ENUM(e, v)</pre></div>
<div class="refsect1">
<a name="idp45478992"></a><h2>Description</h2>
<p>To be able to correctly use enum values in a WSDL file or when serializing, you have to specify the enum values.</p>
<p>E.g., if you have a struct name Algorithm with values 'vector', 'dice' and 'jaccard' you would write:</p>
<p>&gt; enum Algorithm { vector, dice, jaccard }; &gt; SOAP_XML_ADD_ENUM(Algorithm, vector); &gt; SOAP_XML_ADD_ENUM(Algorithm, dice); &gt; SOAP_XML_ADD_ENUM(Algorithm, jaccard);</p>
<p>An alternative (better?) way to do this is:</p>
<p>&gt; zeep::xml::enum_map&lt;Algorithm&gt;::instance("Algorithm").add_enum() &gt; ("vector", vector) &gt; ("dice", dice) &gt; ("jaccard", jaccard); </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2012 Maarten L. Hekkelman<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="SOAP_XML_SET_STRUCT_NAME.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="index/s05.html#header..home.maarten.projects.libzeep.zeep.xml.serialize_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="zeep/xml/unicode.html"><img src="images/next.png" alt="Next"></a>
</div>
</body>
</html>
Loading