Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ SPEC = $(PKG).spec
SETUP = setup.py
DOCTAR = suds-docs.tar.gz
FEDORAPEOPLE = jortel@fedorapeople.org
BUILDROOT = ~/rpmbuild

all : rpm docs

Expand All @@ -29,10 +30,10 @@ dist : clean
./sdist python

rpm : dist
cp dist/$(PKG)*.gz /usr/src/redhat/SOURCES
cp dist/$(PKG)*.gz $(BUILDROOT)/SOURCES
rpmbuild -ba $(SPEC)
cp /usr/src/redhat/RPMS/noarch/$(PKG)*.rpm dist
cp /usr/src/redhat/SRPMS/$(PKG)*.rpm dist
cp $(BUILDROOT)/RPMS/noarch/$(PKG)*.rpm dist
cp $(BUILDROOT)/SRPMS/$(PKG)*.rpm dist
rpmlint -i dist/$(PKG)*.rpm

release : rpm rdocs
Expand Down Expand Up @@ -61,10 +62,10 @@ clean :
rm -rf build
rm -rf doc
rm -rf *.egg-info
rm -rf /usr/src/redhat/BUILD/$(PKG)*
rm -rf /usr/src/redhat/RPMS/noarch/$(PKG)*
rm -rf /usr/src/redhat/SOURCES/$(PKG)*
rm -rf /usr/src/redhat/SRPMS/$(PKG)*
rm -rf $(BUILDROOT)/BUILD/$(PKG)*
rm -rf $(BUILDROOT)/RPMS/noarch/$(PKG)*
rm -rf $(BUILDROOT)/SOURCES/$(PKG)*
rm -rf $(BUILDROOT)/SRPMS/$(PKG)*
find . -name "*.pyc" -exec rm -f {} \;
find . -name "*~" -exec rm -f {} \;

Expand Down
15 changes: 7 additions & 8 deletions suds/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ def headers(self):
action = self.method.soap.action
if isinstance(action, unicode):
action = action.encode('utf-8')
stock = { 'Content-Type' : 'text/xml; charset=utf-8', 'SOAPAction': action }
stock = { 'Content-Type' : 'application/soap+xml; charset=utf-8', 'SOAPAction': action }
result = dict(stock, **self.options.headers)
log.debug('headers = %s', result)
return result
Expand Down Expand Up @@ -730,13 +730,12 @@ def failed(self, binding, error):
status, reason = (error.httpcode, tostr(error))
reply = error.fp.read()
log.debug('http failed:\n%s', reply)
if status == 500:
if len(reply) > 0:
r, p = binding.get_fault(reply)
self.last_received(r)
return (status, p)
else:
return (status, None)
if len(reply) > 0:
r, p = binding.get_fault(reply)
self.last_received(r)
return (status, p)
else:
return (status, None)
if self.options.faults:
raise Exception((status, reason))
else:
Expand Down
3 changes: 2 additions & 1 deletion suds/mx/literal.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ def node(self, content):
ns = content.type.namespace()
if content.type.form_qualified:
node = Element(content.tag, ns=ns)
node.addPrefix(ns[0], ns[1])
if ns[0]:
node.addPrefix(ns[0], ns[1])
else:
node = Element(content.tag)
self.encode(node, content)
Expand Down
1 change: 1 addition & 0 deletions suds/sax/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def setPrefix(self, p, u=None):
"""
self.prefix = p
if p is not None and u is not None:
self.expns = None
self.addPrefix(p, u)
return self

Expand Down
6 changes: 5 additions & 1 deletion suds/servicedefinition.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,11 @@ def xlate(self, type):
@rtype: str
"""
resolved = type.resolve()
name = resolved.name
if resolved.name is not None:
name = resolved.name
else:
name = '*'

if type.unbounded():
name += '[]'
ns = resolved.namespace()
Expand Down
21 changes: 7 additions & 14 deletions suds/wsse.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,14 @@
The I{wsse} module provides WS-Security.
"""

import random
from logging import getLogger
from suds import *
from suds.sudsobject import Object
from suds.sax.element import Element
from suds.sax.date import UTC
from datetime import datetime, timedelta

try:
from hashlib import md5
except ImportError:
# Python 2.4 compatibility
from md5 import md5


dsns = \
('ds',
Expand Down Expand Up @@ -136,13 +131,11 @@ def setnonce(self, text=None):
@type text: str
"""
if text is None:
s = []
s.append(self.username)
s.append(self.password)
s.append(Token.sysdate())
m = md5()
m.update(':'.join(s))
self.nonce = m.hexdigest()
# Random 16 bytes presented as a string
"""TODO According to the standard, SOAP client must remember nonces, used in the last time,
to avoid duplicating random values. It is not implemented now.
"""
self.nonce = ''.join([chr(random.randint(0, 255)) for i in range(16)])
else:
self.nonce = text

Expand Down Expand Up @@ -209,4 +202,4 @@ def xml(self):
expires.setText(str(UTC(self.expires)))
root.append(created)
root.append(expires)
return root
return root