source: TI12-security/trunk/python/ndg.security.test/ndg/security/test/wsSecurity/server/Echo_services_server.py @ 3122

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.test/ndg/security/test/wsSecurity/server/Echo_services_server.py@3122
Revision 3122, 3.4 KB checked in by pjkersha, 12 years ago (diff)

security/python/ndg.security.test/ndg/security/test/wsSecurity/client: complete unit test

Line 
1##################################################
2# Echo_services_server.py
3#      Generated by ZSI.generate.wsdl2dispatch.DelAuthServiceModuleWriter
4#
5##################################################
6
7from ndg.security.test.wsSecurity.server.Echo_services import *
8from ZSI.ServiceContainer import ServiceSOAPBinding
9
10class Echo(ServiceSOAPBinding):
11    soapAction = {}
12    root = {}
13    _wsdl = """<?xml version=\"1.0\" ?>
14<definitions targetNamespace=\"urn:ZSI:examples\" 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:examples\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
15  <types>
16  <xsd:schema elementFormDefault=\"qualified\" targetNamespace=\"urn:ZSI:examples\">
17      <xsd:element name=\"Echo\">
18        <xsd:complexType>
19          <xsd:sequence>
20            <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"EchoIn\" type=\"xsd:string\"/>
21          </xsd:sequence>
22        </xsd:complexType>
23      </xsd:element>
24      <xsd:element name=\"EchoResponse\">
25        <xsd:complexType>
26          <xsd:sequence>
27            <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"EchoResult\" type=\"xsd:string\"/>
28          </xsd:sequence>
29        </xsd:complexType>
30      </xsd:element>
31  </xsd:schema>
32  </types>
33
34  <message name=\"EchoInputMsg\">
35    <part element=\"tns:Echo\" name=\"parameters\"/>
36  </message>
37  <message name=\"EchoOutputMsg\">
38    <part element=\"tns:EchoResponse\" name=\"parameters\"/>
39  </message>
40
41  <portType name=\"Echo\">
42    <operation name=\"Echo\">
43      <input message=\"tns:EchoInputMsg\"/>
44      <output message=\"tns:EchoOutputMsg\"/>
45    </operation>
46  </portType>
47
48  <binding name=\"Echo\" type=\"tns:Echo\">
49    <soap:binding style=\"document\" transport=\"http://schemas.xmlsoap.org/soap/http\"/>
50    <operation name=\"Echo\">
51      <soap:operation soapAction=\"Echo\"/>
52        <input>
53          <soap:body use=\"literal\"/>
54        </input>
55        <output>
56          <soap:body use=\"literal\"/>
57        </output>
58    </operation>
59  </binding>
60
61  <service name=\"Echo\">
62    <port binding=\"tns:Echo\" name=\"Echo\">
63      <soap:address location=\"http://localhost:7100\"/>
64    </port>
65  </service>
66
67</definitions>"""
68
69    def __init__(self, post='', **kw):
70        ServiceSOAPBinding.__init__(self, post)
71        if kw.has_key('impl'):
72            self.impl = kw['impl']
73        self.auth_method_name = None
74        if kw.has_key('auth_method_name'):
75            self.auth_method_name = kw['auth_method_name']
76    def authorize(self, auth_info, post, action):
77        if self.auth_method_name and hasattr(self.impl, self.auth_method_name):
78            return getattr(self.impl, self.auth_method_name)(auth_info, post, action)
79        else:
80            return 1
81
82    def soap_Echo(self, ps):
83        self.request = ps.Parse(EchoInputMsg.typecode)
84        parameters = self.request._EchoIn
85
86        # If we have an implementation object use it
87        if hasattr(self,'impl'):
88            parameters = self.impl.Echo(parameters)
89
90        result = EchoOutputMsg()
91        # If we have an implementation object, copy the result
92        if hasattr(self,'impl'):
93            result._EchoResult = parameters
94        return result
95
96    soapAction['Echo'] = 'soap_Echo'
97    root[(EchoInputMsg.typecode.nspname,EchoInputMsg.typecode.pname)] = 'soap_Echo'
98
Note: See TracBrowser for help on using the repository browser.