Xmlrpc connection refused

Hello all,

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(“start=rpc_factory("xmlrpc", "")”);
writer.appendLine(“var1= True”);
writer.appendLine(“var2 = start.GetBooleanAndReplyInteger(var1)”);

(from: Xml-rpc documentation inconsistency?)

And in python i used the following code:
import xmlrpclib
proxy = xmlrpclib.ServerProxy(“”)
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!

Regards, Zoë

Hi, the two issues:

  1. 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.
  2. 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

def GetBooleanAndReplyInteger(var1):
something …

server = SimpleXMLRPCServer((hostname,portname),allow_none=True)

Hope this answer is still useful to you.