java通过soap进行socket长连接

昵称都存在了吗? 2009-12-28 04:30:16
在开发一套系统的java API的时候
要用socket的长连接通过wsdl和认证服务器进行交互
用axis2反转成java文件
服务器支持长连接
写一个java类调用wsdl中的接口
如下代码:
public class Ikey{
//wsdl翻转后的一个接口名字
private static UserService service;

public static int ikeyAuth(String strNum, String strPwd)
throws java.lang.Exception {
try{
TtokenAuthReq Req = (TtokenAuthReq) getTestObject(TtokenAuthReq.class);

// 串号
Req.setMsAuthName(strNum);
// 密码
Req.setMsAuthPasswd(strPwd);
// 空字段
Req.setMsReserve1("");
// 空字段
Req.setMsReserve2("");
Req.setUi32LocalSid(0);
Req.setUi32ResId(0);

UserAuthServiceStub.TtokenAuthRes Res = service.tokenAuth(Req);

System.out.println("*******************************");
System.out.println("此为 认证 返回结果");
System.out.println(Res.getI32Ret());
System.out.println(Res.getSzRet());
System.out.println("*******************************");
}catch(Exception e){
System.out.println(e.getMessage());
}
return 0;
}
public static void setendpoint(String endpoint) throws java.lang.Exception {

Ikey ikey = new Ikey();
ikey.logger.setLevel(Level.WARN);
ikey.allowAccess = false;
service = new UserService (endpoint);

}

public static org.apache.axis2.databinding.ADBBean getTestObject(
java.lang.Class type) throws java.lang.Exception {
return (org.apache.axis2.databinding.ADBBean) type.newInstance();
}

}

在main()中
{
Ikey ikey = new Ikey();
ikey.setendpoint("http://认证服务器的ip:端口号");
ikey.ikeyAuth("串号","密码");

}
是可以验证成功的

如何把上面的代码修改成支持长连接和短连接呢?
希望各位大侠帮小弟一把
小弟感激不尽
...全文
2501 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
没人会做吗?
跪求高手
  • 打赏
  • 举报
回复

UserAuthServiceStub.TtokenAuthRes Res = service.tokenAuth(Req);
这句代码就是和服务器进行交互的
正确的写法是UserService.TtokenAuthRes Res = service.tokenAuth(Req);
各位大侠,帮忙啊

51,411

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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