加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

基于Axis 1.4 部署WebService 笔记(三)

发布时间:2020-12-17 01:19:43 所属栏目:安全 来源:网络整理
导读:上面2章我们WebService已经可以正常发布了。现在我们来写服务器端和客户端代码: 我们用Aixs生成java code里有个SyncNotifySPSoapBindingImpl类,这个就是写服务器端代码入口,如果你用wsdl不一样那应该是***Impl.java 这样规则的文件。 ? 贴出我的服务器端

上面2章我们WebService已经可以正常发布了。现在我们来写服务器端和客户端代码:

我们用Aixs生成java code里有个SyncNotifySPSoapBindingImpl类,这个就是写服务器端代码入口,如果你用wsdl不一样那应该是***Impl.java 这样规则的文件。

?

贴出我的服务器端代码:

public class SyncNotifySPSoapBindingImpl implements com.unicom.vac.bossagent.soap.SyncNotifySPService{


??? public com.unicom.vac.bossagent.soap.sync.rsp.OrderRelationUpdateNotifyResponse orderRelationUpdateNotify(com.unicom.vac.bossagent.soap.sync.req.OrderRelationUpdateNotifyRequest orderRelationUpdateNotifyRequest) throws java.rmi.RemoteException {


?????System.out.println("已调用");
??? ?OrderRelationUpdateNotifyResponse response=new OrderRelationUpdateNotifyResponse();
??? ?response.setRecordSequenceId("1");
??? ?response.setResultCode(1);
??? ?return response;


??? }

?

}

贴出我客户端代码:

public class WebServiceClient {

?

?private SyncNotifySPServiceServiceLocator locator=null;
?private SyncNotifySPServiceService serviceService=null;
?private OrderRelationUpdateNotifyResponse response=null;
?public com.unicom.vac.bossagent.soap.sync.rsp.OrderRelationUpdateNotifyResponse setRequest(){


??try{


??OrderRelationUpdateNotifyRequest orunr=new OrderRelationUpdateNotifyRequest();
??locator=new SyncNotifySPServiceServiceLocator();
??locator.setEndpointAddress("SyncNotifySP","http://localhost:8080/VacSyncService/services/SyncNotifySP");
??serviceService=locator;
??SyncNotifySPService ser=serviceService.getSyncNotifySP();
??orunr.setContent("1");
??orunr.setEffectiveDate("2");
??orunr.setEncodeStr("3");
??orunr.setExpireDate("4");
??orunr.setLinkId("5");
??orunr.setProductId("6");
??orunr.setRecordSequenceId("7");
??orunr.setServiceType("8");
??orunr.setSpId("9");
??orunr.setTime_stamp("10");
??orunr.setUpdateTime("11");
??orunr.setUpdateDesc("12");
??orunr.setUpdateType(13);
??orunr.setUserId("14");
??orunr.setUserIdType(15);
??response=ser.orderRelationUpdateNotify(orunr);
??if(response!=null){
???System.out.println(response.getRecordSequenceId());
??}else{
???System.out.println("response is null!");
??}
??

}catch(Exception ex){


???ex.printStackTrace();

??}
??return response;
??
?}
?/**
? * @param args
? */
?public static void main(String[] args) {
??// TODO Auto-generated method stub
??WebServiceClient wc=new WebServiceClient();
??wc.setRequest();
?}

}

?

?

WebService的学习就先介绍到这里。我测试客户端代码调用服务器端代码没有问题。这个例子只做学习之用。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读