急!!!!!!!!RPCServiceClient-调用webservice客户端。。。。

无情天下 2012-12-18 07:49:16
import javax.xml.namespace.QName;

import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;



public void callRemoteFun(){
RPCServiceClient client = null;
try {
client = new RPCServiceClient();
Options options = client.getOptions();
// 创建一个远程的访问地址
EndpointReference target = new EndpointReference("http://...");
options.setTo(target);
} catch (AxisFault e) {
e.printStackTrace();
}
Object[] objargs = new Object[] {"001","1.00","3","123456","5"};
Class[] getobj = new Class[] { String.class };
Object[] response = client.invokeBlocking(new QName("{SERVICE_NAMESPACE}", "{serviceName}"),
objargs,getobj);
String result = (String) response[0];
}

在我的webServers端的方法:
public String test1(String[] str){
System.out.println("调用成功1");
}

public String test2(String id,String name){
System.out.println("调用成功2");
}

为什么我test2的方法调用不到,我老是调用不了,是不是RPC核心就是只能传递一个object[]?还是只能调用一个带参数的方法?
...全文
299 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
s478853630 2013-01-04
  • 打赏
  • 举报
回复
client = new RPCServiceClient();
			Options option = client.getOptions();
			EndpointReference erf = new EndpointReference(serviceUrl);
			option.setTo(erf);
			QName name = new QName(nameSpace, method);
			Class[] returnTypes = new Class[] { Boolean.class };
			Object[] response = client.invokeBlocking(name, args, returnTypes);
			result = (Boolean) response[0];

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧