BUG: Failure to connect to server
Describe the bug
The connectToServer function within initModel.py fails with the following message in terminal:
File "c:\Users\bsteinhagen\Documents\GitHub\tcc-toolbox\tcc_toolbox\analysis\rfem.py", line 30, in __init__
Model(True, model_name, True, True)
File "C:\Users\bsteinhagen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\RFEM\initModel.py", line 123, in __init__
connectToServer()
File "C:\Users\bsteinhagen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\RFEM\initModel.py", line 49, in connectToServer
new_wsdl = request.urlopen(urlAndPort+'/wsdl')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 216, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 525, in open
response = meth(req, response)
^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 634, in http_response
response = self.parent.error(
^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 563, in error
return self._call_chain(*args)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 496, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 643, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
Desktop (please complete the following information):
- Version of WIN10 OS: [WIN 10 20H2]
- Version of RFEM6.05.0008
- Version of Python Client 1.20.0
Additional context Working on other machines just not mine. RFEM6 has been uninstalled and reinstalled, Python Client has been uninstalled and reinstalled. Older version of Python client yielded following error:
Connecting to server...
Error: Connection to server failed!
Please check:
- If you have started RFEM application
- If all RFEM dialogs are closed
- If server port range is set correctly
- If you have a valid Web Services license
- Check Program Options & Settings > Web Services
On remote PC please check:
- If the firewall enables you to listen to selected port.
Hi @bjoernsteinhagen, from the description I can only deduct that URL or port is not correct. But it is odd that it works on other computers. Seems to be a local issue.
Hey, I am having similar issues.
Desktop
Windows: Windows 11 Pro (Version: 23H2) RFEM: 6.05.0003 Python-Client: 1.19.5
Further Digging
I run the following code on port 8081.
from suds.client import Client
client = Client("http://localhost:8081/wsdl")
print(client.service.get_active_model())
It gave me http://127.0.0.1:8082/.
Passing this or http://localhost:8082/wsdl as argument to Client in the code above, leads to: suds.MethodNotFound: Method not found: 'RfemModel.RfemModelPort.get_active_model'
Passing http://localhost:8081/wsdl and http://localhost:8082/wsdl to my browser shows a XML-file.
Questions / Ideas I had to solve the problem
- Does RFEM provide the Webservice to another port in case the first port (8081) in the given range is occupied?
- Restarting RFEM does not fix the problem.
- Restarting my computer fixed the problem, when this error occured earlier (not very user-friendly ;))
Possible Solution / Quick Fix
Closing RFEM and killing the process that runs my localhost as described here
During writing this comment I came to this idea. This allowed me to use the API after restarting RFEM.
Currently this works. For me this is not the most elegant solution.
Hope this helps other users and leads to a possible solution where no such quick-fixes are needed.
Kind regards
Hey @JohannesSchorr,
I guess your issue was related to ports selection and their associated methods. Port 8081 is for the Application methods and port 8082 is for the Model methods which you may find in wiki of this repo. So, in your case you were getting active model with port 8081 which generally throws port 8082 and when rerunning code by changing port 8082 which is for model methods and in 8082, there is no such method like get_active_model() which is the cause of the error.
I hope this clarifies your issue.
Hey @heetrojivadiya,
thanks for investing your time.
For clarification
- I had the same issue as @bjoernsteinhagen. To find the root of the issue I tried to run the above mentioned code and obviously run in the problem you described without knowing that. I tried to show what is not working.
Further Questions
- What do you think about the described Quick Fix?
- Does RFEM check if other programs are using Port 8081?
- If so, is RFEM changing the port?
- Does the RFEM-python module takes this 'port-change' into account?
Thanks again for the clarification. Allways happy to learn something new.
Kind regards