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""" 18Suds basic options classes. 19""" 20 21from suds.cache import Cache, NoCache 22from suds.properties import * 23from suds.store import DocumentStore, defaultDocumentStore 24from suds.transport import Transport 25from suds.wsse import Security 26from suds.xsd.doctor import Doctor 27 28 29class TpLinker(AutoLinker): 30 """ 31 Transport (auto) linker used to manage linkage between 32 transport objects Properties and those Properties that contain them. 33 """ 34 35 def updated(self, properties, prev, next): 36 if isinstance(prev, Transport): 37 tp = Unskin(prev.options) 38 properties.unlink(tp) 39 if isinstance(next, Transport): 40 tp = Unskin(next.options) 41 properties.link(tp) 42 43 44class Options(Skin): 45 """ 46 Options: 47 - B{cache} - The XML document cache. May be set to None for no caching. 48 - type: L{Cache} 49 - default: L{NoCache()} 50 - B{documentStore} - The XML document store used to access locally 51 stored documents without having to download them from an external 52 location. May be set to None for no internal suds library document 53 store. 54 - type: L{DocumentStore} 55 - default: L{defaultDocumentStore} 56 - B{extraArgumentErrors} - Raise exceptions when unknown message parts 57 are detected when receiving a web service reply, compared to the 58 operation's WSDL schema definition. 59 - type: I{bool} 60 - default: True 61 - B{allowUnknownMessageParts} - Raise exceptions when extra arguments are 62 detected when invoking a web service operation, compared to the 63 operation's WSDL schema definition. 64 - type: I{bool} 65 - default: False 66 - B{faults} - Raise faults raised by server, else return tuple from 67 service method invocation as (httpcode, object). 68 - type: I{bool} 69 - default: True 70 - B{service} - The default service name. 71 - type: I{str} 72 - default: None 73 - B{port} - The default service port name, not tcp port. 74 - type: I{str} 75 - default: None 76 - B{location} - This overrides the service port address I{URL} defined 77 in the WSDL. 78 - type: I{str} 79 - default: None 80 - B{transport} - The message transport. 81 - type: L{Transport} 82 - default: None 83 - B{soapheaders} - The soap headers to be included in the soap message. 84 - type: I{any} 85 - default: None 86 - B{wsse} - The web services I{security} provider object. 87 - type: L{Security} 88 - default: None 89 - B{doctor} - A schema I{doctor} object. 90 - type: L{Doctor} 91 - default: None 92 - B{xstq} - The B{x}ml B{s}chema B{t}ype B{q}ualified flag indicates 93 that the I{xsi:type} attribute values should be qualified by 94 namespace. 95 - type: I{bool} 96 - default: True 97 - B{prefixes} - Elements of the soap message should be qualified (when 98 needed) using XML prefixes as opposed to xmlns="" syntax. 99 - type: I{bool} 100 - default: True 101 - B{retxml} - Flag that causes the I{raw} soap envelope to be returned 102 instead of the python object graph. 103 - type: I{bool} 104 - default: False 105 - B{prettyxml} - Flag that causes I{pretty} xml to be rendered when 106 generating the outbound soap envelope. 107 - type: I{bool} 108 - default: False 109 - B{autoblend} - Flag that ensures that the schema(s) defined within 110 the WSDL import each other. 111 - type: I{bool} 112 - default: False 113 - B{cachingpolicy} - The caching policy. 114 - type: I{int} 115 - 0 = Cache XML documents. 116 - 1 = Cache WSDL (pickled) object. 117 - default: 0 118 - B{plugins} - A plugin container. 119 - type: I{list} 120 - default: I{list()} 121 - B{nosend} - Create the soap envelope but do not send. 122 When specified, method invocation returns a I{RequestContext} 123 instead of sending it. 124 - type: I{bool} 125 - default: False 126 - B{unwrap} - Enable automatic parameter unwrapping when possible. 127 Enabled by default. If disabled, no input or output parameters are 128 ever automatically unwrapped. 129 - type: I{bool} 130 - default: True 131 - B{sortNamespaces} - Namespaces are sorted alphabetically. If disabled, 132 namespaces are left in the order they are received from the source. 133 Enabled by default for historical purposes. 134 - type: I{bool} 135 - default: True 136 """ 137 def __init__(self, **kwargs): 138 domain = __name__ 139 definitions = [ 140 Definition('cache', Cache, NoCache()), 141 Definition('documentStore', DocumentStore, defaultDocumentStore), 142 Definition('extraArgumentErrors', bool, True), 143 Definition('allowUnknownMessageParts', bool, False), 144 Definition('faults', bool, True), 145 Definition('transport', Transport, None, TpLinker()), 146 Definition('service', (int, str), None), 147 Definition('port', (int, str), None), 148 Definition('location', str, None), 149 Definition('soapheaders', (), ()), 150 Definition('wsse', Security, None), 151 Definition('doctor', Doctor, None), 152 Definition('xstq', bool, True), 153 Definition('prefixes', bool, True), 154 Definition('retxml', bool, False), 155 Definition('prettyxml', bool, False), 156 Definition('autoblend', bool, False), 157 Definition('cachingpolicy', int, 0), 158 Definition('plugins', (list, tuple), []), 159 Definition('nosend', bool, False), 160 Definition('unwrap', bool, True), 161 Definition('sortNamespaces', bool, True)] 162 Skin.__init__(self, domain, definitions, kwargs) 163