zoukankan      html  css  js  c++  java
  • webService学习记录

    服务端配置
    1、新建web项目,导入xFire的jar包
    2、创建服务接口、实现类
    3、创建src->META-INF->service->service.xml
    将实现类、接口配置到里面
    配置接口namespace
    4、在web.xml中配置servlet、servlet-mapping(xFire)
    5、部署项目,通过浏览器访问 localhost:8080/[testXfire]/[service]

    客户端
    1、新建web项目,将服务端代码打成jar包导入项目
    同时导入xFire的包
    2、见链接类
    package com.gdie.xfire.test;
    import org.codehaus.xfire.service.Service;
    import org.codehaus.xfire.service.binding.ObjectServiceFactory;
    import org.codehaus.xfire.client.XFireProxyFactory;
    import com.gdie.xfire.example.ITestService;
    public class MyClient {
    public static void main(String[] args) {
    try{
    Service serviceModel = new ObjectServiceFactory().create(
    ITestService.class,"TestService","http://com/gdie/xfire/example/ITestService",null);
    ITestService service = (ITestService) new XFireProxyFactory().create(
    serviceModel,"http://localhost:8080/TestXFile/services/TestService");
    System.out.println("返回值是:"+service.add(5, 8));
    }catch (Exception e) {
    // TODO: handle exception
    e.printStackTrace();
    }
    }
    }

  • 相关阅读:
    P2515 [HAOI2010]软件安装
    P2502 [HAOI2006]旅行 最小生成树
    Luogu P2511 [HAOI2008]木棍分割 二分+DP
    P2303 [SDOI2012]Longge的问题 我傻QwQ
    P1129 [ZJOI2007]矩阵游戏 二分图匹配
    BZOJ3211花神游历各国
    [HNOI2011]XOR和路径
    NOIP考前划水
    [IOI2018]组合动作
    [NOIP2017]逛公园
  • 原文地址:https://www.cnblogs.com/tancp/p/3651410.html
Copyright © 2011-2022 走看看