public class TestKingdee {
public static void main(String[] args) throws Exception {
try {
AxisProperties.setProperty("axis.socketSecureFactory", "org.apache.axis.components.net.SunFakeTrustSocketFactory");
//调用登陆接口
Service s=new Service();
Call call=(Call)s.createCall();
call.setOperationName("login");
call.setTargetEndpointAddress("https://localhost:56898/ormrpc/services/EASLogin?wsdl");
call.setReturnType(new QName("urn:client","WSContext"));
call.setReturnClass(WSContext.class);
call.setReturnQName(new QName("","loginReturn"));
//超时
call.setTimeout(Integer.valueOf(1000*600000*60));
call.setMaintainSession(true);
//登陆接口参数
WSContext rs=(WSContext)call.invoke(new Object[]{"user", "kduser", "eas", "test", "l2", 0});
if(rs. getSessionId() == null){
throw new Exception("login fail");
}
System.out.println(rs.getSessionId());
//清理
call.clearOperation();
} catch (ServiceException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
本文展示了如何使用Java的Axis库调用HTTPS Webservice接口进行登录操作。通过设置AxisProperties、创建Service、定义Call对象并设置相关参数,如操作名、目标地址、超时时间等,最终调用login接口并处理返回结果。
1361

被折叠的 条评论
为什么被折叠?



