https

http://hc.apache.org/httpclient-3.x/sslguide.html

System.setProperty("java.protocol.handler.pkgs",
"com.sun.net.ssl.internal.www.protocol");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

http://ws.apache.org/axis2/1_3/http-transport.html


package briup;

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 class WsClient {

private RPCServiceClient serviceClient;
private Options options;
private EndpointReference targetEPR;

public WsClient(String endpoint) throws AxisFault {
serviceClient = new RPCServiceClient();
options = serviceClient.getOptions();
targetEPR = new EndpointReference(endpoint);
options.setTo(targetEPR);
}
public Object[] invokeOp(String targetNamespace, String opName,
Object[] opArgs, Class<?>[] opReturnType) throws AxisFault,
ClassNotFoundException {
// 设定操作的名称
QName opQName = new QName(targetNamespace, opName);
// 设定返回值

//Class<?>[] opReturn = new Class[] { opReturnType };

// 操作需要传入的参数已经在参数中给定,这里直接传入方法中调用
return serviceClient.invokeBlocking(opQName, opArgs, opReturnType);
}
/**
* @param args
* @throws AxisFault
* @throws ClassNotFoundException
*/
public static void main(String[] args) throws AxisFault, ClassNotFoundException {
// TODO Auto-generated method stub
final String endPointReference = "http://localhost:8080/axis2/services/ws";
final String targetNamespace = "http://briup";
WsClient client = new WsClient(endPointReference);

String opName = "sayHello";
Object[] opArgs = new Object[]{"Repace中心"};
Class<?>[] opReturnType = new Class[]{String[].class};

Object[] response = client.invokeOp(targetNamespace, opName, opArgs, opReturnType);
System.out.println(((String[])response[0])[0]);
}

}



http://hideto.iteye.com/blog/56835
http://worldllg.iteye.com/blog/455271
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值