Package suds :: Module serviceproxy
[hide private]
[frames] | no frames]

Source Code for Module suds.serviceproxy

 1  # This program is free software; you can redistribute it and/or modify 
 2  # it under the terms of the (LGPL) GNU Lesser General Public License as 
 3  # published by the Free Software Foundation; either version 3 of the  
 4  # License, or (at your option) any later version. 
 5  # 
 6  # This program is distributed in the hope that it will be useful, 
 7  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
 8  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 9  # GNU Library Lesser General Public License for more details at 
10  # ( http://www.gnu.org/licenses/lgpl.html ). 
11  # 
12  # You should have received a copy of the GNU Lesser General Public License 
13  # along with this program; if not, write to the Free Software 
14  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
15  # written by: Jeff Ortel ( jortel@redhat.com ) 
16   
17  """ 
18  The service proxy provides access to web services. 
19   
20  Replaced by: L{client.Client} 
21  """ 
22   
23  from logging import getLogger 
24  from suds import * 
25  from suds.client import Client 
26   
27  log = getLogger(__name__) 
28   
29   
30 -class ServiceProxy(object):
31 32 """ 33 A lightweight soap based web service proxy. 34 @ivar __client__: A client. 35 Everything is delegated to the 2nd generation API. 36 @type __client__: L{Client} 37 @note: Deprecated, replaced by L{Client}. 38 """ 39
40 - def __init__(self, url, **kwargs):
41 """ 42 @param url: The URL for the WSDL. 43 @type url: str 44 @param kwargs: keyword arguments. 45 @keyword faults: Raise faults raised by server (default:True), 46 else return tuple from service method invocation as (http code, object). 47 @type faults: boolean 48 @keyword proxy: An http proxy to be specified on requests (default:{}). 49 The proxy is defined as {protocol:proxy,} 50 @type proxy: dict 51 """ 52 client = Client(url, **kwargs) 53 self.__client__ = client
54
55 - def get_instance(self, name):
56 """ 57 Get an instance of a WSDL type by name 58 @param name: The name of a type defined in the WSDL. 59 @type name: str 60 @return: An instance on success, else None 61 @rtype: L{sudsobject.Object} 62 """ 63 return self.__client__.factory.create(name)
64
65 - def get_enum(self, name):
66 """ 67 Get an instance of an enumeration defined in the WSDL by name. 68 @param name: The name of a enumeration defined in the WSDL. 69 @type name: str 70 @return: An instance on success, else None 71 @rtype: L{sudsobject.Object} 72 """ 73 return self.__client__.factory.create(name)
74
75 - def __str__(self):
76 return str(self.__client__)
77
78 - def __unicode__(self):
79 return unicode(self.__client__)
80
81 - def __getattr__(self, name):
82 builtin = name.startswith('__') and name.endswith('__') 83 if builtin: 84 return self.__dict__[name] 85 else: 86 return getattr(self.__client__.service, name)
87