source: sources/src/rpcXmlClient.cc @ 1439:b23bfdd8a935

Revision 1439:b23bfdd8a935, 2.7 KB checked in by niam, 2 years ago (diff)

change contact info

Line 
1/***************************************************************************
2 *            rpcXmlClient.cc
3 *
4 *  Wed Apr 09 2008
5 *  Copyright  2008  Dmytro Milinevskyy
6 *  milinevskyy@gmail.com
7 ****************************************************************************/
8
9/*
10 *  This program is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU Lesser General Public License version 2.1 as published by
12 *  the Free Software Foundation;
13 *
14 *  This program is distributed in the hope that it will be useful,
15 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *  GNU Library General Public License for more details.
18 *
19 *  You should have received a copy of the GNU Lesser General Public License
20 *  along with this program; if not, write to the Free Software
21 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24/**
25 * vim indentation settings
26 * set tabstop=4
27 * set shiftwidth=4
28 */
29
30#include <libdodo/directives.h>
31
32#include <libdodo/rpcXmlClient.h>
33#include <libdodo/types.h>
34#include <libdodo/dataFormatXmlNode.h>
35#include <libdodo/dataFormatXmlProcessor.h>
36#include <libdodo/rpcClient.h>
37#include <libdodo/rpcXmlMethod.h>
38#include <libdodo/rpcXmlResponse.h>
39#include <libdodo/rpcResponse.h>
40#include <libdodo/ioChannel.h>
41
42using namespace dodo::rpc::xml;
43
44client::client(const io::channel &io) : rpc::client(io),
45                                        rqEncoding("UTF-8")
46{
47}
48
49//-------------------------------------------------------------------
50
51client::~client()
52{
53}
54
55//-------------------------------------------------------------------
56
57void
58client::setRequestEncoding(const dodo::string &a_encoding)
59{
60    rqEncoding = a_encoding;
61}
62
63//-------------------------------------------------------------------
64
65dodo::string
66client::responseEncoding()
67{
68    return rpEncoding;
69}
70
71//-------------------------------------------------------------------
72
73void
74client::processCallRequest(const rpc::method &meth)
75{
76    dodo::data::format::xml::processor xmlValue;
77
78    xmlValue.make(method::methodToXml(meth), rqEncoding, "1.0", io);
79
80    io.flush();
81}
82
83//-------------------------------------------------------------------
84
85dodo::rpc::response
86client::processCallResult()
87{
88    dodo::data::format::xml::processor xmlValue;
89
90    dodo::data::format::xml::__definition__ xmlMethodResponse;
91    xmlMethodResponse.name = "methodResponse";
92    xmlMethodResponse.allChildren = true;
93
94    dodo::data::format::xml::node node = xmlValue.process(xmlMethodResponse, io);
95
96    rpEncoding = xmlValue.information().encoding;
97
98    return response::xmlToResponse(node);
99}
100
101//-------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.