小弟是nodejs的菜鸟一枚,最近公司项目中用到nodejs,需要调用第三方的接口地址 在npm官网上查到要执行 npm install hessian-proxy
然后网站上给出例子:
var Proxy = require(‘hessian-proxy’).Proxy;
var proxy = new Proxy(‘http://example.com/test’, username, password, proxy);
proxy.invoke(methodName, [arg1, arg2, arg3…], function(err, reply) { // … do with reply });
// use writer2 var Writer = require(‘hessian-proxy’).Writer2; // for hessian2.0
var writer = new Writer(); writer.writeCall(method, [arg1, arg2…]);
var buffer = writer.getBuffer();
// use reader2 var Reader = require(‘hessian-proxy’).Reader2; // for hessian2.0
var reader = new Reader(); var data = reader.readRPCMessage(buffer).getData();
可是我还是不知道这个地方怎么实现 proxy.invoke(methodName, [arg1, arg2, arg3…], function(err, reply) { // … do with reply });
这里是要把对方接口上的方法再实现一次吗?
希望各位大虾能帮忙讲解一下啊