source: TI12-security/trunk/python/Tests/Echo/EchoServer_interface.py @ 1664

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/Tests/Echo/EchoServer_interface.py@1664
Revision 1664, 5.2 KB checked in by pjkersha, 14 years ago (diff)

Modified version working for sig generation with WebSphere?. Verify of
WebSphere? incoming message still to resolve.

Line 
1##################################################
2# EchoServer_interface.py
3#      Generated by ZSI.generate.wsdl2dispatch.DelAuthServiceModuleWriter
4#
5##################################################
6
7from EchoServer_messages import *
8from ZSI.ServiceContainer import ServiceSOAPBinding
9
10class EchoServer(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\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
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:element name=\"EchoEncr\">
32        <xsd:complexType>
33          <xsd:sequence>
34            <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"EchoIn\" type=\"xsd:string\"/>
35          </xsd:sequence>
36        </xsd:complexType>
37      </xsd:element>
38      <xsd:element name=\"EchoEncrResponse\">
39        <xsd:complexType>
40          <xsd:sequence>
41            <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"EchoResult\" type=\"xsd:string\"/>
42          </xsd:sequence>
43        </xsd:complexType>
44      </xsd:element>
45  </xsd:schema>
46  </types>
47  <message name=\"EchoEncrRequest\">
48    <part element=\"tns:EchoEncr\" name=\"parameters\"/>
49  </message>
50  <message name=\"EchoResponse\">
51    <part element=\"tns:EchoResponse\" name=\"parameters\"/>
52  </message>
53  <message name=\"EchoRequest\">
54    <part element=\"tns:Echo\" name=\"parameters\"/>
55  </message>
56  <message name=\"EchoEncrResponse\">
57    <part element=\"tns:EchoEncrResponse\" name=\"parameters\"/>
58  </message>
59  <portType name=\"EchoServer\">
60    <operation name=\"Echo\">
61      <input message=\"tns:EchoRequest\"/>
62      <output message=\"tns:EchoResponse\"/>
63    </operation>
64    <operation name=\"EchoEncr\">
65      <input message=\"tns:EchoEncrRequest\"/>
66      <output message=\"tns:EchoEncrResponse\"/>
67    </operation>
68  </portType>
69  <binding name=\"EchoServer\" type=\"tns:EchoServer\">
70    <soap:binding style=\"document\" transport=\"http://schemas.xmlsoap.org/soap/http\"/>
71    <operation name=\"Echo\">
72      <soap:operation soapAction=\"Echo\"/>
73      <input>
74        <soap:body use=\"literal\"/>
75      </input>
76      <output>
77        <soap:body use=\"literal\"/>
78      </output>
79    </operation>
80    <operation name=\"EchoEncr\">
81      <soap:operation soapAction=\"EchoEncr\"/>
82      <input>
83        <soap:body use=\"literal\"/>
84      </input>
85      <output>
86        <soap:body use=\"literal\"/>
87      </output>
88    </operation>
89  </binding>
90  <service name=\"EchoServer\">
91    <port binding=\"tns:EchoServer\" name=\"EchoServer\">
92      <soap:address location=\"http://localhost:9080/EchoServiceWeb/services/EchoServer\"/>
93    </port>
94  </service>
95</definitions>"""
96
97    def __init__(self, post='/EchoServiceWeb/services/EchoServer', **kw):
98        ServiceSOAPBinding.__init__(self, post)
99        if kw.has_key('impl'):
100            self.impl = kw['impl']
101        self.auth_method_name = None
102        if kw.has_key('auth_method_name'):
103            self.auth_method_name = kw['auth_method_name']
104    def authorize(self, auth_info, post, action):
105        if self.auth_method_name and hasattr(self.impl, self.auth_method_name):
106            return getattr(self.impl, self.auth_method_name)(auth_info, post, action)
107        else:
108            return 1
109
110    def soap_Echo(self, ps):
111        self.request = ps.Parse(EchoRequest.typecode)
112        parameters = self.request.EchoIn
113
114        # If we have an implementation object use it
115        if hasattr(self,'impl'):
116            parameters = self.impl.Echo(parameters)
117
118        result = EchoResponse()
119        # If we have an implementation object, copy the result
120        if hasattr(self,'impl'):
121            result.EchoResult = parameters
122        return result
123
124    soapAction['Echo'] = 'soap_Echo'
125    root[(EchoRequest.typecode.nspname,EchoRequest.typecode.pname)] = 'soap_Echo'
126
127    def soap_EchoEncr(self, ps):
128        self.request = ps.Parse(EchoEncrRequest.typecode)
129        parameters = self.request.EchoIn
130
131        # If we have an implementation object use it
132        if hasattr(self,'impl'):
133            parameters = self.impl.EchoEncr(parameters)
134
135        result = EchoEncrResponse()
136        # If we have an implementation object, copy the result
137        if hasattr(self,'impl'):
138            result.EchoResult = parameters
139        return result
140
141    soapAction['EchoEncr'] = 'soap_EchoEncr'
142    root[(EchoEncrRequest.typecode.nspname,EchoEncrRequest.typecode.pname)] = 'soap_EchoEncr'
143
Note: See TracBrowser for help on using the repository browser.