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();
    }
    }
    }

  • 相关阅读:
    stat 命令家族(2)- 详解 pidstat
    stat 命令家族(1)- 详解 vmstat
    Linux常用命令
    Linux常用命令
    Linux常用命令
    Linux常用命令
    Linux常用命令
    Linux常用命令
    打通MySQL架构和业务的任督二脉
    PostgreSQL JOIN LATERAL
  • 原文地址:https://www.cnblogs.com/tancp/p/3651410.html
Copyright © 2011-2022 走看看