I am trying to understand how to communicate a startsign from a urcap to a welding machine through xml rpc and modbus. It is a hard subject for me because i only learned some front-end coding.
So i started with this in generatescript:
writer.appendLine(“var2 = start.GetBooleanAndReplyInteger(var1)”);
(from: Xml-rpc documentation inconsistency?)
And in python i used the following code:
proxy = xmlrpclib.ServerProxy(“http://192.168.109.41:5000/”)
hello = proxy.start()
If I run the program and the python script I get this message:
I think it says two things:
- connection refused (I think that is because i didn’t implemented the python script into the urcap (i dont know how to do that yet and i thought it would work on a other device too)
- var2 = start.getBooleanAndReplyInteger(var1) is not correct.
Can anybody tell me what I am doing wrong and give me some advice how to fix this?
Thank you in advance!
Hi, the two issues:
- connection refused because your server is not in a endless loop, it exit after “print(hello)”, and that’s why your UR program report an connection error.
- you need to register a function before use it, which you didn’t do.
to make things work with current ur program, try rewrite python code as:
from xmlrpc.server import SimpleXMLRPCServer
server = SimpleXMLRPCServer((hostname,portname),allow_none=True)
Hope this answer is still useful to you.