<!--
* 
*
*  ProLinga-Soap
*
*  Copyright (C) 2002-2008 Xobas Software.
*  All rights reserved.
*  
*  This file is part of ProLinga-Soap.
*
*  ProLinga-Soap is free software: you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  (at your option) any later version.
*
*  ProLinga-Soap is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with ProLinga-Soap. If not, see <http://www.gnu.org/licenses/>.
*
*  More information is available at the following addresses:
*
*  Website     : http://www.prolinga.org
*
*  Email       : prolinga-list@prolinga.org
*
*
-->

<refentry id="prolinga-soap-soap_service">
  <refmeta>
    <refentrytitle>Soap Service</refentrytitle>
    <manvolnum>3</manvolnum>
  <refmiscinfo>ProLinga-Soap Library</refmiscinfo>
</refmeta>

<refnamediv>
  <refname>Soap Service</refname>
  <refpurpose>Classes used to implement SOAP service functionality.</refpurpose>
</refnamediv>

<refsynopsisdiv>
  <title>Synopsis</title>

  <synopsis>
#include &lt;prolinga/Soap.hpp&gt;

class <anchor id="class_PlSoapService"/>PlSoapService
{
        public:
                <link linkend="PlSoapService">PlSoapService</link>();
                ~<link linkend="PlSoapService">PlSoapService</link>();
                <link linkend="int">int</link>       <link linkend="PlSoapService__soapServiceStart">soapServiceStart</link>          (<link linkend="char">char</link> *server_host, 
                                                     <link linkend="int">int</link> server_port,
                                                     <link linkend="int">int</link> num_threads,
                                                     <link linkend="int">int</link> server_comp,
                                                     <link linkend="char">char</link> *log_file,
                                                     <link linkend="int">int</link> log_level);
                ...
};
typedef <link linkend="class_PlSoapService">PlSoapService</link> *PlSoapServicePtr;


class <anchor id="class_PlSoapProcess"/>PlSoapProcess
{
        public:
                <link linkend="PlSoapProcess">PlSoapProcess</link>();
                ~<link linkend="PlSoapProcess">PlSoapProcess</link>();
                <link linkend="xmlDocPtr">xmlDocPtr</link>       <link linkend="PlSoapProcess__getRequest">getRequest</link>          (<link linkend="void">void</link>);
                <link linkend="void">void</link>            <link linkend="PlSoapProcess__putResponse">putResponse</link>         (<link linkend="xmlDocPtr">xmlDocPtr</link> docResponse);
                ...
};
typedef <link linkend="class_PlSoapProcess">PlSoapProcess</link> *PlSoapProcessPtr;


  </synopsis>
</refsynopsisdiv>

<refsect1>
  <title>Description</title>
    <para>
    These classes are used to implement a SOAP service.
    </para>
</refsect1>

<refsect1>
  <title>Details</title>
    <refsect2>
      <title><anchor id="PlSoapService__soapServiceStart"/>PlSoapService::soapServiceStart ()</title>
        <indexterm>
          <primary>PlSoapService::soapServiceStart</primary>
        </indexterm>
        <programlisting><link linkend="int">int</link>       PlSoapService::soapServiceStart           (<link linkend="char">char</link> *server_host
                                                     <link linkend="int">int</link> server_port,
                                                     <link linkend="int">int</link> num_threads,
                                                     <link linkend="int">int</link> server_comp,
                                                     <link linkend="char">char</link> *log_file,
                                                     <link linkend="int">int</link> log_level);
</programlisting>
        <para>
        This function is called to start the Soap service. The service will wait and listen for
        for any requests coming in. Function <parameter>PlSoapLink</parameter> will get called
        for the processing of such a request. Within that function class 
        <link linkend="class__PlSoapProcess">PlSoapProcess</link> is 
        available for the handling of the request and response documents.
        </para>

        <para>Keep in mind that the function <parameter>PlSoapService::soapServiceStart</parameter> will start
        an infinite for-loop, so code placed after this function will not be executed. If however you need to 
        execute code after shutting down the service, you can start this function in a forked process.</para>

        <para>
        </para>
        <variablelist role="params">
          <varlistentry>
            <term><parameter>server_host</parameter>&nbsp;:</term>
            <listitem>
              <simpara> the name or IP number the machine will bind to. Default is localhost.</simpara>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term><parameter>server_port</parameter>&nbsp;:</term>
            <listitem>
              <simpara> the TCP port number the machine will bind to. Default is 8001.</simpara>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term><parameter>num_threads</parameter>&nbsp;:</term>
            <listitem>
              <simpara> the number of threads you want to run with. Default is 5.</simpara>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term><parameter>server_comp</parameter>&nbsp;:</term>
            <listitem>
              <simpara> the level of compression of request/response files before sending (0-9, 9=best).No Default.</simpara>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term><parameter>log_file</parameter>&nbsp;:</term>
            <listitem>
              <simpara> the path and name of the log file. Default is /usr/tmp/prolingaSoap.log.</simpara>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term><parameter>log_level</parameter>&nbsp;:</term>
            <listitem>
              <simpara> the level of logging (0-5).No Default.</simpara>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term><emphasis>Returns</emphasis>&nbsp;:</term>
            <listitem>
              <simpara> error status in case the service falls over.</simpara>
            </listitem>
          </varlistentry>
        </variablelist>
    </refsect2>

    <refsect2>
      <title><anchor id="PlSoapProcess__getRequest"/>PlSoapProcess::getRequest ()</title>
        <indexterm>
          <primary>PlSoapProcess::getRequest</primary>
        </indexterm>
        <programlisting><link linkend="xmlDocPtr">xmlDocPtr</link>       PlSoapProcess::getRequest           (<link linkend="void">void</link>);
</programlisting>
        <para>
        This function returns the current request.
        </para>

        <para>
        </para>
        <variablelist role="params">
          <varlistentry>
            <term><emphasis>Returns</emphasis>&nbsp;:</term>
            <listitem>
              <simpara> the current request as libxml2 document. Do NOT try to free/de-allocate the request, since
              it can make the system unstable. Internal class functions take care of this.</simpara>
            </listitem>
          </varlistentry>
        </variablelist>
    </refsect2>

    <refsect2>
      <title><anchor id="PlSoapProcess__putResponse"/>PlSoapProcess::putResponse ()</title>
        <indexterm>
          <primary>PlSoapProcess::putResponse</primary>
        </indexterm>
        <programlisting><link linkend="void">void</link>       PlSoapProcess::putResponse           (<link linkend="xmlDocPtr">xmlDocPtr</link> docResponse);
</programlisting>
        <para>
        This function stores the response which will get send back to the caller.
        </para>

        <para>
        </para>
        <variablelist role="params">
          <varlistentry>
            <term><parameter>docResponse</parameter>&nbsp;:</term>
            <listitem>
              <simpara> the current response as libxml2 document.</simpara>
            </listitem>
          </varlistentry>
        </variablelist>
    </refsect2>

  </refsect1>
</refentry>

<refentry id="prolinga-soap-soap_client">
  <refmeta>
    <refentrytitle>Soap Client</refentrytitle>
    <manvolnum>3</manvolnum>
  <refmiscinfo>ProLinga-Soap Client Library</refmiscinfo>
</refmeta>

<refnamediv>
  <refname>Soap Client</refname>
  <refpurpose>Class used to send a request to and receive a response from a Web Service.</refpurpose>
</refnamediv>

<refsynopsisdiv>
  <title>Synopsis</title>

  <synopsis>
#include &lt;prolinga/SoapClient.hpp&gt;

class <anchor id="class_PlSoapClient"/>PlSoapClient
{
        public:
                <link linkend="PlSoapClient">PlSoapClient</link>();
                ~<link linkend="PlSoapClient">PlSoapClient</link>();
                <link linkend="int">xmlDocPtr</link>       <link linkend="PlSoapClient__soapCall">soapCall</link>          (const <link linkend="xmlDocPtr">xmlDocPtr</link> docRequest, 
                                                   const <link linkend="char">char</link> *serviceEndPoint);
                ...
};
typedef <link linkend="class_PlSoapClient">PlSoapClient</link> *PlSoapClientPtr;


  </synopsis>
</refsynopsisdiv>

<refsect1>
  <title>Description</title>
    <para>
    This class is used to be able to send/receive requests/responses to/from a Web Service.
    </para>
</refsect1>

<refsect1>
  <title>Details</title>
    <refsect2>
      <title><anchor id="PlSoapClient__soapCall"/>PlSoapClient::soapCall ()</title>
        <indexterm>
          <primary>PlSoapClient::soapCall</primary>
        </indexterm>
        <programlisting><link linkend="xmlDocPtr">xmlDocPtr</link>       PlSoapClient::soapCall           (const <link linkend="xmlDocPtr">xmlDocPtr</link> docRequest,
                                                  const <link linkend="char">char</link> *serviceEndPoint);
</programlisting>
        <para>
        This function sends off a request to the Web Service defined in the parameter <parameter>serviceEndPoint</parameter>. It
        returns a response.
        </para>

        <para>
        </para>
        <variablelist role="params">
          <varlistentry>
            <term><parameter>docRequest</parameter>&nbsp;:</term>
            <listitem>
              <simpara> the request as a libxml2 document.</simpara>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term><parameter>serviceEndPoint</parameter>&nbsp;:</term>
            <listitem>
              <simpara> the hostname or IP number and the TCP port number of the Web Service seperated by a colon(:).
              Example: localhost:8001</simpara>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term><emphasis>Returns</emphasis>&nbsp;:</term>
            <listitem>
              <simpara> the response as a libxml2 document.</simpara>
            </listitem>
          </varlistentry>
        </variablelist>
    </refsect2>

  </refsect1>
</refentry>
