diff --git a/OPDM/OPDM_SOAP_API.py b/OPDM/OPDM_SOAP_API.py
index 11891e9..8c14667 100644
--- a/OPDM/OPDM_SOAP_API.py
+++ b/OPDM/OPDM_SOAP_API.py
@@ -71,7 +71,7 @@ def __init__(self, server, username="", password="", debug=False, verify=False):
self.debug = debug
self.history = HistoryPlugin()
- self.API_VERSION = "0.0.8" # TODO - Get the version from versioneer
+ self.API_VERSION = "0.0.11" # TODO - Get the version from versioneer
service_wsdl = '{}/cxf/OPDMSoapInterface?wsdl'.format(server)
auth_wsdl = '{}/cxf/OPDMSoapInterface/SoapAuthentication?wsdl'.format(server)
@@ -156,7 +156,7 @@ class Operations:
"""
- GetContentResult = """
+ GetContentResult_Profile = """
"""
+ GetContentResult_OPDMObject = """
+
+
+ {return_mode}
+
+ {mRID}
+
+
+ """
+
PublicationsSubscriptionList = """
AVAILABLE_PUBLICATIONS
@@ -310,10 +323,12 @@ def query_profile(self, metadata_dict):
return query_id, result
- def get_content(self, content_id, return_payload=False):
+ def get_content(self, content_id, return_payload=False, object_type="file"):
"""Downloads single file from OPDM Service Provider to OPDM Client local storage,
to get the file binary as a response of set return_payload to True
+ supported object_types = [file, model]
+
Returns a dictionary with metadata and filename or content, to get the filename or content use:
result['sm:GetContentResult']['sm:part'][1]['opdm:Profile']['opde:Content']
"""
@@ -324,13 +339,16 @@ def get_content(self, content_id, return_payload=False):
logger.debug(f"Return mode: {return_mode}")
- get_content_result = self.Operations.GetContentResult.format(mRID=content_id, return_mode=return_mode)
+ object_types = {"file": self.Operations.GetContentResult_Profile,
+ "model": self.Operations.GetContentResult_OPDMObject}
+
+ get_content_result = object_types[object_type].format(mRID=content_id, return_mode=return_mode)
result = xmltodict.parse(etree.tostring(self.execute_operation(get_content_result.encode())), xml_attribs=False)
if type(result['sm:GetContentResult']['sm:part']) == list:
logger.info("File downloaded")
- logger.debug(result['sm:GetContentResult']['sm:part'][1]['opdm:Profile']['opde:Content'])
+ #logger.debug(result['sm:GetContentResult']['sm:part'][1]['opdm:Profile']['opde:Content'])
else:
logger.error("File download failed")
diff --git a/examples/install_latest_RSL.py b/examples/install_latest_RSL.py
index 45b0f6a..a9c852f 100644
--- a/examples/install_latest_RSL.py
+++ b/examples/install_latest_RSL.py
@@ -55,8 +55,8 @@
if latest_RSL["version"] != installed_RSL:
# Download latest RSL
- response = service.get_content(latest_RSL["id"])
- print(f"Downloaded {response['sm:GetContentResult']['sm:part'][1]['opdm:Profile']['pmd:fileName']}")
+ response = service.get_content(latest_RSL["id"], object_type="model")
+ print(f"Downloaded {response['sm:GetContentResult']['sm:part'][1]['opdm:OPDMObject']['pmd:fileName']}")
# Install latest RSL
response = service.install_ruleset(latest_RSL["version"])