java  webservice应用总结
 step1:在工程中导入xfire-all.jar(这是xfire需要的class包)以及对方的class包
 step2: 在工程的src/META-INF下面新建文件夹xfire,在里面添加service.xml文件
 
其中内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">
  
    <service>
        <name>LetterFeedback</name>
        <serviceClass>com.megait.xzxk.webservice.IXzxkService</serviceClass>
        <implementationClass>com.cicro.project.shfgw.ws.service.impl.LetterFeedbackService</implementationClass>
        <style>wrapped</style>
        <use>literal</use>
        <scope>application</scope>
    </service>
</beans>
以上是配置service接口以及实现类
下面是Java代码:
public class LetterFeedbackService implements IXzxkService {

private static final Log log = LogFactory.getLog(LetterFeedbackService.class);

// 领导信箱: model_id = 1
    // pur_id与tbmail.type映射
    public static final Map<Integer, Integer> PURID2TYPE_MAPPING = new HashMap<Integer, Integer>();

static {
        PURID2TYPE_MAPPING.put(10, 347);
        PURID2TYPE_MAPPING.put(12, 352);
        PURID2TYPE_MAPPING.put(2, 375);
        PURID2TYPE_MAPPING.put(4, 0);
    }

@Override
    public List<StandardInfo> createObjList() throws AhDataException {
        if (log.isInfoEnabled()) {
            log.info("Letter Feedback Service Create start...");
        }

List<StandardInfo> list = new ArrayList<StandardInfo>();

List<XSqBean> sqList = XSqManager.extractSqList();

StandardInfo info = null;
        Tbmail tbmail = null;
        Integer tbmailType = null;

if (sqList != null && !sqList.isEmpty()) {
            for (SQBean sq : sqList) {
                if (log.isInfoEnabled()) {
                    log.info("sq_id: " + sq.getSq_id());
                }

tbmailType = PURID2TYPE_MAPPING.get(sq.getPur_id());

tbmail = new Tbmail();
                tbmail.setId(sq.getSq_id());
                tbmail.setName(sq.getSq_realname());
                tbmail.setMail(sq.getSq_email());
                tbmail.setAdr(sq.getSq_address());
                tbmail.setTel(sq.getSq_phone());
                tbmail.setFax("");
                tbmail.setOther("");
                tbmail.setType(tbmailType != null ? tbmailType.intValue() : 0);
                tbmail.setTitle(sq.getSq_title2());
                tbmail.setContent(sq.getSq_content2());
                tbmail.setHf("");
                tbmail.setHf1("");
                tbmail.setHfqk("");

try {
                    tbmail.setDatetime(DateUtil.getDate(sq.getSq_dtime()));
                } catch (ParseException e) {
                    if (log.isErrorEnabled()) {
                        log.error(e.toString());
                    }
                }

tbmail.setLb("");

info = new StandardInfo();
                info.setObjectInfo(encodeTbmail(tbmail));
                info.setTitle(tbmail.getTitle());
                info.setBusinesstype("上海发改委来信反馈");
                info.setDetail(tbmail.getContent());
                info.setBusinessresult("");

list.add(info);

XSqManager.updateSqExtracted(sq.getSq_id());
            }
        }

if (log.isInfoEnabled()) {
            log.info("Create StandardInfo Size: " + list.size());
            log.info("Letter Feedback Service Create End.");
        }

return list;
    }

然后把项目部署之后就会生成wsdl
http://www.shdrc.gov.cn/services/LetterFeedback?wsdl
这就可以看到我们生成的配置文件
然后在另一边可以直接调用我们wsdl中的方法就ok
具体的实现类如下:
public class Main {

public static void main(String[] args) throws Exception {
        Service serviceModel = new ObjectServiceFactory().create(IXzxkService.class);
        XFire xfire = XFireFactory.newInstance().getXFire();
        XFireProxyFactory factory = new XFireProxyFactory(xfire);
        // String serviceUrl =
        // "http://192.168.137.4:1104/services/LetterFeedback";
        //String serviceUrl = "http://www.shfgw.gov.cn/services/ConsProject";
        String serviceUrl = "http://www.shdrc.gov.cn/services/LetterFeedback";
        IXzxkService xzxkService = (IXzxkService) factory.create(serviceModel, serviceUrl);

/* StandardInfo info = new StandardInfo();

WebXmSjjh xmSjjh = new WebXmSjjh();
        xmSjjh.setXmbm("aaaaaaaa");
        xmSjjh.setXmmc("bbbbbb");
        xmSjjh.setXmfr("cccc");
        xmSjjh.setJsnr("dddd");
        xmSjjh.setJsgm("中国一哥");
        xmSjjh.setPfsj(new Date());
        xmSjjh.setSpwh("是不是");
        xmSjjh.setXmlb("项目建议书");
        xmSjjh.setSpwj("yyyyy");
        xmSjjh.setSqh("ab活期");
        xmSjjh.setXmlx("7");

info.setObjectInfo(encodeWebXmSjjh(xmSjjh));

List<StandardInfo> list = new ArrayList<StandardInfo>();
        list.add(info);
*/
       // xzxkService.deliverObjList(list);
        
        List<StandardInfo> list= xzxkService.createObjList();
        
        System.out.println(list.size());
    }

java webservice应用总结相关推荐

  1. Java WebService 接口的简单生成和调用

    Java WebService 接口的简单生成和调用 1.打开eclipse创建普通的java项目,写一个类  如下: package com.jspweb.ws;import javax.jws.W ...

  2. java webservice用户验证_使用java webservice的.net4.0 web app需要Usernametoken身份验证

    我是使用.net 4.0 VS2010的新手.我需要使用java web服务并发送usernametoken自定义身份验证来访问服务,这是我很容易在VS2005中使用WSE2.0,那么在net 4.0 ...

  3. Java webservice 将晦涩难懂的参数名修改为容易理解的名称

    Java webservice 接口方法默认的参数名让访问者摸不着头脑,如果需要修改参数名,需要在与接口类同包下建一个    接口类名.aegis.xml的文件 <?xml version=&q ...

  4. c#调用带有安全认证的java webservice

    最近使用c#调用另外一个同事写的java webservice耽误了很多时间,网上资料不太完整,走了很多弯路,希望对大家有帮助. 基本思路是 1.拼装soap使用http post ,主要将验证身份信 ...

  5. java webservice实例教程

    原文:java webservice实例教程 源代码下载地址:http://www.zuidaima.com/share/1590350954564608.htm 最近在学习web services, ...

  6. 孔浩老师 java 微信_孔浩老师JAVA WebService教程

    课程目录:01_webservice快速实例 02_wsimport的使用 03_wsdl和soap讲解(介入了tcpmon工具) 04_SOA的分析(纯属扯淡) 05_dtd讲解 06_schema ...

  7. java webservice 依赖_java开发webservice的几种方式

    webservice的应用已经越来越广泛了,下面介绍几种在Java体系中开发webservice的方式,相当于做个记录. 1.Axis2 Axis是apache下一个开源的webservice开发组件 ...

  8. 从零开始学习 webservice第一集,java webservice简单实例入门教程

    现在从零开始学习webservice 概念自己百度搜,总之,webservice就相当于一个接口,就像你走进了一家售货店,你不需要知道这家店怎么卖给你东西,你拿着钱去,说我要一包玉溪,人家就会给你返回 ...

  9. java webservice接口开发_搭建Soap webservice api接口测试案例系统

    Eclipse下创建WebService项目,主要目的是作为Postman.soapUI等工具进行soap webservice 接口测试的案例. 本文基于Axis2框架,在eclipse环境下搭建w ...

最新文章

  1. 商汤等提出:统一多目标跟踪框架
  2. 详解|清华大学100页PPT:工业机器人技术详解
  3. 【kernel 中内存分配那点事】
  4. alive workers 数量为0的解决方案
  5. 64位Ubuntu kylin 16.04下使用DNW下载uboot到tiny4412的EMMC
  6. 1839行政领导学 (2)
  7. Python 第三方模块之 NumPy - 科学计算
  8. python中的content方法_content最新:python计算Content-MD5并获取文件的Content-MD5值方式_爱安网 LoveAn.com...
  9. 通过HP Loadrunner VuGen来录制安卓的应用
  10. 猎洞高手轻松变身Gsuite 超级管理员接管他人的 Gsuite 账户
  11. Vue:使用vue-json-excel导出数据到excel
  12. 易语言解析html实例,易语言总使用正则表达式实例解析
  13. Python的优点和缺点
  14. Building dependency tree… Done Package aptitude is not available, but is referred to by another pac
  15. js字符串根据某个特殊字符截取字符串
  16. 费率与利率的差别_费率是什么(利率和费率有啥区别?)
  17. 熬夜整理,五万字长文总结 C/C++ 知识点
  18. win11怎样修改开机音乐 windows11修改开机音乐的步骤教程
  19. 人体的神经系统结构图,身体的神经系统图片
  20. 支持向量机SVM(二)

热门文章

  1. Android FTP功能开发基于swiftp
  2. layim之修改群聊头像
  3. python 中控考勤机实时接收打卡数据(QThread)
  4. proxy代理解决跨域问题
  5. 如何在数位板上练习线条跟线稿?
  6. C语言编程学习:使用函数必须知道的3点注意事项
  7. Java大用处——动态数组的实现
  8. (Python)异常处理try...except、raise
  9. MSYS 1.0.11 + MinGW安装方法
  10. linux 下dump文件放在那里,怎么查看dump文件目录