package com.yuanxin.paas.ssb;
public interface TestService {
/**
* 测试:无参,无返回值。
*/
void test();
/**
* 测试:原生类型参数与返回值。
*
* @param i
* @return
*/
String test0(int i);
/**
* 测试:无参,自定义类型返回值。
*
* @return
*/
Result test1();
/**
* 测试:自定义类型参数,无返回值。
*
* @param arg
*/
void test2(Arg arg);
/**
* 测试:自定义参数,自定义返回值。
*
* @param arg
* @return
*/
Result test3(final Arg arg);
}
package com.yuanxin.paas.ssb;
import java.io.Serializable;
public class Arg implements Serializable {
private int i;
public int getI() {
return i;
}
public void setI(int i) {
this.i = i;
}
}
package com.yuanxin.paas.ssb;
import java.io.Serializable;
public class Result implements Serializable {
private int i;
private String string;
public int getI() {
return i;
}
public void setI(int i) {
this.i = i;
}
public String getString() {
return string;
}
public void setString(String string) {
this.string = string;
}
}
npm install hessian-proxy
var Proxy = require('hessian-proxy').Proxy;
var proxy = new Proxy('http://127.0.0.1:9098/test-provider/provider/com.yuanxin.paas.ssb.TestService', '', '', proxy);
proxy.invoke('test', null, function (err, reply) {
console.log('test: ' + reply);
});
proxy.invoke('test0', [25], function (err, reply) {
console.log('test0: ' + JSON.stringify(reply));
})
proxy.invoke('test1', null, function (err, reply) {
if (err) {
console.log('test1: ' + err);
}
console.log('test1: ' + JSON.stringify(reply));
})
var argForTest2 = {
i: 2
};
argForTest2.__type__ = 'com.yuanxin.paas.ssb.Arg';
proxy.invoke('test2', [argForTest2], function (err, reply) {
if (err) {
console.log('test2: ' + err);
}
console.log('test2: ' + JSON.stringify(reply));
})
var argForTest3 = {
i: 3
};
argForTest3.__type__ = 'com.yuanxin.paas.ssb.Arg';
proxy.invoke('test3', [argForTest3], function (err, reply) {
if (err) {
console.log('test3: ' + err);
}
console.log('test3: ' + JSON.stringify(reply));
})
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有