From 234a85a9af327063d83cca4b87916c7fac34da61 Mon Sep 17 00:00:00 2001 From: Sapan Bhatia Date: Tue, 16 Jun 2009 20:36:01 +0000 Subject: [PATCH] Trying to get the wsdl validated... --- wsdl/gw2wsdl.py | 49 +++++- wsdl/sfa.wsdl | 454 ------------------------------------------------ 2 files changed, 40 insertions(+), 463 deletions(-) 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) diff --git a/wsdl/sfa.wsdl b/wsdl/sfa.wsdl index 2f188f3f..e69de29b 100644 --- a/wsdl/sfa.wsdl +++ b/wsdl/sfa.wsdl @@ -1,454 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 2.47.0