source: TI12-security/trunk/python/ndg.security.common/ndg/security/common/soap/__init__.py @ 5521

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.common/ndg/security/common/soap/__init__.py@5521
Revision 5521, 1.9 KB checked in by pjkersha, 11 years ago (diff)

Added urllib2 based SOAP client handler class.

Line 
1"""SOAP common package for NDG Security.  See ndg.security.server.wsgi for
2server side specific code.
3
4Initially for use with SAML SOAP Binding to Attribute Authority.  This itself
5uses ElementTree.  This SOAP interface provides an ElementTree interface to
6support it
7
8NERC DataGrid Project
9"""
10__author__ = "P J Kershaw"
11__date__ = "24/07/09"
12__copyright__ = "(C) 2009 Science and Technology Facilities Council"
13__license__ = "BSD - see LICENSE file in top-level directory"
14__contact__ = "Philip.Kershaw@stfc.ac.uk"
15__revision__ = '$Id$'
16import logging
17log = logging.getLogger(__name__)
18
19class SOAPException(Exception):
20    """Base SAOP Exception class"""
21   
22class SOAPFault(SOAPException):
23    """SOAP Fault"""
24   
25class SOAPObject(object):
26    """Base class for SOAP envelope, header and body elements"""
27   
28    ELEMENT_PREFIX = "SOAP-ENV"
29    SOAP11_NS = "http://schemas.xmlsoap.org/soap/envelope/"
30    SOAP12_NS = "http://www.w3.org/2003/05/soap-envelope"
31    DEFAULT_NS = SOAP11_NS
32   
33    def create(self):
34        raise NotImplementedError()
35   
36    def parse(self):
37        raise NotImplementedError()
38   
39    def serialize(self):
40        raise NotImplementedError()
41   
42    def prettyPrint(self):
43        raise NotImplementedError()
44 
45   
46class SOAPEnvelopeBase(SOAPObject):
47    """SOAP Envelope"""
48   
49    DEFAULT_ELEMENT_LOCAL_NAME = "Envelope"
50    DEFAULT_ELEMENT_NS = SOAPObject.DEFAULT_NS
51    DEFAULT_ELEMENT_NS_PREFIX = SOAPObject.ELEMENT_PREFIX
52   
53    soapHeader = property()
54    soapBody = property()
55   
56   
57class SOAPHeaderBase(SOAPObject):
58    """SOAP Header base class"""
59   
60    DEFAULT_ELEMENT_LOCAL_NAME = "Header"
61    DEFAULT_ELEMENT_NS = SOAPObject.DEFAULT_NS
62    DEFAULT_ELEMENT_NS_PREFIX = SOAPObject.ELEMENT_PREFIX   
63       
64class SOAPBodyBase(SOAPObject):
65    """SOAP Body base class"""
66   
67    DEFAULT_ELEMENT_LOCAL_NAME = "Body"
68    DEFAULT_ELEMENT_NS = SOAPObject.DEFAULT_NS
69    DEFAULT_ELEMENT_NS_PREFIX = SOAPObject.ELEMENT_PREFIX
Note: See TracBrowser for help on using the repository browser.