]> err.no Git - sope/blob - sope-appserver/NGXmlRpc/NGXmlRpcClient.h
define some default defaults for the simple http parser (when the Defaults.plist...
[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
22 #ifndef __NGXmlRpcClient_H__
23 #define __NGXmlRpcClient_H__
24
25 #import <Foundation/NSObject.h>
26
27 /*
28   NGXmlRpcClient
29   
30   This class is a raw XML-RPC client based on WOHTTPConnection. To see how
31   it works, take a look at the xmlrpc_call.m tool included in SOPE 4.5.
32
33   XML-RPC over Unix domain sockets. NGXmlRpcClient (will) support XML-RPC over
34   a Unix domain socket, as used in the ximian_xmlrpclib.py. The transport
35   protocol used is "$body$\r\n\r\n".
36   
37   Usage:
38     NGXmlRpcClient *server;
39     
40     server =
41       [[NGXmlRpcClient alloc] initWithURL:@"http://betty.userland.com/RPC2"];
42     
43     NSLog(@"result: %@", [server call:@"state.getByNumber", @"42", nil]);
44 */
45
46 @class NSArray, NSString, NSURL, NSDictionary;
47 @class WOHTTPConnection;
48
49 @interface NGXmlRpcClient : NSObject
50 {
51   /* performing HTTP requests */
52   WOHTTPConnection *httpConnection;
53   NSString         *userName;
54   NSString         *password;
55   NSString         *uri;
56   NSDictionary     *additionalHeaders;
57   
58   /* performing RAW requests */
59   id address;
60   
61   /* some transactional state is required for digest authentication */
62   id digestInfo;
63   
64   // TODO: add timeout parameters
65 }
66
67 - (id)initWithURL:(id)_url;
68 - (id)initWithURL:(id)_url login:(NSString *)_login password:(NSString *)_pwd;
69
70 - (id)initWithRawAddress:(id)_address;
71
72 /* accessors */
73
74 - (void)setUserName:(NSString *)_userName;
75 - (NSString *)userName;
76 - (NSString *)login;
77
78 - (void)setPassword:(NSString *)_password;
79 - (NSString *)password;
80
81 - (void)setUri:(NSString *)_uri;
82 - (NSString *)uri;
83
84 - (void)setAdditionalHeaders:(NSDictionary *)_headers;
85 - (NSDictionary *)additionalHeaders;
86
87 /* invoking methods */
88
89 - (id)invoke:(NSString *)_methodName params:(id)first,...;
90
91 - (id)invokeMethodNamed:(NSString *)_methodName;
92 - (id)invokeMethodNamed:(NSString *)_methodName withParameter:(id)_param;
93 - (id)invokeMethodNamed:(NSString *)_methodName parameters:(NSArray *)_params;
94
95 /*
96   terminate parameter list with nil, eg:
97
98     [rpc call:@"state.getByNumber", @"42", nil];
99 */
100 - (id)call:(NSString *)_methodName,...;
101
102 @end
103
104 #endif /* __NGXmlRpcClient_H__ */