day63-webservice 04.JaxWsServerFactoryBean和SOAP1.2









<wsdl:definitions xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://server.cxf.rl.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloServiceService" targetNamespace="http://server.cxf.rl.com/">
<wsdl:types>
<xs:schema xmlns:tns="http://server.cxf.rl.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" targetNamespace="http://server.cxf.rl.com/" version="1.0">
<xs:element name="sayHello" type="tns:sayHello"/>
<xs:element name="sayHelloResponse" type="tns:sayHelloResponse"/>
<xs:complexType name="sayHello">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="sayHelloResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="sayHello">
<wsdl:part element="tns:sayHello" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="sayHelloResponse">
<wsdl:part element="tns:sayHelloResponse" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:portType name="HelloService">
<wsdl:operation name="sayHello">
<wsdl:input message="tns:sayHello" name="sayHello"></wsdl:input>
<wsdl:output message="tns:sayHelloResponse" name="sayHelloResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloServiceServiceSoapBinding" type="tns:HelloService">
<soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayHello">
<soap12:operation soapAction="" style="document"/>
<wsdl:input name="sayHello">
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output name="sayHelloResponse">
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="HelloServiceService">
<wsdl:port binding="tns:HelloServiceServiceSoapBinding" name="HelloServicePort">
<soap12:address location="http://127.0.0.1:5555/hello"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
http://www.cnblogs.com/yanzige/p/5377332.html



















package com.rl.cxf.client; import com.rl.soap11.HelloService;
import com.rl.soap11.HelloServiceService; public class Soap11Client {
public static void main(String[] args) {
HelloServiceService hss = new HelloServiceService();
HelloService hs = hss.getHelloServicePort();
String result = hs.sayHello("lisi");
System.out.println(result); }
}
package com.rl.cxf.client; import com.rl.cxf.server.HelloService;
import com.rl.cxf.server.HelloServiceService; public class Soap12Client {
public static void main(String[] args) {
HelloServiceService hss = new HelloServiceService();
HelloService hs = hss.getHelloServicePort();
String result = hs.sayHello("lisi");
System.out.println(result); }
}
package com.rl.cxf.server; import javax.jws.WebService;
import javax.xml.ws.BindingType; @WebService
//@BindingType(value=javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING )
@BindingType(value=javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING )
public class HelloService {
public String sayHello(String name){
return name + " hello";
}
}
package com.rl.cxf.server; //import org.apache.cxf.frontend.ServerFactoryBean;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; public class MyCXFServer {
public static void main(String[] args) {
//创建服务工厂对象
//ServerFactoryBean sfb = new ServerFactoryBean();
JaxWsServerFactoryBean sfb = new JaxWsServerFactoryBean();
//加入输入输出拦截器
sfb.getInInterceptors().add(new LoggingInInterceptor());
//sfb.getOutFaultInterceptors().add(new LoggingOutInterceptor());
sfb.getOutInterceptors().add(new LoggingOutInterceptor());
//指定服务地址
sfb.setAddress("http://127.0.0.1:5555/hello");
//设置服务类
sfb.setServiceClass(HelloService.class);
//设置服务类的实例对象
sfb.setServiceBean(new HelloService());
//发布服务
sfb.create();
System.out.println("server ready...");
}
}
day63-webservice 04.JaxWsServerFactoryBean和SOAP1.2的更多相关文章
- 使用CXF开发JAX-WS类型的WebService
使用CXF记得要先加入CXF的jar包 方法1: Cxf编程实现: l 使用jaxwsServerFactoryBean发布 webservice服务端. 需要设置: jaxwsServerFacto ...
- webservice的cxf和spring整合发布
1.新建一个web项目 2.导入cxf相应的jar包,并部署到项目中 3.服务接口 package com.xiaostudy; /** * @desc 服务器接口 * @author xiaostu ...
- webservice用cxf发布SOAP
cxf的安装,就是把文件解压,然后配置环境变量 http://cxf.apache.org/download.html这是官网下载 解压到这里 环境变量 wsdl2java命令测试 1.新建java项 ...
- Webservice与CXF框架快速入门
1. Webservice Webservice是一套远程调用技术规范 远程调用RPC, 实现了系统与系统进程间的远程通信.java领域有很多可实现远程通讯的技术,如:RMI(Socket + 序列化 ...
- WebService使用介绍(三)
jax-ws开发深入 JAX-WS注解 注解说明 WebService的注解都位于javax.jws包下: @WebService-定义服务,在public class上边 targetNamespa ...
- Java中的WebService服务
一.在本地发布一个webservice服务 1.使用jdk中的 javax.xml.ws.Endpoint 类的 static Endpointpublish(Stringaddress,Object ...
- Java发布webservice应用并发送SOAP请求调用
webservice框架有很多,比如axis.axis2.cxf.xFire等等,做服务端和做客户端都可行,个人感觉使用这些框架的好处是减少了对于接口信息的解析,最主要的是减少了对于传递于网络中XML ...
- (二)使用CXF开发WebService服务器端接口
CXF作为java领域主流的WebService实现框架,Java程序员有必要掌握它. CXF主页:http://cxf.apache.org/ 简介:百度百科 今天的话,主要是用CXF来开发下Web ...
- Jmeter之WebService接口测试
一.简介 1.JMeter3.2前的版本,可以使用SOAP/XML-RPC Request插件直接进行webservice接口,而3.2后的版本则已经取消了这个接口,需要另外的方法才能进行测试. 2 ...
随机推荐
- Android 第一行代码(第二版)分享
今天从网上好不容易看到了别人转发的pdf版的 第一行代码通过下载我把它存在了百度云里面了与大家共享 http://pan.baidu.com/s/1bRztF4
- akka框架——异步非阻塞高并发处理框架
akka actor, akka cluster akka是一系列框架,包括akka-actor, akka-remote, akka-cluster, akka-stream等,分别具有高并发处理模 ...
- 基于 CC2530 的温度采集系统(未定稿)
前言 最近在自学 Zigbee,每天的主要是任务是:看博客,看 CC2530 的 datasheet 和实践,熟悉片上的 SFR 以及控制板子. 学和做内容包括:IO.外部中断.Timer1/3/4. ...
- jQueryAjax模拟按键消抖(可设置抖动延迟时间)
在硬件中,按键等都会有抖动现象,如何消除抖动,不重复触发事件呢,这就要用到消抖机制了. 这是我用jQuery模拟硬件消抖原理,额,可能是吧...又不对的地方,希望有高手指点指点. <!DOCTY ...
- class path resource [processes/] cannot be resolved to URL because it does not exist
springboot整合activiti时报以下错误,原因是项目启动时检查流程文件 nested exception is java.io.FileNotFoundException: class p ...
- 解析MYsql写的表达式
今天遇到个问题,Sql中直接写的是复杂表达式,如何解析呢? round(((0.00579049505+0.00006600324*JING_JIE^2*SHU_GAO-0.00000046921*J ...
- appium+python,app自动化测试框架
目前正在写一个app的自动化UI测试框架,目录结构如, 脚本还在调试,实现的方法是从excel表格读取测试用例,执行完成后会将结果保存到Excel中. 等待.......
- lucene多条件查询”搜索—BooleanQuery
/** * “多条件查询”搜索—BooleanQuery * BooleanQuery也是实际开发过程中经常使用的一种Query. * 它其实是一个组合的Query,在使用时可以把各种Query对象添 ...
- 【剑指Offer】3、从尾到头打印链表
题目描述: 输入一个链表,按链表值从尾到头的顺序返回一个ArrayList. 解题思路: (三种方法:借助栈.递归.列表的首位插入) 从头到尾打印链表比较简单,从尾到头很自然的可以 ...
- 字符串函数(day11)
使用存储区的地址作为返回值可以让调用 函数使用被调用函数的存储区 这种时候被调用函数需要提供一个指针类型 的存储区记录作为返回值的地址数据 不可以把非静态局部变量的地址作为返回值 使用 C语言里的文字 ...