I am attempting to use xml-rpc in python. I have been trying to set the headers correct for the client id. I see all kinds of examples for Soap but not for xml-rpc.
I have not even found any examples for PHP on how to use the PHP generated by RO.
I see how the PHP includes generated by RO is actually using xml-rpc.
I have the PHP interface and can see how it works however I have the same issue.
Not being able to send the proper client id with the request for RO sever to read and authenticate.
In the following code the Sum function requires me to pass the client id returned from the login service with the request to use it.
I cannot get the header right for the RO server to read it and say I am authenticated.
Here is my python code…
import xmlrpclib
from pprint import pprint
logininfo = []
sessionID = ‘’
from xmlrpclib import ServerProxy, Transport, Error
class SpecialTransport(Transport):
…def send_content(self, connection, request_body):
…global sessionID
…print ‘sess in transport=’+sessionID
…connection.putheader(“ROClientIDHeader”, sessionID)
…connection.putheader(“ROClientIDHeader”, ‘ID=’+sessionID)
…connection.putheader(“ROClientIDHeader:ID”, sessionID)
…connection.putheader(“ID”, sessionID)
…connection.putheader(“ID”, ‘ID=’+sessionID)
…connection.putheader(“Content-Type”, “text/xml”)
…connection.putheader(“Content-Length”, str(len(request_body)))
…connection.endheaders()
…if request_body:
…connection.send(request_body)
server = ServerProxy(“http://localhost:8099/xmlrpc/LoginService”, transport=SpecialTransport())
try:
…print server.LoginService.ServerLogin(‘23dashes’, ‘23dashes’, logininfo)
…logininfo = server.LoginService.ServerLogin(‘23dashes’, ‘23dashes’, logininfo)
…loginresult = logininfo[0]
…logininfodict = logininfo[1]
…if loginresult == True:
…print ‘login successfull’
…else:
…print ‘login failed’
…sessionID = logininfodict.get(‘SessionID’)
…print ‘sess=’+sessionID
…print server.CoreService.Sum(1,1)
except Error, v:
…print “ERROR”, v
I would love to see either PHP or Python code on how to call a function after being authenticated by a login service.
How am I to send the client id back to RO in the RPC call?