1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 """
18 Suds is a lightweight SOAP python client that provides a
19 service proxy for Web Services.
20 """
21
22 import os
23 import sys
24
25
26
27
28
29 __version__ = '0.4.1'
30 __build__="(beta) R705-20101207"
31
32
33
34
35
38 Exception.__init__(self, "Method not found: '%s'" % name)
39
42 Exception.__init__(self, "Port not found: '%s'" % name)
43
46 Exception.__init__(self, "Service not found: '%s'" % name)
47
50 Exception.__init__(self, "Type not found: '%s'" % tostr(name))
51
53 msg = \
54 """
55 An error occured while building a instance of (%s). As a result
56 the object you requested could not be constructed. It is recommended
57 that you construct the type manually using a Suds object.
58 Please open a ticket with a description of this error.
59 Reason: %s
60 """
63
65 msg = \
66 """
67 Method (%s) was invoked with SOAP headers. The WSDL does not
68 define SOAP headers for this method. Retry without the soapheaders
69 keyword argument.
70 """
73
76 if hasattr(fault, 'faultstring'):
77 Exception.__init__(self, "Server raised fault: '%s'" % fault.faultstring)
78 self.fault = fault
79 self.document = document
80
81
82
83
84
90
91
92
93
94
95 -def tostr(object, encoding=None):
96 """ get a unicode safe string representation of an object """
97 if isinstance(object, basestring):
98 if encoding is None:
99 return object
100 else:
101 return object.encode(encoding)
102 if isinstance(object, tuple):
103 s = ['(']
104 for item in object:
105 if isinstance(item, basestring):
106 s.append(item)
107 else:
108 s.append(tostr(item))
109 s.append(', ')
110 s.append(')')
111 return ''.join(s)
112 if isinstance(object, list):
113 s = ['[']
114 for item in object:
115 if isinstance(item, basestring):
116 s.append(item)
117 else:
118 s.append(tostr(item))
119 s.append(', ')
120 s.append(']')
121 return ''.join(s)
122 if isinstance(object, dict):
123 s = ['{']
124 for item in object.items():
125 if isinstance(item[0], basestring):
126 s.append(item[0])
127 else:
128 s.append(tostr(item[0]))
129 s.append(' = ')
130 if isinstance(item[1], basestring):
131 s.append(item[1])
132 else:
133 s.append(tostr(item[1]))
134 s.append(', ')
135 s.append('}')
136 return ''.join(s)
137 try:
138 return unicode(object)
139 except:
140 return str(object)
141
143 """
144 The I{null} object.
145 Used to pass NULL for optional XML nodes.
146 """
147 pass
148
150 return obj.__class__.__name__\
151 +':'+hex(id(obj))
152
153
154 import client
155