ZSI-services
git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@181 a67ec6bc-e5d5-0310-a910-815c51eb3124
This commit is contained in:
parent
4a8a10548a
commit
2c8c2228c0
8 changed files with 159 additions and 636 deletions
8
backend/src/BusinessMethods.py
Normal file
8
backend/src/BusinessMethods.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
#
|
||||
# Business methoden
|
||||
#
|
||||
def login(login, password):
|
||||
if (('jan' == login) and ('jan' == password)):
|
||||
return 'XXX'
|
||||
else:
|
||||
return None
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
from ZSI.ServiceContainer import ServiceContainer
|
||||
from ZSI.dispatch import SOAPRequestHandler
|
||||
from gnuviechadminCommon.gnuviechadmin_services_server import *
|
||||
|
||||
service = gnuviechadmin()
|
||||
from gnuviechadmin_services_server import *
|
||||
|
||||
class mySOAPRequestHandler(SOAPRequestHandler):
|
||||
'''
|
||||
|
@ -20,7 +18,13 @@ class mySOAPRequestHandler(SOAPRequestHandler):
|
|||
'''
|
||||
self.send_xml(service._wsdl)
|
||||
|
||||
def AsServer(iporhost='', port=80, services=(), RequestHandlerClass=SOAPRequestHandler):
|
||||
def AsServer(iporhost='', port=80, services=(),
|
||||
RequestHandlerClass=SOAPRequestHandler):
|
||||
"""
|
||||
iporhost -- IP address or hostname to bind to
|
||||
port -- TCP port
|
||||
services -- list of service instances
|
||||
"""
|
||||
address = (iporhost, port)
|
||||
sc = ServiceContainer(address, RequestHandlerClass=RequestHandlerClass)
|
||||
for service in services:
|
||||
|
@ -28,6 +32,8 @@ def AsServer(iporhost='', port=80, services=(), RequestHandlerClass=SOAPRequestH
|
|||
sc.setNode(service, path)
|
||||
sc.serve_forever()
|
||||
|
||||
service = gnuviechadmin()
|
||||
|
||||
if __name__ == '__main__':
|
||||
AsServer(iporhost='localhost', port=8080, services=[service],
|
||||
RequestHandlerClass=mySOAPRequestHandler)
|
||||
|
|
74
backend/src/gnuviechadmin_services_server.py
Normal file
74
backend/src/gnuviechadmin_services_server.py
Normal file
|
@ -0,0 +1,74 @@
|
|||
from gnuviechadminCommon.gnuviechadmin_services import *
|
||||
from ZSI.ServiceContainer import ServiceSOAPBinding
|
||||
import BusinessMethods
|
||||
|
||||
class gnuviechadmin(ServiceSOAPBinding):
|
||||
soapAction = {
|
||||
'https://ssl.gnuviech.info/gnuviechadmin/Authenticate': 'soap_Authenticate',
|
||||
}
|
||||
_wsdl = """<?xml version=\"1.0\" ?>
|
||||
<!--
|
||||
Webservice description for gnuviechadmin
|
||||
(c) 2006 Jan Dittberner <jan@dittberner.info>
|
||||
Version: $Id: gnuviechadmin.wsdl 863 2006-03-07 22:26:55Z jan $
|
||||
--><wsdl:definitions name=\"gnuviechadmin\" targetNamespace=\"https://ssl.gnuviech.info/gnuviechadmin/\" xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:tns=\"https://ssl.gnuviech.info/gnuviechadmin/\" xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
|
||||
<wsdl:types>
|
||||
<xsd:schema targetNamespace=\"https://ssl.gnuviech.info/gnuviechadmin/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
|
||||
<xsd:element name=\"AuthCode\" type=\"xsd:string\"/>
|
||||
<xsd:element name=\"LoginInfo\">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence maxOccurs=\"1\" minOccurs=\"1\">
|
||||
<xsd:element name=\"login\" type=\"xsd:string\"/>
|
||||
<xsd:element name=\"password\" type=\"xsd:string\"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
</wsdl:types>
|
||||
<wsdl:message name=\"AuthResponse\">
|
||||
<wsdl:part element=\"tns:AuthCode\" name=\"AuthResponse\"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name=\"AuthRequest\">
|
||||
<wsdl:part element=\"tns:LoginInfo\" name=\"AuthRequest\"/>
|
||||
</wsdl:message>
|
||||
<wsdl:portType name=\"gnuviechadmin\">
|
||||
<wsdl:operation name=\"Authenticate\">
|
||||
<wsdl:input message=\"tns:AuthRequest\"/>
|
||||
<wsdl:output message=\"tns:AuthResponse\"/>
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
<wsdl:binding name=\"gnuviechadminSOAP\" type=\"tns:gnuviechadmin\">
|
||||
<soap:binding style=\"document\" transport=\"http://schemas.xmlsoap.org/soap/http\"/>
|
||||
<wsdl:operation name=\"Authenticate\">
|
||||
<soap:operation soapAction=\"https://ssl.gnuviech.info/gnuviechadmin/Authenticate\"/>
|
||||
<wsdl:input>
|
||||
<soap:body parts=\" AuthRequest\" use=\"literal\"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body parts=\" AuthResponse\" use=\"literal\"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
<wsdl:service name=\"gnuviechadmin\">
|
||||
<wsdl:port binding=\"tns:gnuviechadminSOAP\" name=\"gnuviechadminSOAP\">
|
||||
<soap:address location=\"https://ssl.gnuviech.info/gnuviechadmin\"/>
|
||||
</wsdl:port>
|
||||
</wsdl:service>
|
||||
</wsdl:definitions>"""
|
||||
|
||||
def __init__(self, post='/gnuviechadmin', **kw):
|
||||
ServiceSOAPBinding.__init__(self, post)
|
||||
|
||||
|
||||
def soap_Authenticate(self, ps):
|
||||
# input vals in request object
|
||||
args = ps.Parse( AuthRequestWrapper )
|
||||
|
||||
# assign return values to response object
|
||||
class SimpleTypeWrapper(str): typecode = AuthResponseWrapper()
|
||||
|
||||
# WARNING specify value eg. SimpleTypeWrapper(1)
|
||||
response = SimpleTypeWrapper(BusinessMethods.login(login=args._login, password=args._password))
|
||||
|
||||
# Return the response
|
||||
return response
|
Loading…
Add table
Add a link
Reference in a new issue