Exemplo n.º 1
0
    def create_in_document(self, ctx, charset=None):
        if ctx.transport.type == 'wsgi':
            # according to the soap via http standard, soap requests must only
            # work with proper POST requests.
            content_type = ctx.transport.req_env.get("CONTENT_TYPE")
            http_verb = ctx.transport.req_env['REQUEST_METHOD'].upper()
            if content_type is None or http_verb != "POST":
                ctx.transport.resp_code = HTTP_405
                raise RequestNotAllowed(
                        "You must issue a POST request with the Content-Type "
                        "header properly set.")

            content_type = cgi.parse_header(content_type)
            collapse_swa(content_type, ctx.in_string)

        ctx.in_document = _parse_xml_string(ctx.in_string, charset)
Exemplo n.º 2
0
 def rootPage(self,*args, **kwargs):
     """Handle an incoming SOAP request or a non-SOAP WSDL query."""
     self.response.content_type = 'text/xml'
     if not self.request._request.body:
         return self.service_description()
     if True:
         ctx = MethodContext()
         in_string = collapse_swa(self.request.content_type, self.request._request.body)
         in_obj = self.get_in_object(ctx, in_string, self.request._request.charset)
         out_obj = self.get_out_object(ctx, in_obj)
         out_string = self.get_out_string(ctx, out_obj)
         return out_string
     else:
     #except Exception, e:
         if getattr(self, 'debug_soap',False):
             raise
         self.response.status='500 Internal Server Error'
         fault = Fault(faultstring=str(e))
         resp = etree.tostring(fault, encoding=string_encoding)
         return resp
Exemplo n.º 3
0
 def rootPage(self, *args, **kwargs):
     """Handle an incoming SOAP request or a non-SOAP WSDL query."""
     self.response.content_type = 'text/xml'
     if not self.request._request.body:
         return self.service_description()
     if True:
         ctx = MethodContext()
         in_string = collapse_swa(self.request.content_type,
                                  self.request._request.body)
         in_obj = self.get_in_object(ctx, in_string,
                                     self.request._request.charset)
         out_obj = self.get_out_object(ctx, in_obj)
         out_string = self.get_out_string(ctx, out_obj)
         return out_string
     else:
         #except Exception, e:
         if getattr(self, 'debug_soap', False):
             raise
         self.response.status = '500 Internal Server Error'
         fault = Fault(faultstring=str(e))
         resp = etree.tostring(fault, encoding=string_encoding)
         return resp
Exemplo n.º 4
0
    def create_in_document(self, ctx, charset=None):
        if ctx.transport.type == 'wsgi':
            content_type = cgi.parse_header(ctx.transport.req_env.get("CONTENT_TYPE"))
            collapse_swa(content_type, ctx.in_string)

        ctx.in_document = _parse_xml_string(ctx.in_string, charset)
Exemplo n.º 5
0
    def reconstruct_wsgi_request(self, http_env):
        http_payload, charset = ProtocolBase.reconstruct_wsgi_request(self, http_env)

        content_type = cgi.parse_header(http_env.get("CONTENT_TYPE"))

        return collapse_swa(content_type, http_payload), charset
Exemplo n.º 6
0
    def create_in_document(self, ctx, charset=None):
        if ctx.transport.type == 'wsgi':
            content_type = cgi.parse_header(ctx.transport.req_env.get("CONTENT_TYPE"))
            collapse_swa(content_type, ctx.in_string)

        ctx.in_document = _parse_xml_string(ctx.in_string, charset)