source: TI12-security/trunk/NDGSecurity/python/Tests/SimpleCA/SimpleCA_interface.py @ 7080

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDGSecurity/python/Tests/SimpleCA/SimpleCA_interface.py
Revision 7080, 3.7 KB checked in by pjkersha, 10 years ago (diff)
  • Property svn:keywords set to Id
Line 
1##################################################
2# SimpleCA_interface.py
3#      Generated by ZSI.generate.wsdl2dispatch.DelAuthServiceModuleWriter
4#
5##################################################
6
7from SimpleCA_messages import *
8from ZSI.ServiceContainer import ServiceSOAPBinding
9
10class SimpleCAService(ServiceSOAPBinding):
11    soapAction = {}
12    root = {}
13    _wsdl = """<?xml version=\"1.0\" ?>
14<wsdl:definitions name=\"SimpleCA\" targetNamespace=\"urn:ZSI:SimpleCA\" xmlns=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:http=\"http://schemas.xmlsoap.org/wsdl/http/\" xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:tns=\"urn:ZSI:SimpleCA\" xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
15
16  <wsdl:types>
17    <xsd:schema>
18      <xsd:element name=\"certReq\">
19        <xsd:complexType>
20          <xsd:sequence>
21            <xsd:element name=\"x509CertReq\" type=\"xsd:string\"/>
22          </xsd:sequence>
23        </xsd:complexType>
24      </xsd:element>
25      <xsd:element name=\"certReqResponse\">
26        <xsd:complexType>
27          <xsd:sequence>
28            <xsd:element name=\"x509Cert\" type=\"xsd:string\"/>
29            <xsd:element name=\"errMsg\" type=\"xsd:string\"/>
30          </xsd:sequence>
31        </xsd:complexType>
32      </xsd:element>
33    </xsd:schema>
34  </wsdl:types>
35
36  <wsdl:message name=\"certRequest\">
37    <wsdl:part element=\"certReq\" name=\"parameters\"/>
38  </wsdl:message>
39
40  <wsdl:message name=\"certResponse\">
41    <wsdl:part element=\"certReqResponse\" name=\"parameters\"/>
42  </wsdl:message>
43
44  <wsdl:portType name=\"SimpleCA\">
45    <wsdl:operation name=\"reqCert\">
46      <wsdl:input message=\"tns:certRequest\"/>
47      <wsdl:output message=\"tns:certResponse\"/>
48    </wsdl:operation>
49  </wsdl:portType>
50
51  <wsdl:binding name=\"SimpleCABinding\" type=\"tns:SimpleCA\">
52    <soap:binding style=\"document\" transport=\"http://schemas.xmlsoap.org/soap/http\"/>
53    <wsdl:operation name=\"reqCert\">
54      <soap:operation soapAction=\"reqCert\"/>
55      <wsdl:input>
56        <soap:body use=\"literal\"/>
57      </wsdl:input>
58      <wsdl:output>
59        <soap:body use=\"literal\"/>
60      </wsdl:output>
61    </wsdl:operation>
62  </wsdl:binding>
63
64  <wsdl:service name=\"SimpleCAService\">
65    <wsdl:documentation>SimpleCA web service</wsdl:documentation>
66    <wsdl:port binding=\"tns:SimpleCABinding\" name=\"SimpleCA\">
67      <soap:address location=\"http://localhost:5001\"/>
68    </wsdl:port>
69  </wsdl:service>
70</wsdl:definitions>"""
71
72    def __init__(self, post='', **kw):
73        ServiceSOAPBinding.__init__(self, post)
74        if kw.has_key('impl'):
75            self.impl = kw['impl']
76        self.auth_method_name = None
77        if kw.has_key('auth_method_name'):
78            self.auth_method_name = kw['auth_method_name']
79    def authorize(self, auth_info, post, action):
80        if self.auth_method_name and hasattr(self.impl, self.auth_method_name):
81            return getattr(self.impl, self.auth_method_name)(auth_info, post, action)
82        else:
83            return 1
84
85    def soap_reqCert(self, ps):
86        self.request = ps.Parse(certRequest.typecode)
87        parameters = self.request.x509CertReq
88
89        # If we have an implementation object use it
90        if hasattr(self,'impl'):
91            parameters = self.impl.reqCert(parameters)
92
93        result = certResponse()
94        # If we have an implementation object, copy the result
95        if hasattr(self,'impl'):
96            # Should have a tuple of 2 args
97            result.x509Cert = parameters[0]
98            result.errMsg = parameters[1]
99        return result
100
101    soapAction['reqCert'] = 'soap_reqCert'
102    root[(certRequest.typecode.nspname,certRequest.typecode.pname)] = 'soap_reqCert'
103
Note: See TracBrowser for help on using the repository browser.