一,cxf webService入门案例

1,jar包

注意版本 使用jdk6和apache-cxf-3.1.2,但cxf-3.1.2已经不支持jdk6,需要jdk7以上

版本用错会报java.lang.UnsupportedClassVersionError: org/apache/cxf/transport/servlet/CXFServlet : Unsupported major.minor version 51.0

下载地址: 取lib下的jar

http://www.apache.org/dyn/closer.lua/cxf/2.7.18/apache-cxf-2.7.18.zip

2,新建web工程

3,java代码

 package com.lxl.it.cxf.service;

 import javax.jws.WebService;

 @WebService
public interface ITestCxfWs {
String sayHi(String text);
}

ITestCxfWs接口

 package com.lxl.it.cxf.service.impl;

 import javax.jws.WebService;

 import com.lxl.it.cxf.service.ITestCxfWs;
@WebService(endpointInterface="com.lxl.it.cxf.service.ITestCxfWs",serviceName="testCxfWs")
public class TestCxfWs implements ITestCxfWs{ @Override
public String sayHi(String text) {
return text;
} }

TestCxfWs实现类

 package com.lxl.it.cxf.service.test;

 import javax.xml.ws.Endpoint;

 import com.lxl.it.cxf.service.impl.TestCxfWs;

 public class WebServiceApp {
public static void main(String[] args) {
System.out.println("WebServiceApp satrt");
TestCxfWs ws=new TestCxfWs();
String address="http://localhost:8080/testCxfWs";
Endpoint.publish(address, ws);
System.out.println("WebServiceApp end");
}
}

代码发webService

4,xml配置 web.xml  spring配置

 <?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>TestWebService</display-name>
<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>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/ws/*</url-pattern>
</servlet-mapping>
</web-app>

web.xml

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> <import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> <jaxws:endpoint id="testCxfWs" implementor="com.lxl.it.cxf.service.impl.TestCxfWs"
address="/testCxfWs" /> <bean id="client" class="com.lxl.it.cxf.service.ITestCxfWs" factory-bean="clientFactory"
factory-method="create" /> <bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass" value="com.lxl.it.cxf.service.ITestCxfWs" />
<property name="address" value="http://localhost:8080/TestWebService/webservice/testCxfWs" />
</bean>
</beans>

spring

二,cxf增加拦截器

1,工程

2,java代码

 package com.lxl.it.cxf.service.Interceptor;

 import java.lang.reflect.Method;
import java.util.List; import javax.servlet.http.HttpServletRequest; import org.apache.cxf.frontend.MethodDispatcher;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
import org.apache.cxf.service.Service;
import org.apache.cxf.service.model.BindingOperationInfo;
import org.apache.cxf.transport.http.AbstractHTTPDestination; import com.lxl.it.utils.IpUtil;
import com.lxl.it.utils.StringUtils;
import com.lxl.it.utils.Tuple2;
/**
* 对webservice的请求ip地址进行限制的拦截器
*
*/
public class IpAddressInInterceptor extends AbstractPhaseInterceptor<Message>{ public IpAddressInInterceptor() {
super(Phase.USER_LOGICAL);
}
@Override
public void handleMessage(Message msg) throws Fault { String ip = "0.0.0.0";
HttpServletRequest httpRequest = (HttpServletRequest) msg
.get(AbstractHTTPDestination.HTTP_REQUEST); if (null != httpRequest) {
ip = StringUtils.getIpFromRequest(httpRequest);
}else{
return;
} Exchange exchange = msg.getExchange();
Method paramMethod = ((MethodDispatcher) exchange.get(Service.class)
.get(MethodDispatcher.class.getName())).getMethod(exchange
.get(BindingOperationInfo.class));
String method = paramMethod.toString();
List<Tuple2<Long, Long>> ips =null;//这里是获取系统配置的ip白名单
//ips=InterfaceMethodCache
// .getAuthorizedIp(method);
// if (ips == null || ips.isEmpty()) {
// // 然后用类名称查找配置
// method = paramMethod.getDeclaringClass().getName();
// ips = InterfaceMethodCache.getAuthorizedIp(method);
// }
if (ips == null || ips.isEmpty()) {
return;
} if (!IpUtil.ipCheck(ip, ips)) {
throw new Fault(new IllegalAccessException("method id[" + method
+ "] & ip address[" + ip + "] is denied!"));
} } }

IpAddressInInterceptor

 package com.lxl.it.utils;

 import java.util.List;

 import org.slf4j.Logger;
import org.slf4j.LoggerFactory; public class IpUtil { private static final Logger logger = LoggerFactory.getLogger(IpUtil.class); /**
* 将IP转成整数
*
* @param ip
* @return
*/
public static long ipToLong(String ip) {
long res = 0;
String[] ss = ip.split("\\.");
res = ((Long.valueOf(ss[0]) * 256 + Long.valueOf(ss[1])) * 256 + Long
.valueOf(ss[2])) * 256 + Long.valueOf(ss[3]);
return res;
} /**
* 校验IP是否合法
*
* @param ip
* @param ips
* @return
*/
public static boolean ipCheck(String ip, List<Tuple2<Long, Long>> ips) {
return ipCheck(ipToLong(ip), ips);
} public static boolean ipCheck(long ip, List<Tuple2<Long, Long>> ips) {
for (Tuple2<Long, Long> tuple : ips) {
if ((ip >= tuple._1 && ip <= tuple._2) || ip == 0L)
return true;
}
return false;
} public static boolean ipCheck(String ip, Tuple2<Long, Long> tuple) {
return ipCheck(ipToLong(ip), tuple);
} public static boolean ipCheck(long ip, Tuple2<Long, Long> tuple) {
return (ip >= tuple._1 && ip <= tuple._2);
} private static String getCheckword(String xml) {
String checkword = null;
try {
if (xml != null) {
int sIndex = xml.indexOf("<checkword>");
int eIndex = xml.indexOf("</checkword>"); if (sIndex != -1 && eIndex != -1) {
checkword = xml.substring(sIndex + "<checkword>".length(),
eIndex);
}
}
} catch (Exception e) {
// e.printStackTrace();
logger.error("", e);
}
return checkword;
} public static void main(String[] args) {
// System.out.println(ipToLong("0.0.0.0"));
// System.out.println(ipToLong("255.255.255.255"));
}
}

IpUtil

 package com.lxl.it.utils;

 /**
* Copyright (c) 2013, S.F. Express Inc. All rights reserved.
*/ import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List; import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; public class StringUtils { private static Logger logger = LoggerFactory.getLogger(StringUtils.class); /*
* 16进制数字字符集
*/
private static String hexString = "0123456789ABCDEF"; public static boolean isNotEmpty(String str) {
return !isEmpty(str);
} public static boolean isEmpty(String str) {
return str == null || str.trim().length() == 0;
} public static String toString(Object o) {
if (o == null)
return null;
return o.toString();
} // private static final String BR = "<br>\n"; public static String throwableToString(Throwable e) {
ByteArrayOutputStream buf = new ByteArrayOutputStream();
e.printStackTrace(new PrintWriter(buf, true));
return buf.toString();
// StringBuilder sb = new StringBuilder();
// try {
// throwableToString(e, sb);
// } catch (Exception e1) {
// sb.append("parse and print exception error.");
// }
// return sb.toString();
} // @SuppressWarnings("unchecked")
// private static void throwableToString(Throwable e, StringBuilder sb) {
// if (e == null)
// sb.append("#Exception:NULL");
// else {
// sb.append(BR).append(e.getClass().getName()).append(":").append(e.getMessage()).append(BR)
// .append("#StackTrace:");
// boolean isIterable = false;
// if (e instanceof Iterable) {
// try {
// StringBuilder sb2 = new StringBuilder();
// for (Throwable t : (Iterable<Throwable>) e)
// throwableToString(t, sb2);
// sb.append(sb2);
// isIterable = true;
// } catch (Exception e1) {
// isIterable = false;
// }
// }
// if (!isIterable) {
// for (StackTraceElement ele : e.getStackTrace())
// sb.append(BR).append(ele.toString());
// }
// }
// } /**
* 从request中获取ip地址
*
* @param request
* 请求
* @return
*/
public static String getIpFromRequest(HttpServletRequest request) {
String ip = request.getHeader("x-forwarded-for");
if (isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
if (ip != null) {
int idx = ip.indexOf(',');
if (idx > 0) {
ip = ip.substring(0, idx);
}
}
return ip;
} /**
* null和空字符串认为空
*
* @param target
* @return
*/
public static boolean isBlank(String target) {
return isEmpty(target);
} /**
* 按字节数截取字符串
*
* @param orignal
* 字符串
* @param count
* 需要截取的字节数
* @return
* @throws UnsupportedEncodingException
*/
public static String substring(String orignal, int count)
throws UnsupportedEncodingException {
// 原始字符不为null,也不是空字符串
if (!isEmpty(orignal)) {
// 将原始字符串转换为UTF-8编码格式
orignal = new String(orignal.getBytes(), "UTF-8");
// 要截取的字节数大于0,且小于原始字符串的字节数
if (count > 0 && count < orignal.getBytes("UTF-8").length) {
StringBuffer buff = new StringBuffer();
boolean lastCharIsChineses = false; char c;
for (int i = 0; i < count; i++) {
c = orignal.charAt(i);
buff.append(c);
if (isChineseChar(c)) {
lastCharIsChineses = true;
// 遇到中文汉字,截取字节总数减2
--count;
--count;
} else {
lastCharIsChineses = false;
}
} if (lastCharIsChineses) {
buff.deleteCharAt(buff.length() - 1);
} return buff.toString();
}
}
return orignal;
} public static boolean isChineseChar(char c) {
Character.UnicodeBlock ub = Character.UnicodeBlock.of(c);
if (ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
|| ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B
|| ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION
|| ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS
|| ub == Character.UnicodeBlock.GENERAL_PUNCTUATION) {
return true;
}
return false;
} private static final int[] BYTES_COUNT = new int[] { 0x80, 0x40, 0x20,
0x10, 8, 4 }; private static final Charset utf8Charset = Charset.forName("utf-8"); public static String oracleUtf8Sub(String str, int len)
throws UnsupportedEncodingException {
return oracleUtf8Sub(str, 0, len);
} public static String oracleUtf8Sub(String str, int from, int len)
throws UnsupportedEncodingException {
if (str == null || len < 0 || from < 0 || from >= str.length())
throw new IllegalArgumentException(); if (from != 0)
str = str.substring(from); byte[] bs = str.getBytes(utf8Charset); if (len >= bs.length)
return str; int to = 0;
int to_ = 0; while (to <= len) {
to_ = to;
byte b = bs[to];
if (0 <= b && b < 128) {
to += 1;
} else {
for (int i = 1; i <= 5; ++i) {
if ((b & BYTES_COUNT[i]) > 0)
continue;
if (i == 1)
throw new RuntimeException("Error utf8 decode for:"
+ str);
to += i;
break;
}
}
} return new String(bs, 0, to_, utf8Charset);
} /**
* 从含路由的文件名中提取单纯的文件名称
*
* @param pathFileName
* 含路径的文件名称
* @return String
*/
public static String getFileNameFromPath(String pathFileName) {
String fileNameTemp = null;
int lastSplitPos = 0; if (pathFileName.indexOf("/") > -1) {
lastSplitPos = pathFileName.lastIndexOf("/");
fileNameTemp = pathFileName.substring(lastSplitPos + 1,
pathFileName.length());
} else if (pathFileName.indexOf("\\") > -1) {
lastSplitPos = pathFileName.lastIndexOf("\\");
fileNameTemp = pathFileName.substring(lastSplitPos + 1,
pathFileName.length());
} else if (pathFileName.indexOf(":") > -1) {
lastSplitPos = pathFileName.lastIndexOf(":");
fileNameTemp = pathFileName.substring(lastSplitPos + 1,
pathFileName.length());
} else {
fileNameTemp = pathFileName;
} return fileNameTemp;
} public static String getFirstNodeTxt(String xmlStr, String nodeName) {
String resultStr = null; if (StringUtils.isNotEmpty(xmlStr) && StringUtils.isNotEmpty(nodeName)) {
int startIndex = xmlStr.indexOf("<" + nodeName + ">");
int endIndex = xmlStr.indexOf("</" + nodeName + ">"); if (startIndex != -1 && endIndex != -1) {
resultStr = xmlStr.substring(
startIndex + nodeName.length() + 2, endIndex);
} } return resultStr;
} public static String getHexTOString(String bytes) {
ByteArrayOutputStream baos = new ByteArrayOutputStream(
bytes.length() / 2);
// 将每2位16进制整数组装成一个字节
for (int i = 0; i < bytes.length(); i += 2)
baos.write((hexString.indexOf(bytes.charAt(i)) << 4 | hexString
.indexOf(bytes.charAt(i + 1))));
return new String(baos.toByteArray());
} public static String toString(StackTraceElement[] stesElements) {
if (stesElements != null) {
try {
StringBuilder sBuilder = new StringBuilder();
for (StackTraceElement ste : stesElements) {
sBuilder.append(' ').append(ste.toString()).append('\n');
}
return sBuilder.toString();
} catch (Exception e) {
logger.error("", e);
}
}
return null;
} /**
* HTML转义
*
* @param content
* @return
*/
public static String htmlEncode(String content) {
if (content == null)
return ""; String html = content; html = html.replaceAll("&", "&amp;");
html = html.replace("'", "&apos;");
html = html.replace("\"", "&quot;"); // "
html = html.replace("\t", "&nbsp;&nbsp;");// 替换跳格
html = html.replace(" ", "&nbsp;");// 替换空格
html = html.replace("<", "&lt;");
html = html.replaceAll(">", "&gt;"); return html;
} /**
* 输出某个对象的全部属性值
*
* @param obj
* 对象
* @param fieldShow属性名称与属性值之间的分隔符
* @param fieldEndChr属性结束符
* :各个属性之间的分隔符
* @return
*/
public static String outAllFields4Object(Object obj, String fieldShow,
String fieldEndChr) {
if (null == obj) {
return null;
} else {
StringBuilder sbuilder = new StringBuilder(); if (isEmpty(fieldShow)) {
fieldShow = "->";
} if (isEmpty(fieldEndChr)) {
fieldEndChr = ";";
} try {
Class<?> c = obj.getClass();
Field[] fields = c.getDeclaredFields(); sbuilder.append(obj.getClass()).append(":"); for (Field f : fields) {
f.setAccessible(true);
String field = f.toString().substring(
f.toString().lastIndexOf(".") + 1); // 取出属性名称
sbuilder.append(field).append(fieldShow)
.append(f.get(obj) == null ? "" : f.get(obj))
.append(fieldEndChr);
}
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} return sbuilder.toString();
} }
/**
* 输出某个对象的全部属性值
*
* @param obj
* 对象
* @param fieldShow属性名称与属性值之间的分隔符
* @param fieldEndChr属性结束符
* :各个属性之间的分隔符
* @return
*/
public static String outAllFields4ObjectAndSuper(Object obj, String fieldShow,
String fieldEndChr) {
if (null == obj) {
return null;
} else {
StringBuilder sbuilder = new StringBuilder(); if (isEmpty(fieldShow)) {
fieldShow = "->";
} if (isEmpty(fieldEndChr)) {
fieldEndChr = ";";
} try {
Class<?> c = obj.getClass();
List<Field> fields=new ArrayList<Field>();
fields=getClassField(c,fields); sbuilder.append(obj.getClass()).append(":"); for (Field f : fields) {
f.setAccessible(true);
String field = f.toString().substring(
f.toString().lastIndexOf(".") + 1); // 取出属性名称
sbuilder.append(field).append(fieldShow)
.append(f.get(obj) == null ? "" : f.get(obj))
.append(fieldEndChr);
}
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} return sbuilder.toString();
} } /**
* 获取类的所有属性,包括父类的
*
* @param aClazz
* @param fieldList
* @return
*/
private static List<Field> getClassField(Class aClazz, List<Field> fieldList) {
Field[] declaredFields = aClazz.getDeclaredFields();
for (Field field : declaredFields) {
fieldList.add(field);
} Class superclass = aClazz.getSuperclass();
if (superclass != null) {// 简单的递归一下
return getClassField(superclass, fieldList);
}
return fieldList;
} /**
* 将非打印字符替换为空格
*
* @param str
* 需处理的字符串
* @param charset
* :字符串编码格式:UTF-8,GBK
* @return
* @throws UnsupportedEncodingException
*/
public static String emptyNotPrintChar(String str, String charset)
throws UnsupportedEncodingException { if (StringUtils.isEmpty(str)) {
return "";
} return new String(emptyNotPrintChar(str.getBytes(charset)), charset);
} /**
* 将非打印字符替换为空格
*
* @param str
* 需处理的字符串
* @return
* @throws UnsupportedEncodingException
*/
public static String emptyNotPrintChar(String str) { if (StringUtils.isEmpty(str)) {
return "";
} return new String(emptyNotPrintChar(str.getBytes()));
} /**
* 将非打印字符替换为空格
*
* @param bts
* 需处理的字节数组
* @return
*/
private static byte[] emptyNotPrintChar(byte[] bts) {
int btsLength = bts.length;
byte[] newBytes = new byte[btsLength];
for (int i = 0; i < btsLength; i++) { byte b = bts[i];
if ((b >= 0 && b <= 31) || b == 127) {
b = 32;
} newBytes[i] = b;
} return newBytes;
} // public static void main(String[] args) throws UnsupportedEncodingException {
// String str = "qwertyuiop中华人民共和国123456789";
// String destStr = "";
//
// destStr = StringUtils.emptyNotPrintChar(str, "UTF-8");
// System.out.println(destStr);
//
// str = "上海杨浦区昆明路739号文通大厦15层 中青旅联科";
// destStr = "";
//
// destStr = StringUtils.emptyNotPrintChar(str, "GBK");
// System.out.println(destStr);
// }
}

StringUtils

 package com.lxl.it.utils;

 import java.io.Serializable;

 public class Tuple2<T1, T2> implements Serializable {

     private static final long serialVersionUID = -39962326066034337L;

     public T1 _1;
public T2 _2; public Tuple2() {
} public Tuple2(T1 _1, T2 _2) {
super();
this._1 = _1;
this._2 = _2;
} /**
* 根据提供的参数,构造Tuple对象
*
* @param _1
* @param _2
* @return
*/
public static <E1, E2> Tuple2<E1, E2> apply(E1 _1, E2 _2) {
Tuple2<E1, E2> res = new Tuple2<E1, E2>();
res._1 = _1;
res._2 = _2;
return res;
} @Override
public String toString() {
return "[" + _1 + ", " + _2 + "]";
} @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((_1 == null) ? 0 : _1.hashCode());
result = prime * result + ((_2 == null) ? 0 : _2.hashCode());
return result;
} @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Tuple2<?, ?> other = (Tuple2<?, ?>) obj;
if (_1 == null) {
if (other._1 != null)
return false;
} else if (!_1.equals(other._1))
return false;
if (_2 == null) {
if (other._2 != null)
return false;
} else if (!_2.equals(other._2))
return false;
return true;
} }

Tuple2

3,配置spring文件

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:cxf="http://cxf.apache.org/core"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd"> <import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<bean id="ipAddressInInterceptor"
class="com.lxl.it.cxf.service.Interceptor.IpAddressInInterceptor" />
<!-- 监听 -->
<cxf:bus>
<cxf:inInterceptors>
<ref bean="ipAddressInInterceptor" />
</cxf:inInterceptors>
</cxf:bus>
<jaxws:endpoint id="testCxfWs"
implementor="com.lxl.it.cxf.service.impl.TestCxfWs" address="/testCxfWs" /> <bean id="client" class="com.lxl.it.cxf.service.ITestCxfWs"
factory-bean="clientFactory" factory-method="create" /> <bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass" value="com.lxl.it.cxf.service.ITestCxfWs" />
<property name="address" value="http://localhost:8080/TestWebService/webservice/testCxfWs" />
</bean> </beans>

spring

注意:
   <!-- 监听 -->
 <cxf:bus>
  <cxf:inInterceptors>
   <ref bean="ipAddressInInterceptor" />
  </cxf:inInterceptors>
 </cxf:bus>

上述监听配置用的cxf标签,需要再spring配置文件头部加上声明

<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:jaxws="http://cxf.apache.org/jaxws"
 xmlns:cxf="http://cxf.apache.org/core"
 xsi:schemaLocation="
                       http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd
                       http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
                       http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">

最新文章

  1. 微信开发笔记(accesstoken)
  2. div 加载 html页面的方法
  3. 利用浏览器LocalStorage缓存图片,视频文件
  4. Shell displays color output
  5. TCoolMemo
  6. Eclipse 环境下安装PhoneGap开发插件
  7. SharePoint 2010 获取列表中所有数据(包括文件夹内)的方法
  8. Linux企业级项目实践之网络爬虫(14)——使用正则表达式抽取HTML正文和URL
  9. ACM-简单题之Ignatius and the Princess II——hdu1027
  10. 仿淘宝TAB切换搜索框
  11. AW笔记本升级SSD,外接双屏中的一些注意事项
  12. EXPORT_SYMBOL解析
  13. 转:Jmeter以non-gui模式进行分布式测试
  14. 软工+C(2017第5期) 工具和结构化
  15. AMH 5.X下安装 Flarum
  16. 织梦手机站下一篇变上一篇而且还出错Request Error!
  17. 一张图看Docker
  18. gogs仓库管理软件 exec: &quot;git-upload-pack&quot;: executable file not found in $PATH
  19. java redis 分页查询数据
  20. Butterknife 导入项目配置

热门文章

  1. 本地连接图标消失;修改地址IP地址
  2. Poj 2081 Recaman&#39;s Sequence之解题报告
  3. 怎么限制Google自动调整字体大小
  4. TCP 3次握手和四次挥手
  5. jenkins api调用
  6. JAVA一个关于传递引用的测试
  7. 无法在Web服务器上启动调试,与Web服务器通信时出现身份验证错误
  8. Android实例-使用电话拨号器在移动设备上(官方)(XE8+小米2)
  9. 第二十章、启动流程、模块管理与 Loader
  10. hdoj 2037 今年暑假不AC