Debuggen von serverseitigen Python Scripts
Die meisten der Debugging-Funktionen - mit Ausnahme von Server-spezifischen Callbacks - können in einem Standard-Pyhton-Interpreter oder einer (virtuellen) Umgebung verwendet werden, nachdem das RaptorXML Server-Modul mittels pip installiert wurde:
pip install –upgrade "/path/to/RaptorXML/application-folder/bin/raptorxml-version-cp37-cp37m-winversion.whl"
Nach Installation des Wheel sollten Sie ein Skript mit jeder beliebigen Python IDE debuggen können. Sie könnten die Hauptfunktionalität in eine separate Funktion, die ein Instanzobjekt erhält, extrahieren. Dieses kann anschließend (i) von den RaptorXML Server Callbacks oder (ii) durch direkte Ausführung des Skripts mit einem Python Interpreter aufgerufen werden.
from altova_api.v2 import xml, xsd, xbrl
def main(instance):
# Here goes the application specific logic
# Main entry point, will be called by RaptorXML after the XML instance validation job has finished
def on_xsi_finished(job, instance):
# instance object will be None if XML Schema validation was not successful
if instance:
main(instance)
# Main entry point, will be called by RaptorXML after the XBRL instance validation job has finished
def on_xbrl_finished(job, instance):
# instance object will be None if XBRL 2.1 validation was not successful
if instance:
main(instance)
if __name__ == ‘__main__’:
# parse arguments and create an instance
instance = …
main(instance)