スタンドアロンアプリケーションとして実行しているソープサーバーがあります。つまり、単に実行するだけですpython mysoapserver.py
ただし、wsgi を使用して apache2 経由でアクセスできるようにしたいと考えています。
以下は、現在のコードの一部のコードの抜粋です。
インポート:
from pysimplesoap.server import SoapDispatcher, SOAPHandler, WSGISOAPHandler
コードの抜粋
dispatcher = SoapDispatcher(
'TransServer',
location = "http://127.0.0.1:8050/",
action = 'http://127.0.0.1:8050/', # SOAPAction
namespace = "http://example.com/sample.wsdl", prefix="ns0",
trace = True,
ns = True)
#Function
def settransactiondetails(sessionId,msisdn,amount,language):
#Some Code here
#And more code here
return {'sessionId':sid,'responseCode':0}
# register the user function
dispatcher.register_function('InitiateTransfer', settransactiondetails,
returns={'sessionId': str,'responseCode':int},
args={'sessionId': str,'msisdn': str,'amount': str,'language': str})
logging.info("Starting server...")
httpd = HTTPServer(("", 8050),SOAPHandler)
httpd.dispatcher = dispatcher
httpd.serve_forever()
wsgiを介してapache2でアクセスできるようにするには、上記のコードをどのように変更する必要がありますか。私が必要とする変更を/etc/apache2/sites-available/default
ファイルに含めることもできます。