]> err.no Git - sope/blob - sope-appserver/NGXmlRpc/NGXmlRpcClient.h
include config.make in makefiles
[sope] / sope-appserver / NGXmlRpc / NGXmlRpcClient.h
1 /*
2   Copyright (C) 2000-2004 SKYRIX Software AG
3
4   This file is part of OpenGroupware.org.
5
6   OGo is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 // $Id$
22
23 #ifndef __NGXmlRpcClient_H__
24 #define __NGXmlRpcClient_H__
25
26 #import <Foundation/NSObject.h>
27
28 /*
29   NGXmlRpcClient
30   
31   This class is a raw XML-RPC client based on WOHTTPConnection. To see how
32   it works, take a look at the xmlrpc_call.m tool included in SOPE 4.3.
33
34   XML-RPC over Unix domain sockets. NGXmlRpcClient (will) support XML-RPC over
35   a Unix domain socket, as used in the ximian_xmlrpclib.py. The transport
36   protocol used is "$body$\r\n\r\n".
37   
38   Usage:
39     NGXmlRpcClient *server;
40     
41     server =
42       [[NGXmlRpcClient alloc] initWithURL:@"http://betty.userland.com/RPC2"];
43     
44     NSLog(@"result: %@", [server call:@"state.getByNumber", @"42", nil]);
45 */
46
47 @class NSArray, NSString, NSURL, NSDictionary;
48 @class WOHTTPConnection;
49
50 @interface NGXmlRpcClient : NSObject
51 {
52   /* performing HTTP requests */
53   WOHTTPConnection *httpConnection;
54   NSString         *userName;
55   NSString         *password;
56   NSString         *uri;
57   NSDictionary     *additionalHeaders;
58   
59   /* performing RAW requests */
60   id address;
61   
62   /* some transactional state is required for digest authentication */
63   id digestInfo;
64   
65   // TODO: add timeout parameters
66 }
67
68 - (id)initWithURL:(id)_url;
69 - (id)initWithURL:(id)_url login:(NSString *)_login password:(NSString *)_pwd;
70
71 - (id)initWithRawAddress:(id)_address;
72
73 /* accessors */
74
75 - (void)setUserName:(NSString *)_userName;
76 - (NSString *)userName;
77 - (NSString *)login;
78
79 - (void)setPassword:(NSString *)_password;
80 - (NSString *)password;
81
82 - (void)setUri:(NSString *)_uri;
83 - (NSString *)uri;
84
85 - (void)setAdditionalHeaders:(NSDictionary *)_headers;
86 - (NSDictionary *)additionalHeaders;
87
88 /* invoking methods */
89
90 - (id)invoke:(NSString *)_methodName params:(id)first,...;
91
92 - (id)invokeMethodNamed:(NSString *)_methodName;
93 - (id)invokeMethodNamed:(NSString *)_methodName withParameter:(id)_param;
94 - (id)invokeMethodNamed:(NSString *)_methodName parameters:(NSArray *)_params;
95
96 /*
97   terminate parameter list with nil, eg:
98
99     [rpc call:@"state.getByNumber", @"42", nil];
100 */
101 - (id)call:(NSString *)_methodName,...;
102
103 @end
104
105 #endif /* __NGXmlRpcClient_H__ */