From 7d7a3f6364bf0e4219e1822270d7726e975c726a Mon Sep 17 00:00:00 2001 From: parmentelat Date: Mon, 10 Dec 2018 17:50:29 +0100 Subject: [PATCH] trash wsdl altogether --- plcapi.spec | 6 -- wsdl/Makefile | 11 ---- wsdl/api2wsdl.py | 148 ----------------------------------------------- wsdl/globals.py | 1 - 4 files changed, 166 deletions(-) delete mode 100644 wsdl/Makefile delete mode 100755 wsdl/api2wsdl.py delete mode 100644 wsdl/globals.py diff --git a/plcapi.spec b/plcapi.spec index 48d8ff7..7c1371d 100644 --- a/plcapi.spec +++ b/plcapi.spec @@ -85,7 +85,6 @@ through Apache mod_python. # # Build __init__.py metafiles and PHP API. %{__make} %{?_smp_mflags} -%{__make} -C wsdl %install rm -rf $RPM_BUILD_ROOT @@ -106,10 +105,6 @@ mkdir -p ${RPM_BUILD_ROOT}/etc/planetlab/db-config.d cp db-config.d/* ${RPM_BUILD_ROOT}/etc/planetlab/db-config.d chmod 444 ${RPM_BUILD_ROOT}/etc/planetlab/db-config.d/* -# Install wsdl -echo "* Installing wsdl" -install -D -m 644 wsdl/plcapi.wsdl $RPM_BUILD_ROOT/var/www/html/wsdl/plcapi.wsdl - ## Thierry - June 2013 - omfv6 does not require xmpp pubsub nodes management any more ## Install omf_slicemgr.py #install -D -m 755 omf/omf_slicemgr.py $RPM_BUILD_ROOT/usr/bin/omf_slicemgr.py @@ -139,7 +134,6 @@ rm -rf $RPM_BUILD_ROOT %config (noreplace) %{_datadir}/plc_api/PLC/Accessors/Accessors_site.py /etc/plc.d /etc/planetlab/db-config.d -/var/www/html/wsdl/plcapi.wsdl #/usr/bin/omf_slicemgr.py* #/usr/bin/reset_xmpp_pubsub_nodes.py* /var/log/plcapi.log diff --git a/wsdl/Makefile b/wsdl/Makefile deleted file mode 100644 index f1ff532..0000000 --- a/wsdl/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# Build a WSDL spec of the API - -all: plcapi.wsdl - -plcapi.wsdl: - PYTHONPATH=../ python3 api2wsdl.py > $@ - -clean: - rm -f plcapi.wsdl - -.PHONY: all clean diff --git a/wsdl/api2wsdl.py b/wsdl/api2wsdl.py deleted file mode 100755 index a5c7b35..0000000 --- a/wsdl/api2wsdl.py +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env python3 -# -# Sapan Bhatia -# -# Generates a WSDL for plcapi -# Current limitations: -# - Invalid for the following reasons -# - The types are python types, not WSDL types -# - I'm not sure of what to do with the auth structure - -import os, sys -import time -import pdb -import xml.dom.minidom -import inspect -import globals - -from PLC.API import PLCAPI -from PLC.Method import * -from PLC.Auth import Auth -from PLC.Parameter import Parameter, Mixed, python_type, xmlrpc_type - - -api = PLCAPI(None) - -# Class functions - -def param_type(param): - if isinstance(param, Mixed) and len(param): - subtypes = [param_type(subparam) for subparam in param] - return " or ".join(subtypes) - elif isinstance(param, (list, tuple, set)) and len(param): - return "array of " + " or ".join([param_type(subparam) for subparam in param]) - else: - return xmlrpc_type(python_type(param)) - - -def add_wsdl_ports_and_bindings (wsdl): - api.all_methods.sort() - for method in api.all_methods: - # Skip system. methods - if "system." in method: - continue - - function = api.callable(method) - - # Commented documentation - #lines = ["// " + line.strip() for line in function.__doc__.strip().split("\n")] - #print "\n".join(lines) - #print - - - in_el = wsdl.firstChild.appendChild(wsdl.createElement("wsdl:message")) - in_el.setAttribute("name", function.name + "_in") - - # Arguments - - if (function.accepts): - (min_args, max_args, defaults) = function.args() - for (argname,argtype) in zip(max_args,function.accepts): - arg_part = in_el.appendChild(wsdl.createElement("wsdl:part")) - arg_part.setAttribute("name", argname) - arg_part.setAttribute("type", param_type(argtype)) - - # Return type - return_type = function.returns - out_el = wsdl.firstChild.appendChild(wsdl.createElement("wsdl:message")) - out_el.setAttribute("name", function.name + "_out") - ret_part = out_el.appendChild(wsdl.createElement("wsdl:part")) - ret_part.setAttribute("name", "returnvalue") - ret_part.setAttribute("type", param_type(return_type)) - - # Port connecting arguments with return type - - port_el = wsdl.firstChild.appendChild(wsdl.createElement("wsdl:portType")) - port_el.setAttribute("name", function.name + "_port") - - op_el = port_el.appendChild(wsdl.createElement("wsdl:operation")) - op_el.setAttribute("name", function.name) - op_el.appendChild(wsdl.createElement("wsdl:input")).setAttribute("message","tns:" + function.name + "_in") - op_el.appendChild(wsdl.createElement("wsdl:output")).setAttribute("message","tns:" + function.name + "_out") - - # Bindings - - bind_el = wsdl.firstChild.appendChild(wsdl.createElement("wsdl:binding")) - bind_el.setAttribute("name", function.name + "_binding") - bind_el.setAttribute("type", "tns:" + function.name + "_port") - - soap_bind = bind_el.appendChild(wsdl.createElement("soap:binding")) - soap_bind.setAttribute("style", "rpc") - soap_bind.setAttribute("transport","http://schemas.xmlsoap.org/soap/http") - - - wsdl_op = bind_el.appendChild(wsdl.createElement("wsdl:operation")) - wsdl_op.setAttribute("name", function.name) - wsdl_op.appendChild(wsdl.createElement("soap:operation")).setAttribute("soapAction", - "urn:" + function.name) - - - wsdl_input = wsdl_op.appendChild(wsdl.createElement("wsdl:input")) - input_soap_body = wsdl_input.appendChild(wsdl.createElement("soap:body")) - input_soap_body.setAttribute("use", "encoded") - input_soap_body.setAttribute("namespace", "urn:" + function.name) - input_soap_body.setAttribute("encodingStyle","http://schemas.xmlsoap.org/soap/encoding/") - - - wsdl_output = wsdl_op.appendChild(wsdl.createElement("wsdl:output")) - output_soap_body = wsdl_output.appendChild(wsdl.createElement("soap:body")) - output_soap_body.setAttribute("use", "encoded") - output_soap_body.setAttribute("namespace", "urn:" + function.name) - output_soap_body.setAttribute("encodingStyle","http://schemas.xmlsoap.org/soap/encoding/") - - -def add_wsdl_service(wsdl): - service_el = wsdl.firstChild.appendChild(wsdl.createElement("wsdl:service")) - service_el.setAttribute("name", "plc_api_service") - - for method in api.all_methods: - name=api.callable(method).name - servport_el = service_el.appendChild(wsdl.createElement("wsdl:port")) - servport_el.setAttribute("name", name + "_port") - servport_el.setAttribute("binding", "tns:" + name + "_binding") - - soapaddress = servport_el.appendChild(wsdl.createElement("soap:address")) - soapaddress.setAttribute("location", "%s" % globals.plc_ns) - - -def get_wsdl_definitions(): - wsdl_text_header = """ - """ % (globals.plc_ns,globals.plc_ns) - - wsdl = xml.dom.minidom.parseString(wsdl_text_header) - - return wsdl - - -wsdl = get_wsdl_definitions() -add_wsdl_ports_and_bindings(wsdl) -add_wsdl_service(wsdl) - - -print(wsdl.toprettyxml()) diff --git a/wsdl/globals.py b/wsdl/globals.py deleted file mode 100644 index af9d1c4..0000000 --- a/wsdl/globals.py +++ /dev/null @@ -1 +0,0 @@ -plc_ns = "http://www.planet-lab.org/plcapi.wsdl" -- 2.43.0