不能在像SOAP s这样的bytes对象上使用字符串模式

2024-09-27 00:15:21 发布

您现在位置:Python中文网/ 问答频道 /正文

当我集成“WSGISOAPHandler”时,SOAP服务器不工作。有什么想法吗? 当客户端调用服务器时,服务器返回“不能在类似字节的对象上使用字符串模式”

if __name__ == "__main__":

    def ota_vehlocsearch(respuesta):
        return "respuesta"

    dispatcher = SoapDispatcher(
        name='soap',
        location = "http://localhost:8008/",
        action = 'http://localhost:8008/', # SOAPAction
        namespace = "http://www.opentravel.org/OTA/2003/05", prefix="ns0",
        trace = True,
        ns = True)

    dispatcher.register_function('OTA_VehLocSearch', ota_vehlocsearch,
        returns={'Result': str},
        args={'call': str})

    print("Starting wsgi server...")
    from wsgiref.simple_server import make_server
    application = WSGISOAPHandler(dispatcher)
    wsgid = make_server('localhost', 8008, application)
    wsgid.serve_forever()

Tags: nametruelocalhosthttpmakeserverapplicationdispatcher

热门问题