我已经在Python中有一个非常简单的线程XML-RPC服务器:
from SocketServer import ThreadingMixIn
class AsyncXMLRPCServer(ThreadingMixIn, SimpleXMLRPCServer):
pass
server = AsyncXMLRPCServer(('localhost', 9999))
server.register_instance(some_object())
server.serve_forever()
Run Code Online (Sandbox Code Playgroud)
现在我想通过https专门访问它.我该怎么办?
我正在尝试与supervisorxmlrpc 交谈.基于supervisorctl(尤其是这一行),我有以下内容,它似乎应该工作,并且确实它可以工作,只要它足够连接以从服务器接收错误:
#socketpath is the full path to the socket, which exists
# None and None are the default username and password in the supervisorctl options
In [12]: proxy = xmlrpclib.ServerProxy('http://127.0.0.1', transport=supervisor.xmlrpc.SupervisorTransport(None, None, serverurl='unix://'+socketpath))
In [13]: proxy.supervisor.getState()
Run Code Online (Sandbox Code Playgroud)
导致此错误:
---------------------------------------------------------------------------
ProtocolError Traceback (most recent call last)
/home/marcintustin/webapps/django/oneclickcosvirt/oneclickcos/<ipython-input-13-646258924bc2> in <module>()
----> 1 proxy.supervisor.getState()
/usr/local/lib/python2.7/xmlrpclib.pyc in __call__(self, *args)
1222 return _Method(self.__send, "%s.%s" % (self.__name, name))
1223 def __call__(self, *args):
-> 1224 return self.__send(self.__name, args)
1225
1226 ## …Run Code Online (Sandbox Code Playgroud) 我正在编写一个java程序,我希望使用xmlrpc模拟与远程过程调用的客户端 - 服务器关系.
但是,当我尝试远程调用该方法时,我收到此错误消息:
'JavaClient:XML-RPC Consumer Fault#java.lang.ClassCastException:java.lang.String无法强制转换为java.lang.Integer'
这是产生错误的客户端方法:
public String getHashsize() {
// Execute the remote call, using the handler
try
{
argHashsize = new Vector(); //see next method for comments
argHashsize.addElement(serverURL);
// make the call
String callit = ("GetSize.sendHashSize");
sizeHash = (Integer)client.execute(callit, argHashsize );
}
// Use XmlRpcException errors
catch (XmlRpcException exception) {
System.err.println("JavaClient: XML-RPC Consumer Fault #" +
Integer.toString(exception.code) + ": " +
exception.getCause() + "" + exception.toString());
} catch (Exception exception) {
System.err.println("JavaClient: XML-RPC Consumer Fault #" …Run Code Online (Sandbox Code Playgroud) 我正在使用XMLRPC客户端来调用Adestra API服务.目前我在插入波斯尼亚语字母č,ć,ž,đ,š时遇到问题.
我将我的XMLRPC客户端配置为使用UTF-8,但仍然存在问题.这是我的代码示例:
//******* LOGIN DATA*******/
$account = 'account';
$username = 'username';
$password = 'password';
$adestraCoreTable=1;
/**INITIALIZE API*****/
require_once('xmlrpc.inc');//First inlcude XMLRPC client library
//Calling Adestra API with our credentials
$xmlrpc= new xmlrpc_client("http://$account.$username:$password@new.adestra.com/api/xmlrpc");
$xmlrpc->setDebug(0);
$xmlrpc->request_charset_encoding="UTF-8";
$msg = new xmlrpcmsg(
"contact.search",
array(
//Set user id
new xmlrpcval($adestraCoreTable, "int"),
new xmlrpcval(
array(
"firstName"=> new xmlrpcval("?okolada", "string"),
),"struct"
)
)
);
$response = $xmlrpc->send($msg);//Send request, and get the response
Run Code Online (Sandbox Code Playgroud)
剩下的代码是解析$ response,这不是我们的主要兴趣.
如你所见,firstName设置为?okolada,但当我在Adestra中检查时,我得到了值Äokolada.显然,编码存在问题.
有人可以帮忙吗?
如何使用 xmlrpc 将交货订单设置为“完成”?
我在用着
$client->write('stock.move', array(58), ['state' => "done"]);
Run Code Online (Sandbox Code Playgroud)
它确实有效,但不会更新现有数量,只有预测数量会更新。
有没有办法从 PHP 调用exec_workflow?