X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=wsdl%2Fgw2wsdl.py;h=c6070ed77ea8e0c670d919f5a6a8fd1c343c8b7f;hb=234a85a9af327063d83cca4b87916c7fac34da61;hp=0dadaf7c3b9a2822683c95ff59701a5f1cfc689c;hpb=7946a75cb4368490a1734a5fb7a352d1a962eda6;p=sfa.git diff --git a/wsdl/gw2wsdl.py b/wsdl/gw2wsdl.py index 0dadaf7c..c6070ed7 100755 --- a/wsdl/gw2wsdl.py +++ b/wsdl/gw2wsdl.py @@ -2,10 +2,10 @@ # # Sapan Bhatia # +# This code is under preliminary development. I am going to clean it up +# once it is tested to work. # Generates a WSDL for geniwrapper -# Current limitations: -# - Invalid for the following reasons -# - The types are python types, not WSDL types + import os, sys import time @@ -63,7 +63,7 @@ def name_complex_type(arg): #if (complex_types.has_key(arg)): # return complex_types[arg] - types_section = types.firstChild.firstChild + types_section = types.getElementsByTagName("wsdl:types")[0] if (isinstance(arg, Mixed)): inner_types = reduce(fold_complex_type, arg) @@ -76,14 +76,14 @@ def name_complex_type(arg): num_types=num_types+1 type_name = "Type%d"%num_types - complex_type = types_section.appendChild(types.createElement("wsdl:complexType")) + complex_type = types_section.appendChild(types.createElement("xsd:complexType")) complex_type.setAttribute("name", type_name) choice = complex_type.appendChild(types.createElement("xsd:choice")) for n,t in zip(inner_names,inner_types): element = choice.appendChild(types.createElement("element")) element.setAttribute("name", n) - element.setAttribute("type", "tns:%s"%t) + element.setAttribute("type", "%s"%t) element.setAttribute("minOccurs","%d"%min_args) return "tns:%s"%type_name elif (isinstance(arg, Parameter)): @@ -230,13 +230,44 @@ def get_wsdl_definitions(): wsdl = xml.dom.minidom.parseString(wsdl_text_header) return wsdl + +def get_wsdl_definitions(): + wsdl_text_header = """ + + """ % (globals.plc_ns,globals.plc_ns) + + wsdl = xml.dom.minidom.parseString(wsdl_text_header) + + return wsdl + +def get_wsdl_definitions_and_types(): + wsdl_text_header = """ + + + + + """ % (globals.plc_ns,globals.plc_ns,globals.plc_ns) + wsdl = xml.dom.minidom.parseString(wsdl_text_header) + return wsdl + +types = get_wsdl_definitions_and_types() -types = get_wsdl_definitions() -types.firstChild.appendChild(types.createElement("wsdl:types")) wsdl = get_wsdl_definitions() add_wsdl_ports_and_bindings(wsdl) -wsdl_types = wsdl.importNode(types.firstChild.firstChild, True) +wsdl_types = wsdl.importNode(types.getElementsByTagName("wsdl:types")[0], True) wsdl.firstChild.appendChild(wsdl_types) add_wsdl_service(wsdl)