Skip to content

Commit 931bfb2

Browse files
committed
Add version to WSDL and index.html
remove wsdl.py. not used
1 parent ba71540 commit 931bfb2

File tree

10 files changed

+33
-82
lines changed

10 files changed

+33
-82
lines changed

wof/WofWsdls.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@ class declares a list of ports
3030

3131
class WofWSDL_1_0(InterfaceDocumentBase):
3232
templates=None
33+
network=None
34+
version=None
3335

34-
def __init__(self, interface=None, _with_partnerlink=False, templates=None):
36+
def __init__(self, interface=None, _with_partnerlink=False, templates=None,network=None,version=None):
3537
super(WofWSDL_1_0, self).__init__(interface)
3638
self.templates=templates
39+
self.network=network
40+
self.version=version
3741

3842
def build_interface_document(self, url, templates):
3943
"""This function is supposed to be called just once, as late as possible
@@ -75,7 +79,7 @@ def get_interface_document(self):
7579
def get_wsdl_1_0(self, url, templates ):
7680
env = Environment(loader=FileSystemLoader(templates))
7781
template = env.get_template('wsdl_temp.wsdl')
78-
response = template.render(serv_loc=url)
82+
response = template.render(serv_loc=url,network=self.network,version=self.version)
7983
response = response.encode('utf-8')
8084
#response.headers['Content-Type'] = 'text/xml'
8185

@@ -85,7 +89,7 @@ def on_get_wsdl_1_0_(self, ctx ):
8589
env = Environment(loader=FileSystemLoader(self.templates))
8690
template = env.get_template('wsdl_temp.wsdl')
8791
reqstring = 'http://{0}{1}'.format(ctx.transport.req['HTTP_HOST'],ctx.transport.req['SCRIPT_NAME'])
88-
response = template.render(serv_loc=reqstring)
92+
response = template.render(serv_loc=reqstring,network=self.network,version=self.version)
8993
response = response.encode('utf-8')
9094
#response.headers['Content-Type'] = 'text/xml'
9195
ctx.transport.wsdl = response
@@ -94,10 +98,15 @@ def on_get_wsdl_1_0_(self, ctx ):
9498
class WofWSDL_1_1(InterfaceDocumentBase):
9599
templates=None
96100
templateName = 'wsdl_1_1_template.wsdl'
101+
network=None
102+
version=None
97103

98-
def __init__(self, interface=None, _with_partnerlink=False, templates=None):
104+
105+
def __init__(self, interface=None, _with_partnerlink=False, templates=None,network=None,version=None):
99106
super(WofWSDL_1_1, self).__init__(interface)
100107
self.templates=templates
108+
self.network=network
109+
self.version=version
101110

102111
def build_interface_document(self, url, templates):
103112
"""This function is supposed to be called just once, as late as possible
@@ -132,7 +141,7 @@ def get_wsdl_1_1(self, url, templates ):
132141

133142
env = Environment(loader=FileSystemLoader(templates))
134143
template = env.get_template(self.templateName)
135-
response = template.render(serv_loc=url)
144+
response = template.render(serv_loc=url,network=self.network,version=self.version)
136145
response = response.encode('utf-8')
137146
#response.headers['Content-Type'] = 'text/xml'
138147

@@ -142,7 +151,7 @@ def on_get_wsdl_1_1_(self, ctx ):
142151
env = Environment(loader=FileSystemLoader(self.templates))
143152
template = env.get_template(self.templateName)
144153
reqstring = 'http://{0}{1}'.format(ctx.transport.req['HTTP_HOST'],ctx.transport.req['SCRIPT_NAME'])
145-
response = template.render(serv_loc=reqstring)
154+
response = template.render(serv_loc=reqstring,network=self.network,version=self.version)
146155
response = response.encode('utf-8')
147156
#response.headers['Content-Type'] = 'text/xml'
148157
ctx.transport.wsdl = response

wof/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from core import create_wof_flask_app, _SERVICE_PARAMS, site_map
1+
from core import create_wof_flask_app, _SERVICE_PARAMS, site_map, _VERSION
22
from core_1_0 import WOF
33
from core_1_1 import WOF_1_1

wof/apps/templates/wsdl_1_1_template.wsdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.cuahsi.org/his/1.1/ws/" xmlns:s1="http://www.cuahsi.org/waterML/1.1/" xmlns:s2="http://www.cuahsi.org/his/1.1/ws/AbstractTypes" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://www.cuahsi.org/his/1.1/ws/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
33
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
4-
Developmental Python implementation of WaterOneFlow 1.1 for {{network}}
4+
Developmental Python implementation of WaterOneFlow 1.1 for "{{network}}" WOFPY: version "{{ version }}"
55
</wsdl:documentation>
66
<wsdl:types>
77
<s:schema elementFormDefault="qualified" targetNamespace="http://www.cuahsi.org/his/1.1/ws/">

wof/apps/templates/wsdl_temp.wsdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.cuahsi.org/his/1.0/ws/" xmlns:s1="http://www.cuahsi.org/waterML/1.0/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://www.cuahsi.org/his/1.0/ws/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
33
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
4-
Developmental Python implementation of WaterOneFlow for {{network}}
4+
Developmental Python implementation of WaterOneFlow for "{{network}}" WOFPY: version "{{ version }}"
55
</wsdl:documentation>
66
<wsdl:types>
77
<s:schema elementFormDefault="qualified" targetNamespace="http://www.cuahsi.org/his/1.0/ws/">

wof/apps/wsdl.py

Lines changed: 0 additions & 67 deletions
This file was deleted.

wof/core.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
logging.getLogger('spyne.interface.xml_schema').setLevel(logging.ERROR)
3131
logging.getLogger('spyne.protocol.dictdoc.simple').setLevel(logging.ERROR)
3232

33+
_VERSION= '2.0.x-alpha' #until we find a way to get from setup at runtime
34+
3335
_SERVICE_PARAMS = {
3436
"r_type" : "rest",
3537
"s_type" : "soap",
@@ -260,12 +262,16 @@ def getSpyneApplications(wof_obj_1_0, wof_obj_1_1, templates=None):
260262

261263
if templatesPath:
262264
# needs to be service_baseURL. in config wof_obj_1_0.service_wsdl
263-
wsdl10= WofWSDL_1_0(soap_wsgi_wrapper_1_0.doc.wsdl11.interface, templates=templatesPath)
265+
wsdl10= WofWSDL_1_0(soap_wsgi_wrapper_1_0.doc.wsdl11.interface, templates=templatesPath
266+
, network=sensorNetwork,
267+
version=_VERSION)
264268

265269
#soap_wsgi_wrapper_1_0._wsdl = wsdl10.build_interface_document('/'+ sensorNetwork+'/soap/wateroneflow',templatesPath) #.get_wsdl_1_0('/'+ sensorNetwork+'/soap/wateroneflow')
266270
soap_wsgi_wrapper_1_0.event_manager.add_listener('wsdl', wsdl10.on_get_wsdl_1_0_)
267271
# path: /{sensorNetwork}/soap/wateroneflow_1_1/.wsdl returns the WSDL.
268-
wsdl11= WofWSDL_1_1(soap_wsgi_wrapper_1_1.doc.wsdl11.interface, templates=templatesPath)
272+
wsdl11= WofWSDL_1_1(soap_wsgi_wrapper_1_1.doc.wsdl11.interface, templates=templatesPath
273+
, network=sensorNetwork,
274+
version=_VERSION)
269275
#soap_wsgi_wrapper_1_1._wsdl = wsdl11.build_interface_document('/'+ sensorNetwork+'/soap/wateroneflow_1_1',templatesPath) #.get_wsdl_1_0('/'+ sensorNetwork+'/soap/wateroneflow')
270276
soap_wsgi_wrapper_1_1.event_manager.add_listener('wsdl', wsdl11.on_get_wsdl_1_1_)
271277

wof/flask/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from flask import Flask, render_template, current_app, make_response, request
2-
2+
import wof
33
import config
44
import datetime
55

@@ -40,7 +40,8 @@ def index():
4040
rest2=path+'/rest_2/',
4141
soap10=path+'/soap/cuahsi_1_0/',
4242
soap11=path+'/soap/cuahsi_1_1/',
43-
p=wof_inst.network)
43+
p=wof_inst.network,
44+
v=wof._VERSION)
4445

4546
app.add_url_rule(servicesPath+'/', wof_inst.network+'index', index)
4647

wof/flask/templates/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<html>
22
<head>
33
<title>WaterOneFlow in Python</title>
4+
45
<style>
56
table, th, td {
67
border: 1px solid black;
@@ -62,6 +63,7 @@
6263
</a>
6364
</li>
6465
</ul>
66+
<p>version: {{ v }}</p>
6567
</body>
6668

6769
</html>

wof/flask/templates/wsdl_1_1_template.wsdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.cuahsi.org/his/1.1/ws/" xmlns:s1="http://www.cuahsi.org/waterML/1.1/" xmlns:s2="http://www.cuahsi.org/his/1.1/ws/AbstractTypes" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://www.cuahsi.org/his/1.1/ws/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
33
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
4-
Developmental Python implementation of WaterOneFlow 1.1 for {{network}}
4+
Developmental Python implementation of WaterOneFlow 1.1 for {{network}} WOFPY: version {{ version }}
55
</wsdl:documentation>
66
<wsdl:types>
77
<s:schema elementFormDefault="qualified" targetNamespace="http://www.cuahsi.org/his/1.1/ws/">

wof/flask/templates/wsdl_temp.wsdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.cuahsi.org/his/1.0/ws/" xmlns:s1="http://www.cuahsi.org/waterML/1.0/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://www.cuahsi.org/his/1.0/ws/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
33
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
4-
Developmental Python implementation of WaterOneFlow for {{network}}
4+
Developmental Python implementation of WaterOneFlow for {{network}} WOFPY: version {{ version }}
55
</wsdl:documentation>
66
<wsdl:types>
77
<s:schema elementFormDefault="qualified" targetNamespace="http://www.cuahsi.org/his/1.0/ws/">

0 commit comments

Comments
 (0)