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 ...
随机推荐
- Beta冲刺-星期三
这个作业属于哪个课程 <课程的链接> 这个作业要求在哪里 <作业要求的链接> 团队名称 Three cobblers 这个作业的目标 剩余任务预估,分配 ...
- C#调用Java的WebService出现500 服务器错误
最近在用C#调用Java写的WebService时,发现老是返回500 服务器错误,到底什么原因一直找不出来, 后来google了以后,找到国外的http://stackoverflow.com站点已 ...
- (转载) ORA-12537:TNS连接已关闭
今天在远程客户端配置EBS数据库连接的时候发生“ORA-12537:TNS连接已关闭”的错误.进入服务器运行如下命令:$tnsping VIS 这里VIS如果定义服务名,可以写成 $ tnsping ...
- 浏览器 HTTP 协议缓存机制详解--网络缓存决策机制流程图
1.缓存的分类 2.浏览器缓存机制详解 2.1 HTML Meta标签控制缓存 2.2 HTTP头信息控制缓存 2.2.1 浏览器请求流程 2.2.2 几个重要概念解释 3.用户行为与缓存 4.Ref ...
- HTTP协议探索之Cache-Control
缓存的存与用的控制 Cache-Control指定了请求和响应遵循的缓存机制.好的缓存机制可以减少对网络带宽的占用,可以提高访问速度,提高用户的体验,还可以减轻服务器的负担. Cache-Contro ...
- ApplicationLoader登录失败
报错:Please sign in with an app-specific password. You can create one at appleid.apple.com 是因为帐号开启了双重认 ...
- spring IOC bean中注入bean
俩个实体 package com.java.test4; /** * @author nidegui * @create 2019-06-22 14:45 */ public class People ...
- LINUX命令行如何查看memcache运行状态
(附加)如何查看memcache服务器端版本: ./memcached -h memcache的运行状态可以方便的用 stats 命令显示. 首先用telnet 127.0.0.1 11211这样 ...
- C语言编程-9_4 字符统计
输入一个字符串(其长度不超过81),分别统计其中26个英文字母出现的次数(不区分大.小写字母),并按字母出现次数从高到低排序,若次数相同,按字母顺序排列.字母输出格式举例,例如:A-3,表示字母A出现 ...
- python学习笔记之小小购物车
#coding=utf-8 ''' Created on 2015-6-18 @author: 悦文 ''' def goods_list(): shangpin={"} print &qu ...