- 浏览: 777480 次
- 性别:
- 来自: 广州
-
文章分类
最新评论
-
corelengine:
好文,支持一下!
在 Spring Web Flow 项目中应用 Hessian 服务 -
corelengine:
感谢分享,不过你的工程太简单了,怎么可以导入eclipse
Spring Web Flow 2.0 入门 例子源码 -
chenrongtao2132:
melody404 写道请教博主一个问题
登录成功以后为什么老 ...
CAS 单点登录安装笔记4 -- asp.net client端的设置 -
chxiaowu:
从头到尾没发现 那里有 cxf bean配置啊。。。。
WebService开发笔记 3 -- 增强访问 WebService 的安全性 -
chxiaowu:
严重: StandardWrapper.Throwable
o ...
WebService开发笔记 3 -- 增强访问 WebService 的安全性
WebService开发笔记 1 -- 利用cxf开发WebService竟然如此简单
现在的项目中需要用到SOA概念的地方越来越多,最近我接手的一个项目中就提出了这样的业务要求,需要在.net开发的客户端系统中访问java开发的web系统,这样的业务需求自然需要通过WebService进行信息数据的操作。下面就将我们在开发中摸索的一点经验教训总结以下,以供大家参考.
在WebService开发笔记 2 -- VS 2005 访问WebServcie更简单中作一个跨平台访问WebServcie服务的例子....
在WebService开发笔记 3 -- 增强访问 WebService 的安全性通过一个简单的用户口令验证机制来加强一下WebService的安全性....
我们项目的整个架构使用的比较流行的WSH MVC组合,即webwork2 + Spring + Hibernate;
1.首先集成Apacha CXF WebService 到 Spring 框架中;
apache cxf 下载地址:http://people.apache.org/dist/incubator/cxf/2.0.4-incubator/apache-cxf-2.0.4-incubator.zip
在spring context配置文件中引入以下cxf配置
在web.xml中添加过滤器:
2.开发服务端WebService接口:
由简单到复杂定义了三个接口,模拟业务需求;
3.实现接口
4.依赖的两个类:用户对象与List对象
关于List对象,参照了有关JWS的一个问题中的描述:DK6.0 自带的WebService中 WebMethod的参数好像不能是ArrayList 或者其他List
传递List需要将List 包装在其他对象内部才行 (个人理解 如有不对请指出) ,我在实践中也遇到了此类问题.通过以下封装的对象即可以传递List对象.
5.WebService 服务端 spring 配置文件 ws-context.xml
WebService 客户端 spring 配置文件 wsclient-context.xml
6.发布到tomcat服务器以后通过以下地址即可查看自定义的webservice接口生成的wsdl:
http://88.148.29.54:8080/aio/services/WebServiceSample?wsdl
7.调用WebService接口的Junit单元测试程序
用2.0.5是通过的,但是jira上面写的是2.0.4就fixed
用的是spring-2.5.x吧,先用spring-2.0.x顶着,等cxf修复bug
现在的项目中需要用到SOA概念的地方越来越多,最近我接手的一个项目中就提出了这样的业务要求,需要在.net开发的客户端系统中访问java开发的web系统,这样的业务需求自然需要通过WebService进行信息数据的操作。下面就将我们在开发中摸索的一点经验教训总结以下,以供大家参考.
在WebService开发笔记 2 -- VS 2005 访问WebServcie更简单中作一个跨平台访问WebServcie服务的例子....
在WebService开发笔记 3 -- 增强访问 WebService 的安全性通过一个简单的用户口令验证机制来加强一下WebService的安全性....
我们项目的整个架构使用的比较流行的WSH MVC组合,即webwork2 + Spring + Hibernate;
1.首先集成Apacha CXF WebService 到 Spring 框架中;
apache cxf 下载地址:http://people.apache.org/dist/incubator/cxf/2.0.4-incubator/apache-cxf-2.0.4-incubator.zip
在spring context配置文件中引入以下cxf配置
<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" />
在web.xml中添加过滤器:
<servlet> <servlet-name>CXFServlet</servlet-name> <servlet-class> org.apache.cxf.transport.servlet.CXFServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/services/*</url-pattern> </servlet-mapping>
2.开发服务端WebService接口:
/** * WebService接口定义类. * * 使用@WebService将接口中的所有方法输出为Web Service. * 可用annotation对设置方法、参数和返回值在WSDL中的定义. */ @WebService public interface WebServiceSample { /** * 一个简单的方法,返回一个字符串 * @param hello * @return */ String say(String hello); /** * 稍微复杂一些的方法,传递一个对象给服务端处理 * @param user * @return */ String sayUserName( @WebParam(name = "user") UserDTO user); /** * 最复杂的方法,返回一个List封装的对象集合 * @return */ public @WebResult(partName="o") ListObject findUsers(); }
由简单到复杂定义了三个接口,模拟业务需求;
3.实现接口
/** * WebService实现类. * * 使用@WebService指向Interface定义类即可. */ @WebService(endpointInterface = "cn.org.coral.biz.examples.webservice.WebServiceSample") public class WebServiceSampleImpl implements WebServiceSample { public String sayUserName(UserDTO user) { return "hello "+user.getName(); } public String say(String hello) { return "hello "+hello; } public ListObject findUsers() { ArrayList<Object> list = new ArrayList<Object>(); list.add(instancUser(1,"lib")); list.add(instancUser(2,"mld")); list.add(instancUser(3,"lq")); list.add(instancUser(4,"gj")); ListObject o = new ListObject(); o.setList(list); return o; } private UserDTO instancUser(Integer id,String name){ UserDTO user = new UserDTO(); user.setId(id); user.setName(name); return user; } }
4.依赖的两个类:用户对象与List对象
/** * Web Service传输User信息的DTO. * * 分离entity类与web service接口间的耦合,隔绝entity类的修改对接口的影响. * 使用JAXB 2.0的annotation标注JAVA-XML映射,尽量使用默认约定. * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "User") public class UserDTO { protected Integer id; protected String name; public Integer getId() { return id; } public void setId(Integer value) { id = value; } public String getName() { return name; } public void setName(String value) { name = value; } }
关于List对象,参照了有关JWS的一个问题中的描述:DK6.0 自带的WebService中 WebMethod的参数好像不能是ArrayList 或者其他List
传递List需要将List 包装在其他对象内部才行 (个人理解 如有不对请指出) ,我在实践中也遇到了此类问题.通过以下封装的对象即可以传递List对象.
/** * <p>Java class for listObject complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * <complexType name="listObject"> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="list" type="{http://www.w3.org/2001/XMLSchema}anyType" maxOccurs="unbounded" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> * </complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "listObject", propOrder = { "list" }) public class ListObject { @XmlElement(nillable = true) protected List<Object> list; /** * Gets the value of the list property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the list property. * * <p> * For example, to add a new item, do as follows: * <pre> * getList().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Object } * * */ public List<Object> getList() { if (list == null) { list = new ArrayList<Object>(); } return this.list; } public void setList(ArrayList<Object> list) { this.list = list; } }
5.WebService 服务端 spring 配置文件 ws-context.xml
<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://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd" default-autowire="byName" default-lazy-init="true"> <jaxws:endpoint id="webServiceSample" address="/WebServiceSample" implementor="cn.org.coral.biz.examples.webservice.WebServiceSampleImpl"/> </beans>
WebService 客户端 spring 配置文件 wsclient-context.xml
<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://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd" default-autowire="byName" default-lazy-init="true"> <!-- ws client --> <bean id="identityValidateServiceClient" class="cn.org.coral.admin.service.IdentityValidateService" factory-bean="identityValidateServiceClientFactory" factory-method="create" /> <bean id="identityValidateServiceClientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean"> <property name="serviceClass" value="cn.org.coral.admin.service.IdentityValidateService" /> <property name="address" value="http://88.148.29.54:8080/coral/services/IdentityValidateService"/> </bean> </beans>
6.发布到tomcat服务器以后通过以下地址即可查看自定义的webservice接口生成的wsdl:
http://88.148.29.54:8080/aio/services/WebServiceSample?wsdl
7.调用WebService接口的Junit单元测试程序
package test.coral.sample; import org.springframework.test.AbstractDependencyInjectionSpringContextTests; import cn.org.coral.biz.examples.webservice.WebServiceSample; import cn.org.coral.biz.examples.webservice.dto.UserDTO; public class TestWebServiceSample extends AbstractDependencyInjectionSpringContextTests { WebServiceSample webServiceSampleClient; public void setWebServiceSampleClient(WebServiceSample webServiceSampleClient) { this.webServiceSampleClient = webServiceSampleClient; } @Override protected String[] getConfigLocations() { setAutowireMode(AUTOWIRE_BY_NAME); //spring 客户端配置文件保存位置 return new String[] { "classpath:/cn/org/coral/biz/examples/webservice/wsclient-context.xml" }; } public void testWSClinet(){ Assert.hasText(webServiceSampleClient.say(" world")); } }
评论
7 楼
quaff
2008-03-20
jnn 写道
如果一定要用Spring 2.5.2 你也可以下载CXF2.0.5 snapshot[1] 试验一下。 我记得这个bug应该是修正了的。
[1] http://people.apache.org/repo/m2-snapshot-repository/org/apache/cxf/apache-cxf/2.0.5-incubator-SNAPSHOT/apache-cxf-2.0.5-incubator-20080319.024727-10.zip
[1] http://people.apache.org/repo/m2-snapshot-repository/org/apache/cxf/apache-cxf/2.0.5-incubator-SNAPSHOT/apache-cxf-2.0.5-incubator-20080319.024727-10.zip
用2.0.5是通过的,但是jira上面写的是2.0.4就fixed
6 楼
jnn
2008-03-20
如果一定要用Spring 2.5.2 你也可以下载CXF2.0.5 snapshot[1] 试验一下。 我记得这个bug应该是修正了的。
[1] http://people.apache.org/repo/m2-snapshot-repository/org/apache/cxf/apache-cxf/2.0.5-incubator-SNAPSHOT/apache-cxf-2.0.5-incubator-20080319.024727-10.zip
[1] http://people.apache.org/repo/m2-snapshot-repository/org/apache/cxf/apache-cxf/2.0.5-incubator-SNAPSHOT/apache-cxf-2.0.5-incubator-20080319.024727-10.zip
5 楼
quaff
2008-03-20
java_code 写道
WSDL 我成功发布了.
但是客户端调用的时候,出现了下面的异常,能否帮忙看看.
调用代码:
client-beans.xml
调用的时候异常为:
但是客户端调用的时候,出现了下面的异常,能否帮忙看看.
调用代码:
public String testServiceMethod() throws Exception { // START SNIPPET: client System.out.println("test"); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"com/ems/test/client-beans.xml"}); //org.apache.cxf.jaxws.JaxWsProxyFactoryBean clientFac = (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)context.getBean("clientFactory"); //com.gdcn.bpaf.service.IDictionaryTypeService client = (IDictionaryTypeService)clientFac.create(); com.gdcn.bpaf.service.IDictionaryTypeService client = (IDictionaryTypeService)context.getBean("client"); com.gdcn.bpaf.model.BPAFDictionaryType response = client.getDictionaryTypeByCode("test"); System.out.println("Response: " + response.getDictionary_name()); return response.getDictionary_name(); // END SNIPPET: client }
client-beans.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- START SNIPPET: beans --> <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-2.0.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.xsd"> <bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean"> <property name="serviceClass" value="com.gdcn.bpaf.service.IDictionaryTypeService"/> <property name="address" value="http://localhost:8080/EMSTest/DictionaryType"/> </bean> <bean id="client" class="com.gdcn.bpaf.service.IDictionaryTypeService" factory-bean="clientFactory" factory-method="create"/> </beans> <!-- END SNIPPET: beans -->
调用的时候异常为:
log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext). log4j:WARN Please initialize the log4j system properly. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'client' defined in class path resource [com/ems/test/client-beans.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.Object org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:423) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:871) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:785) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:437) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:184) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:430) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93) at com.ems.test.testUI.testServiceMethod(testUI.java:62) at com.ems.test.testUI.createContents(testUI.java:53) at com.ems.test.testUI.open(testUI.java:34) at com.ems.test.testUI.main(testUI.java:22) Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.Object org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:127) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:414) ... 20 more Caused by: java.lang.NullPointerException at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.setConfigLocations(AbstractRefreshableConfigApplicationContext.java:78) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:137) at org.apache.cxf.bus.spring.BusApplicationContext.<init>(BusApplicationContext.java:68) at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:84) at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:65) at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:54) at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:69) at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:106) at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:97) at org.apache.cxf.endpoint.AbstractEndpointFactory.getBus(AbstractEndpointFactory.java:73) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.initializeServiceFactory(AbstractWSDLBasedEndpointFactory.java:143) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:73) at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:51) at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:92) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:115) ... 21 more
用的是spring-2.5.x吧,先用spring-2.0.x顶着,等cxf修复bug
4 楼
jacally
2008-03-20
spring创建bean失败,不知这个 client bean 中有没有引用其它的bean?如果有需要在加载context时引入相应的配置文件.
<bean id="client" class="com.gdcn.bpaf.service.IDictionaryTypeService" factory-bean="clientFactory" factory-method="create"/>
3 楼
java_code
2008-03-20
WSDL 我成功发布了.
但是客户端调用的时候,出现了下面的异常,能否帮忙看看.
调用代码:
client-beans.xml
调用的时候异常为:
但是客户端调用的时候,出现了下面的异常,能否帮忙看看.
调用代码:
public String testServiceMethod() throws Exception { // START SNIPPET: client System.out.println("test"); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"com/ems/test/client-beans.xml"}); //org.apache.cxf.jaxws.JaxWsProxyFactoryBean clientFac = (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)context.getBean("clientFactory"); //com.gdcn.bpaf.service.IDictionaryTypeService client = (IDictionaryTypeService)clientFac.create(); com.gdcn.bpaf.service.IDictionaryTypeService client = (IDictionaryTypeService)context.getBean("client"); com.gdcn.bpaf.model.BPAFDictionaryType response = client.getDictionaryTypeByCode("test"); System.out.println("Response: " + response.getDictionary_name()); return response.getDictionary_name(); // END SNIPPET: client }
client-beans.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- START SNIPPET: beans --> <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-2.0.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.xsd"> <bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean"> <property name="serviceClass" value="com.gdcn.bpaf.service.IDictionaryTypeService"/> <property name="address" value="http://localhost:8080/EMSTest/DictionaryType"/> </bean> <bean id="client" class="com.gdcn.bpaf.service.IDictionaryTypeService" factory-bean="clientFactory" factory-method="create"/> </beans> <!-- END SNIPPET: beans -->
调用的时候异常为:
log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext). log4j:WARN Please initialize the log4j system properly. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'client' defined in class path resource [com/ems/test/client-beans.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.Object org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:423) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:871) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:785) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:437) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:184) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:430) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93) at com.ems.test.testUI.testServiceMethod(testUI.java:62) at com.ems.test.testUI.createContents(testUI.java:53) at com.ems.test.testUI.open(testUI.java:34) at com.ems.test.testUI.main(testUI.java:22) Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.Object org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:127) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:414) ... 20 more Caused by: java.lang.NullPointerException at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.setConfigLocations(AbstractRefreshableConfigApplicationContext.java:78) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:137) at org.apache.cxf.bus.spring.BusApplicationContext.<init>(BusApplicationContext.java:68) at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:84) at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:65) at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:54) at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:69) at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:106) at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:97) at org.apache.cxf.endpoint.AbstractEndpointFactory.getBus(AbstractEndpointFactory.java:73) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.initializeServiceFactory(AbstractWSDLBasedEndpointFactory.java:143) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:73) at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:51) at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:92) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:115) ... 21 more
2 楼
jacally
2008-03-19
参照实例多多实践是理解新技术的一个好途径!
1 楼
rmn190
2008-03-19
谢谢博主的分享,我对这块很是模糊,还请博主多多指教.
发表评论
-
Android开发笔记
2009-10-19 09:11 16921.复制数据库文件: D:\Program Files\and ... -
天气预报的 WebService 服务网站
2009-06-29 10:53 0http://www.webxml.com.cn/WebSer ... -
在 Spring Web Flow 项目中应用 Hessian 服务
2009-05-21 11:19 2634原来作的一个项目因为页面跳转比较多,应用了S ... -
Spring Web Flow 2.0 入门 例子源码
2008-12-22 11:34 11852developerWorks 中有一篇教材讲解了 Spr ... -
JAD反编译工具
2008-05-29 11:33 5094This is README file for Jad - t ... -
压力测试与系统调优
2008-05-04 16:19 2378最近用loadrunne ... -
通过压力测试排查Bug(二)--排查Bug
2008-05-04 11:44 1879最近的一个项目 ... -
通过压力测试排查Bug(一)--测试过程
2008-05-04 11:05 1670最近的一个项目应用了Acegi作为安全框架,项目试运 ... -
WebService开发笔记 3 -- 增强访问 WebService 的安全性
2008-03-19 09:50 21922在WebService开发笔记 1中我们创建了一个WebSer ... -
WebService开发笔记 2 -- VS 2005 访问WebServcie更简单
2008-03-12 19:32 11249WebService开发笔记 2 -- VS 2005 访问W ... -
Tomcat 配置 -- 打开中文文件名的附件
2008-03-04 10:23 2014设计了文件上传的工具,但在Tomcat服务器上访问中文文件名的 ... -
常用的System.getProperty()
2008-03-02 11:53 29常用的System.getProperty()System.g ... -
CAS 单点登录安装笔记4 -- asp.net client端的设置
2008-03-02 11:51 16583CAS 单点登录安装笔记4 --- asp.net clien ... -
CAS 单点登录安装笔记3 -- 与acegi集成
2008-02-28 23:38 8378CAS 单点登录安装笔记3 -- 与acegi集成 在我的项 ... -
CAS 单点登录安装笔记2 -- 配置CAS,访问自己的用户表
2008-02-27 17:45 7068CAS 单点登录安装笔记2 1.修改cas/webapp/ ... -
CAS 单点登录安装笔记1 -- 基本设置与数字证书的安装
2008-02-26 16:35 5772安装JA-SIG SSO系统笔记1 (关于配置访问数据库的用 ... -
JAVA文档
2007-12-19 16:05 1223JAVA相关文档 http://www.lybbs.net/n ... -
Tomcat性能调优(2)
2007-12-19 15:37 2979原文出处:http://www.lybbs.n ... -
Spring 通过 Tomcat 6.0 下的数据源连接池 访问Oracle数据库
2007-12-17 18:26 6027头疼的老问题,折腾了一天,tomcat6.0数据源配置 to ... -
Tomcat数据源配置总结 转载
2007-12-17 16:52 1562成功配置环境Tomcat5.0.28+MSSQLServer2 ...
相关推荐
WebService CXF,全称Apache CXF,是一款开源的Java框架,用于构建和开发Web服务。它支持多种协议和规范,包括SOAP、RESTful、XML以及Web服务标准如WS-*。在"WebService CXF --- 传输文件MTOM"这个主题中,我们将...
cxf自动生成webservice客户端,apache-cxf-2.7.18最稳定的版本 apache cxf 框架wsdl2java命令的使用。 -encoding是指定编码类型; -p 指定包名 -d 指定生成目录 -all生成服务端和客户端代码 -...
4. **JAX-RS支持**:CXF也支持Java API for RESTful Web Services (JAX-RS),使开发RESTful Web服务变得简单。通过使用注解,开发者可以直接将Java方法映射到HTTP请求,实现资源导向的编程模型。 5. **数据绑定**:...
【标题】"webservice-cxf-spring-jar.zip" 是一个包含了使用Apache CXF与Spring框架集成开发Web服务的Java库集合。这个压缩包提供了一整套必要的JAR文件,以便于开发者在他们的项目中快速搭建和运行基于CXF的Web服务...
利用Apache CXF开发webservice接口需要用到的jar集合 cxf-core-3.0.15.jar cxf-rt-bindings-soap-3.0.15.jar cxf-rt-bindings-xml-3.0.15.jar cxf-rt-databinding-jaxb-3.0.15.jar cxf-rt-frontend-jaxws-3.0.15.jar...
Apache CXF 是一个开源的 Web 服务框架,用于构建和部署 SOAP 和 RESTful Web 服务。版本 2.3.5 是该框架的一个历史版本,它在当时提供了丰富的特性和功能,帮助开发者创建高效、灵活的网络应用。下面将详细阐述 ...
在本篇博文中,我们将深入探讨如何利用Apache CXF实现Web Service进行本地数据交互,特别是在PC端和Android端之间的通信。Apache CXF是一个开源框架,它允许开发人员创建和消费各种Web服务,包括SOAP和RESTful风格的...
WebService CXF是一个强大的开源框架,用于创建和消费Web服务。它允许开发者基于WSDL(Web Service Description Language)文件快速地生成服务端和客户端代码,极大地简化了Web服务的开发流程。在本篇中,我们将深入...
- 利用CXF的WS-Security插件进行安全性测试,确保通信过程中数据的完整性和保密性。 - 使用CXF的WSDL工具生成客户端代码,或者通过Postman等工具模拟请求,进行功能测试和性能测试。 5. **注意事项**: - 考虑到...
Apache CXF 是一个开源的Java框架,主要用于构建和开发服务导向架构(SOA)和Web服务。这个"apache-cxf-3.1.6所有jar包"的压缩文件包含了CXF 3.1.6版本的所有核心库和依赖组件。在Java Web服务开发中,CXF扮演着重要...
Apache CXF 是一个开源的Java框架,主要用于构建和开发Web服务。这个项目源自XFire,并在2007年合并到Apache基金会,更名为CXF。CXF允许开发者以SOAP、RESTful、XML/HTTP、WS-*协议等多种方式来实现Web服务。在本...
1. **JDK原生**:适合简单的Web服务需求,开发过程相对简单,但功能较为基础,不支持复杂的扩展。 2. **CXF框架**:提供更多功能和扩展性,如WS-Security、MTOM/XOP等,对于大型项目或有特定需求的Web服务更有优势。...
本篇文章将深入探讨如何利用CXF来实现一个简单的WebService接口开发。 首先,我们要了解什么是CXF。CXF全称CXF Commons eXtensible Services Framework,它不仅支持SOAP(Simple Object Access Protocol)协议,还...
第一天: 什么是webservice? 从案例(便民查询网站)分析如何实现?...CXF开发webservice: CXF入门程序 Spring+cxf整合(重点) CXF发布rest的webservice。(重点) 综合案例: 实现便民查询网站
- Apache CXF是一个开源服务框架,由ObjectWeb Celtix和Codehaus XFire合并而成,提供了一种简单的方式来构建和开发WebService。 - CXF的核心组件是Bus,它类似于Spring的ApplicationContext,用于管理WebService...
在具体技术实现上,CXF使用了Spring框架,从而使得WebService的开发能够利用Spring的依赖注入、声明式事务等特性,增强了应用的可维护性和扩展性。 总结来说,Apache CXF是一个功能强大的WebService开发框架,它...
CXF Webservice 开发手册
1. **配置CXF客户端**:首先,你需要创建一个CXF客户端实例,通过`JaxWsProxyFactoryBean`来设置服务地址和服务接口。同时,你可以配置ws-security的相关参数,如用户名、密码、加密算法等。 2. **创建安全上下文**...
2. **RESTful服务**:CXF也支持JAX-RS规范,使得开发RESTful Web服务变得简单。通过注解,开发者可以轻松地将普通的Java方法转换为HTTP操作。 3. **多种协议支持**:除了HTTP,CXF还支持其他传输协议,如JMS、XMPP...
【CXF Webservice初学笔记】 在IT行业中,Web服务是一种允许不同系统之间进行通信和交换数据的方法。Apache CXF是一个流行的开源框架,用于构建和部署Web服务。本笔记将探讨CXF Webservice的基础知识,包括其核心...