Commit 3cab42e0 authored by Boris Kocherov's avatar Boris Kocherov

support OPTIONS request, that is needed for https

parent fd3ff66e
...@@ -7,9 +7,11 @@ from datetime import datetime ...@@ -7,9 +7,11 @@ from datetime import datetime
from os.path import expanduser from os.path import expanduser
from lxml import etree from lxml import etree
from spyne import AnyXml, Application, ServiceBase, rpc from spyne import AnyXml, Application, ServiceBase, rpc, Fault
from spyne.const.http import HTTP_200
from spyne.error import InvalidCredentialsError from spyne.error import InvalidCredentialsError
from spyne.protocol.soap import Soap11 from spyne.protocol.soap import Soap11
from spyne.server.http import HttpTransportContext
from spyne.server.wsgi import WsgiApplication from spyne.server.wsgi import WsgiApplication
from ..mdx.tools.config_file_parser import ConfigParser from ..mdx.tools.config_file_parser import ConfigParser
...@@ -20,6 +22,17 @@ from .xmla_execute_tools import XmlaExecuteTools ...@@ -20,6 +22,17 @@ from .xmla_execute_tools import XmlaExecuteTools
from .xmla_execute_xsds import execute_xsd from .xmla_execute_xsds import execute_xsd
class XmlaSoap11(Soap11):
def create_in_document(self, ctx, charset=None):
if isinstance(ctx.transport, HttpTransportContext):
http_verb = ctx.transport.get_request_method()
if http_verb == "OPTIONS":
ctx.transport.resp_headers['allow'] = "POST, OPTIONS"
ctx.transport.respond(HTTP_200)
raise Fault("")
return Soap11.create_in_document(self, ctx, charset)
class XmlaProviderService(ServiceBase): class XmlaProviderService(ServiceBase):
""" """
The main class to active soap services between xmla clients and olapy. The main class to active soap services between xmla clients and olapy.
...@@ -214,8 +227,8 @@ class XmlaProviderService(ServiceBase): ...@@ -214,8 +227,8 @@ class XmlaProviderService(ServiceBase):
application = Application( application = Application(
[XmlaProviderService], [XmlaProviderService],
'urn:schemas-microsoft-com:xml-analysis', 'urn:schemas-microsoft-com:xml-analysis',
in_protocol=Soap11(validator='soft'), in_protocol=XmlaSoap11(validator='soft'),
out_protocol=Soap11(validator='soft')) out_protocol=XmlaSoap11(validator='soft'))
# validator='soft' or nothing, this is important because spyne doesn't support encodingStyle until now !!!! # validator='soft' or nothing, this is important because spyne doesn't support encodingStyle until now !!!!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment