Python API not running as wanted

methusi
methusi New Altair Community Member
edited November 5 in Community Q&A
Hi

I am really new to RM and the whole ecosystem. For a student project I deployed a RM AI Hub on a server with the docker deployment which works all as expected. But if I try to run a process via python I get an error and have no clue how to solve that issue.
Python snippet:
import rapidminer
connector = rapidminer.Server(
"http:// myserver",
username="username",
password="password")

As of the output I can see that the connection to the server is established successfully.
I created a webservice, but I am not sure if that makes any difference.

I am glad for any help - thanks a lot :-)

See the full output below:

2021-11-08 12:49:38,440 [INFO -- python]: Successfully connected to the Server
Traceback (most recent call last):
  File "/Users/user/Coding/Python/practical-project/venv/PycharmProjects/lib/python3.8/site-packages/zeep/loader.py", line 50, in parse_xml
    elementtree = fromstring(content, parser=parser, base_url=base_url)
  File "src/lxml/etree.pyx", line 3237, in lxml.etree.fromstring
  File "src/lxml/parser.pxi", line 1896, in lxml.etree._parseMemoryDocument
  File "src/lxml/parser.pxi", line 1784, in lxml.etree._parseDoc
  File "src/lxml/parser.pxi", line 1141, in lxml.etree._BaseParser._parseDoc
  File "src/lxml/parser.pxi", line 615, in lxml.etree._ParserContext._handleParseResultDoc
  File "src/lxml/parser.pxi", line 725, in lxml.etree._handleParseResult
  File "src/lxml/parser.pxi", line 654, in lxml.etree._raiseParseError
  File "http:// myserver/api/soap/RepositoryService?wsdl", line 19
lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: meta line 7 and head, line 19, column 8

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user/Coding/Python/practical-project/main.py", line 2, in <module>
    connections = rapidminer.Connections("test", server=rapidminer.Server("http ://myserver",
  File "/Users/user/Coding/Python/practical-project/venv/PycharmProjects/lib/python3.8/site-packages/rapidminer/core/server.py", line 173, in __init__
    self.__test_and_install()
  File "/Users/user/Coding/Python/practical-project/venv/PycharmProjects/lib/python3.8/site-packages/rapidminer/core/server.py", line 470, in __test_and_install
    shared_folder_exists = self.__is_folder(self.__SHARED_PROCESS_FOLDER)
  File "/Users/user/Coding/Python/practical-project/venv/PycharmProjects/lib/python3.8/site-packages/rapidminer/core/server.py", line 608, in __is_folder
    client = self.__get_soap_client()
  File "/Users/user/Coding/Python/practical-project/venv/PycharmProjects/lib/python3.8/site-packages/rapidminer/core/server.py", line 623, in __get_soap_client
    client = zeep.Client(self.server_url + "/api/soap/RepositoryService?wsdl", transport=zeep.transports.Transport(session=session))
  File "/Users/user/Coding/Python/practical-project/venv/PycharmProjects/lib/python3.8/site-packages/zeep/client.py", line 73, in __init__
    self.wsdl = Document(wsdl, self.transport, settings=self.settings)
  File "/Users/user/Coding/Python/practical-project/venv/PycharmProjects/lib/python3.8/site-packages/zeep/wsdl/wsdl.py", line 92, in __init__
    self.load(location)
  File "/Users/user/Coding/Python/practical-project/venv/PycharmProjects/lib/python3.8/site-packages/zeep/wsdl/wsdl.py", line 95, in load
    document = self._get_xml_document(location)
  File "/Users/user/Coding/Python/practical-project/venv/PycharmProjects/lib/python3.8/site-packages/zeep/wsdl/wsdl.py", line 155, in _get_xml_document
    return load_external(
  File "/Users/user/Coding/Python/practical-project/venv/PycharmProjects/lib/python3.8/site-packages/zeep/loader.py", line 88, in load_external
    return parse_xml(content, transport, base_url, settings=settings)
  File "/Users/user/Coding/Python/practical-project/venv/PycharmProjects/lib/python3.8/site-packages/zeep/loader.py", line 66, in parse_xml
    raise XMLSyntaxError(
zeep.exceptions.XMLSyntaxError: Invalid XML content received (Opening and ending tag mismatch: meta line 7 and head, line 19, column 8)

Best Answer

  • phellinger
    phellinger New Altair Community Member
    edited November 2021 Answer ✓
    Hi @methusi,

    Thank you for your patience.

    Apologies for the misleading error message. We'll improve it.

    The true cause is most likely that Basic authentication is disabled. You can enable it in the .env file by changing the property below to true:
    LEGACY_REST_BASIC_AUTH_ENABLED=true
    You'll need to restart the stack with docker-compose.

    Let me know if this helps.
    Best,
    Peter


Answers

  • phellinger
    phellinger New Altair Community Member
    Hey @methusi,

    Thanks for the report, we are looking into this.

    A quick question: have you noticed the whitespace in "http:// myserver"?

    Best,
    Peter
  • methusi
    methusi New Altair Community Member
    edited November 2021
    Hi @phellinger

    Thanks a lot for looking into it.

    I am aware of that whitespace. I removed the IP and had to enter such a whitespace to be able to post the question.

    Best,
    Mathis
  • phellinger
    phellinger New Altair Community Member
    edited November 2021 Answer ✓
    Hi @methusi,

    Thank you for your patience.

    Apologies for the misleading error message. We'll improve it.

    The true cause is most likely that Basic authentication is disabled. You can enable it in the .env file by changing the property below to true:
    LEGACY_REST_BASIC_AUTH_ENABLED=true
    You'll need to restart the stack with docker-compose.

    Let me know if this helps.
    Best,
    Peter


  • methusi
    methusi New Altair Community Member
    Hi @phelliger

    That was it. I could it get running. Thanks a lot!