接口开发个人总结

来源:互联网 发布:微信链接网络出错1003 编辑:程序博客网 时间:2024/05/17 06:09
接口调用过程:
1. wsdl地址放在浏览器里面看是否正确  
2.将wsdl地址放在soapui里面 看是否需要安全性校验 (需要时输账号,输密码,勾选password_test)
3.建一个project 
4.将pom.xml文件复制进去
5.右击pom.xml选run as-->maven install
6.生成的client 里面可以找到 对方name url  存放name和url的方法  port
7.新建项目  导好pom.xml包文件  新建包
8.建一个service   private  map<键 值>  名称(类型 参数)
9.建一个serviceimpl
9.将对方的name  url···放在一个方法里面,实现service  
10.调用传对方name···等的那个方法
11.映射mapper里面的参数  写mapper.xml
12.新建一个 OtmCargoData  o=new ObjectFactory().createOtmCargoData();
13.  o.setCargoAddress(orderOut.getCargoAddress());将自己的值放在对方里面
14. ResMessage  result=port.cargoOperate(o);
    String  info=result.getErrInfo();
System.out.println(info);
String  errorcode=result.getErrorCode();
System.out.println(errorcode);
15.跟对方要结果编码和对应的描述
Map<String, String>   map=new HashMap<String, String>();
if(errorcode.equals("xxxx")){
map.put("code", "S");
map.put("message", info);
}else{
map.put("code", "E");
map.put("message", info);
}

16.在controller里面写一些测试  看结果正确与否


接口开发过程:
1.找web.xml里面的CXFService对应的url
2.在applicationContext-ws.xml里面  每写一个service,在里面对应写一个address
3.在对应的位置写service 
service 前写注解
@Service
@Transactional
0 0
原创粉丝点击