简体   繁体   English

XMLRPC-Python服务器,PHP客户端。 没有一致性?

[英]XMLRPC - Python Server, PHP Client. No consistancy?

I'm currently trying to build a web-base management interface for a cluster of linux servers running a special service. 我目前正在尝试为运行特殊服务的linux服务器群集构建基于Web的管理界面。 The idea being that the management website can RPC the clusters to gather information, perform configuration tasks, etc. 这个想法是管理网站可以通过RPC集群来收集信息,执行配置任务等。

I've got an XMLRPC Python Server script up and running, and I've written a basic XMLRPC Client in PHP. 我已经启动并运行了XMLRPC Python Server脚本,并且已经用PHP编写了基本的XMLRPC Client。 It all works, but I'm having some serious issues trying to get consistent responses from method calls - Sometimes I get an XML array to n'th depth based on the verbosity of the output of the command I run, sometimes its a XML struct, and sometimes its just a plain old value. 一切正常,但是我在尝试从方法调用中获得一致的响应时遇到了一些严重的问题-有时我会根据我运行的命令输出的详细程度获得第n个深度的XML数组,有时是XML结构,有时它只是一个普通的旧值。 Then I've got errors to deal with - It seems the XMLRPC standard has a Fault struct with 'faultCode' and 'faultString' values it responds with, which is great because thats tidy and I can pull that data out via the named key in the XML. 然后我要处理错误-看来XMLRPC标准具有一个带有“ faultCode”和“ faultString”值的Fault结构,它可以响应,这很不错,因为那很整洁,我可以通过命名键将数据拉出XML。 But you only get that struct if error is from the shell itself (For example if the called command had a bad argument), whereas an error coming from the command has to be just a normal XML response. 但是,只有在错误来自外壳程序本身的情况下(例如,如果被调用的命令具有错误的参数),您才可以得到该结构,而来自命令的错误必须只是正常的XML响应。

How can I possibly write a robust web-service around what appears to be such varied replies from the XMLRPC server? 我如何围绕XMLRPC服务器发出的如此多的答复编写健壮的Web服务? What I'd really like to do is have the exact same XML struct reply back every time with the same Keys (returnCode (0=success, >1=error), returnValue/s). 我真正想做的是每次使用相同的键(returnCode(0 =成功,> 1 = error),returnValue / s)获得完全相同的XML结构回复。

Thanks for any advice. 感谢您的任何建议。

Maybe start with an existing XML/RPC client and let the client do the protocol legwork. 也许从现有的XML / RPC客户端开始,然后让客户端完成协议工作。 There is Zend\\XmlRpc in Zend Framework but also standalone clients like fxmlrpc . Zend Framework中有Zend\\XmlRpc ,但也有独立客户端,例如fxmlrpc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM