# Path: opennsa/shared/requestinfo.py
# class RequestInfo:
#     """
#     Holds various data about the request.
#     Somewhat adding things as we go.
#     """
#     def __init__(self, cert_subject=None, cert_host_dn=None):
#         self.cert_subject = cert_subject
#         self.cert_host_dn = cert_host_dn
# 
# Path: opennsa/protocols/shared/minisoap.py
# LOG_SYSTEM = 'opennsa.protocols.soap'
# SOAP_ENVELOPE_NS        = "http://schemas.xmlsoap.org/soap/envelope/"
# SOAP_ENV                = ET.QName("{%s}Envelope"   % SOAP_ENVELOPE_NS)
# SOAP_HEADER             = ET.QName("{%s}Header"     % SOAP_ENVELOPE_NS)
# SOAP_BODY               = ET.QName("{%s}Body"       % SOAP_ENVELOPE_NS)
# SOAP_FAULT              = ET.QName("{%s}Fault"      % SOAP_ENVELOPE_NS)
# FAULTCODE               = 'faultcode'
# FAULTSTRING             = 'faultstring'
# DETAIL                  = 'detail'
# FAULTCODE_SERVER        = 'soap:Server' # must match with the namespace below
# def _indent(elem, level=0):
# def createSoapEnvelope():
# def createSoapPayload(body_element=None, header_element=None):
# def createSoapFault(fault_msg, detail_element=None):
# def parseSoapPayload(payload):
# def parseFault(payload):


from twisted.python import log
from twisted.internet import defer
from twisted.web import resource, server
from opennsa.shared.requestinfo import RequestInfo
from opennsa.protocols.shared import minisoap
"""
SOAP Service Resource for OpenNSA.

Author: Henrik Thostrup Jensen <htj@nordu.net>
Copyright: NORDUnet (2011-2016)
"""





LOG_SYSTEM = 'protocol.SOAPResource'



class SOAPFault(Exception):

    def __init__(self, fault_string, detail_element=None):
        self.fault_string = fault_string
        self.detail_element = detail_element


    def createPayload(self):


# Path: opennsa/shared/requestinfo.py
# class RequestInfo:
#     """
#     Holds various data about the request.
#     Somewhat adding things as we go.
#     """
#     def __init__(self, cert_subject=None, cert_host_dn=None):
#         self.cert_subject = cert_subject
#         self.cert_host_dn = cert_host_dn
# 
# Path: opennsa/protocols/shared/minisoap.py
# LOG_SYSTEM = 'opennsa.protocols.soap'
# SOAP_ENVELOPE_NS        = "http://schemas.xmlsoap.org/soap/envelope/"
# SOAP_ENV                = ET.QName("{%s}Envelope"   % SOAP_ENVELOPE_NS)
# SOAP_HEADER             = ET.QName("{%s}Header"     % SOAP_ENVELOPE_NS)
# SOAP_BODY               = ET.QName("{%s}Body"       % SOAP_ENVELOPE_NS)
# SOAP_FAULT              = ET.QName("{%s}Fault"      % SOAP_ENVELOPE_NS)
# FAULTCODE               = 'faultcode'
# FAULTSTRING             = 'faultstring'
# DETAIL                  = 'detail'
# FAULTCODE_SERVER        = 'soap:Server' # must match with the namespace below
# def _indent(elem, level=0):
# def createSoapEnvelope():
# def createSoapPayload(body_element=None, header_element=None):
# def createSoapFault(fault_msg, detail_element=None):
# def parseSoapPayload(payload):
# def parseFault(payload):


# Path: opennsa/protocols/shared/soapresource.py
from twisted.python import log
from twisted.internet import defer
from twisted.web import resource, server
from opennsa.shared.requestinfo import RequestInfo
from opennsa.protocols.shared import minisoap

"""
SOAP Service Resource for OpenNSA.

Author: Henrik Thostrup Jensen <htj@nordu.net>
Copyright: NORDUnet (2011-2016)
"""





LOG_SYSTEM = 'protocol.SOAPResource'



class SOAPFault(Exception):

    def __init__(self, fault_string, detail_element=None):
        self.fault_string = fault_string
        self.detail_element = detail_element


    def createPayload(self):


        return minisoap.createSoapFault(self.fault_string, self.detail_element)