Ejemplo n.º 1
0
    def __init__(self, app, chunked=True,
                max_content_length=2 * 1024 * 1024,
                block_length=8 * 1024):
        HttpBase.__init__(self, app, chunked, max_content_length, block_length)

        self._mtx_build_interface_document = threading.Lock()
        self._wsdl = self.doc.wsdl11.get_interface_document()

        # Initialize HTTP Patterns
        self._http_patterns = None
        self._map_adapter = None
        self._mtx_build_map_adapter = threading.Lock()

        for k,v in self.app.interface.service_method_map.items():
            # p_ stands for primary
            p_service_class, p_method_descriptor = v[0]
            for patt in p_method_descriptor.patterns:
                if isinstance(patt, HttpPattern):
                    # We are doing this here because we want to import Werkzeug
                    # as late as possible.
                    if self._http_patterns is None:
                        from werkzeug.routing import Map
                        self._http_patterns = Map(host_matching=True)

                    for r in patt.as_werkzeug_rules():
                        self._http_patterns.add(r)
Ejemplo n.º 2
0
    def __init__(self, app, chunked=True):
        HttpBase.__init__(self, app, chunked)

        self._allowed_http_verbs = app.in_protocol.allowed_http_verbs
        self._verb_handlers = {
            "GET": self.handle_rpc,
            "POST": self.handle_rpc,
        }
        self._mtx_build_interface_document = threading.Lock()
        self._wsdl = None

        # Initialize HTTP Patterns
        self._http_patterns = None
        self._map_adapter = None
        self._mtx_build_map_adapter = threading.Lock()

        for k, v in self.app.interface.service_method_map.items():
            p_service_class, p_method_descriptor = v[0]
            for p in p_method_descriptor.patterns:
                if isinstance(p, HttpPattern):
                    r = p.as_werkzeug_rule()

                    # We do this here because we don't want to import
                    # Werkzeug until the last moment.
                    if self._http_patterns is None:
                        from werkzeug.routing import Map
                        self._http_patterns = Map()

                    self._http_patterns.add(r)
Ejemplo n.º 3
0
    def __init__(self, app, chunked=True,
                max_content_length=2 * 1024 * 1024,
                block_length=8 * 1024):
        HttpBase.__init__(self, app, chunked, max_content_length, block_length)

        self._allowed_http_verbs = app.in_protocol.allowed_http_verbs
        self._verb_handlers = {
            "GET": self.handle_rpc,
            "POST": self.handle_rpc,
        }
        self._mtx_build_interface_document = threading.Lock()
        self._wsdl = None

        # Initialize HTTP Patterns
        self._http_patterns = None
        self._map_adapter = None
        self._mtx_build_map_adapter = threading.Lock()

        for k,v in self.app.interface.service_method_map.items():
            # p_ stands for primary
            p_service_class, p_method_descriptor = v[0]
            for patt in p_method_descriptor.patterns:
                if isinstance(patt, HttpPattern):
                    r = patt.as_werkzeug_rule()

                    # We are doing this here because we want to import Werkzeug
                    # as late as possible.
                    if self._http_patterns is None:
                        from werkzeug.routing import Map
                        self._http_patterns = Map(host_matching=True)

                    self._http_patterns.add(r)
Ejemplo n.º 4
0
Archivo: wsgi.py Proyecto: xevo/spyne
    def __init__(self, app, chunked=True):
        HttpBase.__init__(self, app, chunked)

        self._allowed_http_verbs = app.in_protocol.allowed_http_verbs
        self._verb_handlers = {
            "GET": self.handle_rpc,
            "POST": self.handle_rpc,
        }
        self._mtx_build_interface_document = threading.Lock()
        self._wsdl = None

        # Initialize HTTP Patterns
        self._http_patterns = None
        self._map_adapter = None
        self._mtx_build_map_adapter = threading.Lock()

        for k,v in self.app.interface.service_method_map.items():
            p_service_class, p_method_descriptor = v[0]
            for p in p_method_descriptor.patterns:
                if isinstance(p, HttpPattern):
                    r = p.as_werkzeug_rule()

                    # We do this here because we don't want to import
                    # Werkzeug until the last moment.
                    if self._http_patterns is None:
                        from werkzeug.routing import Map
                        self._http_patterns = Map()

                    self._http_patterns.add(r)
Ejemplo n.º 5
0
    def __init__(self, app, chunked=True):
        HttpBase.__init__(self, app, chunked)

        self._allowed_http_verbs = app.in_protocol.allowed_http_verbs
        self._verb_handlers = {
            "GET": self.handle_rpc,
            "POST": self.handle_rpc,
        }
        self._mtx_build_interface_document = threading.Lock()
        self._wsdl = None
Ejemplo n.º 6
0
def soap_api():
    """
    SOAP web service documentation by rendering the WSDL document as HTML.

    Generate the documentation by a XSL transform of the WSDL document.
    The XSL transformation used is `WSDL viewer
    <http://tomi.vanek.sk/index.php?page=wsdl-viewer>`_ by Tomi Vanek.

    We apply a small patch to this transformation to show newlines in
    the SOAP method docstrings:

    1. Around line 1195, the description ``<div>``, replace
       ``<div class="value">`` by ``<div class="value documentation">``.

    2. In the style sheet, add:

           .documentation { white-space: pre-line; }
    """
    soap_server = HttpBase(soap.application)
    soap_server.doc.wsdl11.build_interface_document(
        settings.SOAP_WSDL_URL or 'https://mutalyzer.nl/services/?wsdl')
    wsdl_string = soap_server.doc.wsdl11.get_interface_document()

    xsl_file = os.path.join(
        pkg_resources.resource_filename('mutalyzer', 'website/templates'),
        'wsdl-viewer.xsl')
    wsdl_doc = etree.fromstring(wsdl_string)
    xsl_doc = etree.parse(xsl_file)
    transform = etree.XSLT(xsl_doc)

    return make_response(unicode(transform(wsdl_doc)))
Ejemplo n.º 7
0
 def _getServer(self):
   try:
     serial, server = self._v_server
     if serial == self._p_serial:
       return server
   except AttributeError:
     pass
   server = HttpBase(Application(
     map(self._service_class_dict.__getitem__, self.getServiceClassList()),
     self.getTargetNamespace(),
     in_protocol=Soap11(), out_protocol=Soap11()))
   self._v_server = self._p_serial, server
   return server
Ejemplo n.º 8
0
 def __init__(self, app, chunked=False):
     HttpBase.__init__(self, app, chunked=chunked)
     self._wsdl = None