zoukankan      html  css  js  c++  java
  • Java 基于web service 暴露接口 供外部调用

    package cn.zr.out.outinterface;
    
    import java.text.SimpleDateFormat;
    import java.util.Date;
    
    import javax.jws.WebService;
    import javax.xml.ws.Endpoint;
    
    
    
    
    @WebService(name="webSer",serviceName="userWebService",targetNamespace="outws")
    public class OutInterface {
    
        public static void main(String[] args) {
            Endpoint.publish("http://localhost:9865/", new OutInterface());
            System.out.println("=== 程序正在运行 ===");
        }
        
        public String outService(String info) {
            String msg = "暴露接口"+info;
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
            String currentTime = format.format(new Date());
            System.out.println(msg+",调用时间:"+currentTime);
            return msg;
        }
    }

    然后在浏览器上输入http://localhost:9865/webSer?wsdl,会出现如下信息:

  • 相关阅读:
    ryzen nvidia hackintosh
    mysql count 主键之坑
    git命令
    MYSQL 注释
    yaf twig配置
    1.YAF 的安装
    yaf nginx 设置
    ubuntu 16 阿里云 vsftpd
    win10下 homestead 安装
    活动调度
  • 原文地址:https://www.cnblogs.com/lantu1989/p/6427370.html
Copyright © 2011-2022 走看看