class SoapError(Exception):
def __init__(self, value):
class SoapError(Exception):
def __init__(self, value):
def __init__(self, interface_options):
self.interface_options = interface_options
def __init__(self, interface_options):
self.interface_options = interface_options
- def filter_argname(self,argname):
+ def interface_name (self):
+ if (self.interface_options.aggregate and
+ self.interface_options.registry):
+ return "complete"
+ if self.interface_options.aggregate: return "aggregate"
+ elif self.interface_options.registry: return "registry"
+ else: return "unknown"
+
+ def filter_argname(self, argname):
if (not self.interface_options.lite or (argname!="cred")):
if (argname.find('(') != -1):
# The name has documentation in it :-/
if (not self.interface_options.lite or (argname!="cred")):
if (argname.find('(') != -1):
# The name has documentation in it :-/
- def fold_complex_type_names(self,acc, arg):
- name = arg.doc
- if (type(acc)==list):
- acc.append(name)
- else:
- p_i_b = acc.doc
- acc = [p_i_b,name]
- return acc
-
- def fold_complex_type(self,acc, arg):
- name = self.name_complex_type(arg)
- self.complex_types[arg]=name
- if (type(acc)==list):
- acc.append(name)
- else:
- p_i_b = self.name_complex_type(acc)
- acc = [p_i_b,name]
- return acc
+# def fold_complex_type_names(self,acc, arg):
+# name = arg.doc
+# if (type(acc)==list):
+# acc.append(name)
+# else:
+# p_i_b = acc.doc
+# acc = [p_i_b,name]
+# return acc
+#
+# def fold_complex_type(self,acc, arg):
+# name = self.name_complex_type(arg)
+# self.complex_types[arg]=name
+# if (type(acc)==list):
+# acc.append(name)
+# else:
+# p_i_b = self.name_complex_type(acc)
+# acc = [p_i_b,name]
+# return acc
- inner_types = reduce(self.fold_complex_type, arg)
- inner_names = reduce(self.fold_complex_type_names, arg)
+# inner_types = reduce(self.fold_complex_type, arg)
+# inner_names = reduce(self.fold_complex_type_names, arg)
+ inner_types = [ self.name_complex_type(x) for x in arg ]
+ inner_names = [ x.doc for x in arg ]
type_name = "Type%d"%self.num_types
complex_type = types_section.appendChild(self.types.createElement("xsd:complexType"))
complex_type.setAttribute("name", type_name)
choice = complex_type.appendChild(self.types.createElement("xsd:choice"))
type_name = "Type%d"%self.num_types
complex_type = types_section.appendChild(self.types.createElement("xsd:complexType"))
complex_type.setAttribute("name", type_name)
choice = complex_type.appendChild(self.types.createElement("xsd:choice"))
element = choice.appendChild(self.types.createElement("element"))
n = self.filter_argname(n)
element.setAttribute("name", n)
element = choice.appendChild(self.types.createElement("element"))
n = self.filter_argname(n)
element.setAttribute("name", n)
return "xsdl:%s"%type_name
elif (isinstance(arg, Parameter)):
return (self.name_simple_type(arg.type))
return "xsdl:%s"%type_name
elif (isinstance(arg, Parameter)):
return (self.name_simple_type(arg.type))
- elif type(arg) == ListType or type(arg) == TupleType:
- inner_type = self.name_complex_type(arg[0])
+ elif type(arg) in ( ListType , TupleType ):
+ inner_type = self.name_complex_type(arg[0])
self.num_types=self.num_types+1
type_name = "Type%d"%self.num_types
complex_type = types_section.appendChild(self.types.createElement("xsd:complexType"))
self.num_types=self.num_types+1
type_name = "Type%d"%self.num_types
complex_type = types_section.appendChild(self.types.createElement("xsd:complexType"))
type_name = self.filter_argname(type_name)
complex_type.setAttribute("name", type_name)
complex_content = complex_type.appendChild(self.types.createElement("xsd:sequence"))
type_name = self.filter_argname(type_name)
complex_type.setAttribute("name", type_name)
complex_content = complex_type.appendChild(self.types.createElement("xsd:sequence"))
element=complex_content.appendChild(self.types.createElement("xsd:element"))
element.setAttribute("name",k)
element.setAttribute("type",inner_type)
element=complex_content.appendChild(self.types.createElement("xsd:element"))
element.setAttribute("name",k)
element.setAttribute("type",inner_type)
def param_type(self, arg):
return (self.name_complex_type(arg))
def param_type(self, arg):
return (self.name_complex_type(arg))
in_el.setAttribute("name", method + "_in")
for service_name in function.interfaces:
in_el.setAttribute("name", method + "_in")
for service_name in function.interfaces:
arg_part = in_el.appendChild(self.wsdl.createElement("part"))
arg_part.setAttribute("name", argname)
arg_part.setAttribute("type", self.param_type(argtype))
arg_part = in_el.appendChild(self.wsdl.createElement("part"))
arg_part.setAttribute("name", argname)
arg_part.setAttribute("type", self.param_type(argtype))
out_el.setAttribute("name", method + "_out")
ret_part = out_el.appendChild(self.wsdl.createElement("part"))
ret_part.setAttribute("name", "Result")
out_el.setAttribute("name", method + "_out")
ret_part = out_el.appendChild(self.wsdl.createElement("part"))
ret_part.setAttribute("name", "Result")
op_el = port_el.appendChild(self.wsdl.createElement("operation"))
op_el.setAttribute("name", method)
inp_el=self.wsdl.createElement("input")
op_el = port_el.appendChild(self.wsdl.createElement("operation"))
op_el.setAttribute("name", method)
inp_el=self.wsdl.createElement("input")
bind_el.setAttribute("name", method + "_binding")
bind_el.setAttribute("type", "tns:" + method + "_port")
bind_el.setAttribute("name", method + "_binding")
bind_el.setAttribute("type", "tns:" + method + "_port")
soap_bind = bind_el.appendChild(self.wsdl.createElement("soap:binding"))
soap_bind.setAttribute("style", "rpc")
soap_bind.setAttribute("transport","http://schemas.xmlsoap.org/soap/http")
soap_bind = bind_el.appendChild(self.wsdl.createElement("soap:binding"))
soap_bind.setAttribute("style", "rpc")
soap_bind.setAttribute("transport","http://schemas.xmlsoap.org/soap/http")
wsdl_op = bind_el.appendChild(self.wsdl.createElement("operation"))
wsdl_op.setAttribute("name", method)
wsdl_op.appendChild(self.wsdl.createElement("soap:operation")).setAttribute("soapAction",
"urn:" + method)
wsdl_op = bind_el.appendChild(self.wsdl.createElement("operation"))
wsdl_op.setAttribute("name", method)
wsdl_op.appendChild(self.wsdl.createElement("soap:operation")).setAttribute("soapAction",
"urn:" + method)
wsdl_input = wsdl_op.appendChild(self.wsdl.createElement("input"))
input_soap_body = wsdl_input.appendChild(self.wsdl.createElement("soap:body"))
input_soap_body.setAttribute("use", "encoded")
input_soap_body.setAttribute("namespace", "urn:" + method)
input_soap_body.setAttribute("encodingStyle","http://schemas.xmlsoap.org/soap/encoding/")
wsdl_input = wsdl_op.appendChild(self.wsdl.createElement("input"))
input_soap_body = wsdl_input.appendChild(self.wsdl.createElement("soap:body"))
input_soap_body.setAttribute("use", "encoded")
input_soap_body.setAttribute("namespace", "urn:" + method)
input_soap_body.setAttribute("encodingStyle","http://schemas.xmlsoap.org/soap/encoding/")
wsdl_output = wsdl_op.appendChild(self.wsdl.createElement("output"))
output_soap_body = wsdl_output.appendChild(self.wsdl.createElement("soap:body"))
output_soap_body.setAttribute("use", "encoded")
output_soap_body.setAttribute("namespace", "urn:" + method)
output_soap_body.setAttribute("encodingStyle","http://schemas.xmlsoap.org/soap/encoding/")
wsdl_output = wsdl_op.appendChild(self.wsdl.createElement("output"))
output_soap_body = wsdl_output.appendChild(self.wsdl.createElement("soap:body"))
output_soap_body.setAttribute("use", "encoded")
output_soap_body.setAttribute("namespace", "urn:" + method)
output_soap_body.setAttribute("encodingStyle","http://schemas.xmlsoap.org/soap/encoding/")
def add_wsdl_services(self):
for service in self.services.keys():
if (getattr(self.interface_options,service)):
def add_wsdl_services(self):
for service in self.services.keys():
if (getattr(self.interface_options,service)):
service_el.setAttribute("name", service)
for method in self.services[service]:
service_el.setAttribute("name", service)
for method in self.services[service]:
servport_el.setAttribute("binding", "tns:" + name + "_binding")
soapaddress = servport_el.appendChild(self.wsdl.createElement("soap:address"))
servport_el.setAttribute("binding", "tns:" + name + "_binding")
soapaddress = servport_el.appendChild(self.wsdl.createElement("soap:address"))
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
- """ % (globals.plc_ns,globals.plc_ns,globals.plc_ns)
-
+ """ % (self.interface_name(),plc_ns,plc_ns,plc_ns)
+
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<types>
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<types>
- </wsdl:definitions> """ % (globals.plc_ns, globals.plc_ns, globals.plc_ns, globals.plc_ns)
+ </wsdl:definitions> """ % (self.interface_name(),plc_ns, plc_ns, plc_ns, plc_ns)
def add_wsdl_types(self):
wsdl_types = self.wsdl.importNode(self.types.getElementsByTagName("types")[0], True)
def add_wsdl_types(self):
wsdl_types = self.wsdl.importNode(self.types.getElementsByTagName("types")[0], True)
- parser.add_option("-r", "--registry", dest="registry", action="store_true",
+ parser.add_option("-r", "--registry", dest="registry", action="store_true",
- parser.add_option("-s", "--slice-manager",
- action="store_true", dest="slicemgr",
- help="Generate sm.wsdl")
parser.add_option("-a", "--aggregate", action="store_true", dest="aggregate",
help="Generate am.wsdl")
parser.add_option("-a", "--aggregate", action="store_true", dest="aggregate",
help="Generate am.wsdl")
parser.add_option("-g", "--geni-aggregate", action="store_true", dest="geni_am",
help="Generate gm.wsdl")
parser.add_option("-l", "--lite", action="store_true", dest="lite",
parser.add_option("-g", "--geni-aggregate", action="store_true", dest="geni_am",
help="Generate gm.wsdl")
parser.add_option("-l", "--lite", action="store_true", dest="lite",