美文网首页
04apache-CXF的使用

04apache-CXF的使用

作者: Explorer_Mi | 来源:发表于2017-10-15 15:54 被阅读0次

apache.org
Ant 项目构建工具,现在使用Maven
这是一个WebService的框架.

配置文件的解释
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>cxf_service</display-name>
  
  <!-- 配置cxf框架提供的Servlet -->
  <servlet>
    <servlet-name>cxf</servlet-name>
    <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<!--通过初始化参数指定CXF框架的配置文件的位置-->
    <init-param>
        <param-name>config-location</param-name>
        <param-value>classpath:cxf.xml</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>cxf</servlet-name>
    <url-pattern>/service/*</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>

XMF服务端
原先没有接口,现在我们有接口,所以需要在接口上添加 @WebService注解

package cn.text.cxf;

import javax.jws.WebService;

@WebService
public interface HelloCXF {
    public String sayHello(String name);
}

package cn.text.cxf.impl;

import javax.jws.WebService;

import cn.text.cxf.HelloCXF;
public class HelloCXFImpl implements HelloCXF {

    @Override
    public String sayHello(String name) {
        System.out.println("基于CXF开发的服务器sayHello方法已经被调用");
        return "hello" + name;
    }

}


http://ip:port/projectName/service/address?wsdl

http://192.168.0.109:8080/cxf_service/service/cxfService?wsdl

相关文章

  • 04apache-CXF的使用

    apache.orgAnt 项目构建工具,现在使用Maven这是一个WebService的框架. XMF服务端原先...

  • iconfont的使用(下载使用)

    1、下载文件 2、在生命周期中引入项目 beforeCreate () { var domModule = ...

  • Gson的使用--使用注解

    Gson为了简化序列化和反序列化的过程,提供了很多注解,这些注解大致分为三类,我们一一的介绍一下。 自定义字段的名...

  • 记录使用iframe的使用

    默认记录一下----可以说 这是我第一次使用iframe 之前都没有使用过; 使用方式: 自己开发就用了这几个属...

  • with的使用

    下面例子可以具体说明with如何工作: 运行代码,输出如下

  • this的使用

    什么是this? this是一个关键字,这个关键字总是返回一个对象;简单说,就是返回属性或方法“当前”所在的对象。...

  • this的使用

    JS中this调用有几种情况 一:纯粹的函数调用 这是函数的最通常用法,属于全局性调用,因此this就代表全局对象...

  • ==的使用

    积累日常遇到的编码规范,良好的编码习惯,持续更新。。。 日常使用==用于判断的时候,习惯性将比较值写前面,变量写后...

  • this的使用

    1.默认绑定,就是函数立即执行。 函数立即执行就是指向window,但是如果是node环境,就是指向全局conso...

  • %in% 的使用

    写在前面:From 生信技能书向量难点之一:%in% 难点 (1)== 与 %in% 的区别== 强调位置,x和对...

网友评论

      本文标题:04apache-CXF的使用

      本文链接:https://www.haomeiwen.com/subject/awbquxtx.html