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 ...
随机推荐
- Redis配置文件各项参数说明及性能调优
Redis配置文件参数说明: 1. Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程 daemonize no 2. 当Redis以守护进程方式运行时,Redis默 ...
- Go中的main函数和init函数
Go里面有两个保留的函数:init函数(能够应用于所有的package)和main函数(只能应用于package main).这两个函数在定义时不能有任何的参数和返回值.虽然一个package里面可以 ...
- C# Datetime 使用详解
获得当前系统时间: DateTime dt = DateTime.Now; Environment.TickCount可以得到“系统启动到现在”的毫秒值 DateTime now = DateTime ...
- 输出字符串格式化/ Linq对数组操作 /一个按钮样式
textBox1.Text = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss"); , , , , , , , , , , ...
- c# cookie帮助类
using System; using System.Collections.Generic; using System.Text; using System.Web; namespace Matic ...
- 【转载】java的常见类型转换
//Int型数字转换成String int num1=123456; //方法1 String str1=num1+""; System.out.println(str1); // ...
- 微信小程序 PDF下载打印
在开发微信小程序时,需要打印生成的PDF,实现思路是:后端生成相应的PDF,微信小程序下载并打开. 但是微信小程序并不可以打印,所以需要借助其他APP比如:WPS,但是发现微信小程序down的PDF在 ...
- 【剑指Offer】34、第一个只出现一次的字符
题目描述: 在一个字符串(0<=字符串长度<=10000,全部由字母组成)中找到第一个只出现一次的字符,并返回它的位置, 如果没有则返回 -1(需要区分大小写). 解题思路: ...
- nyoj113-字符串替换
字符串替换 时间限制:3000 ms | 内存限制:65535 KB 难度:2 描述 编写一个程序实现将字符串中的所有"you"替换成"we" 输入 输入包 ...
- CF135E Weak Subsequence (计数问题)
题目传送门 题目大意:对于给定字符集大小k,求有多少个字符串满足它的最长[既是子串又是弱子序列]的长度为w: 神仙计数题 打表发现,对于字符串S而言,它的最长[既是子串又是弱子序列],一定存在一个对应 ...