- 浏览: 516766 次
- 性别:
- 来自: 远方
文章分类
最新评论
-
futoviny:
挺有用的 javax.xml.ws.Holder
CXF学习笔记---让通过参数传递数据 -
zqb666kkk:
能提供下示例demo吗
CXF学习笔记---给CXF加一把锁WS_SECURITY应用 -
hello_world_wdq:
真是坑爹,这能用吗,害我半天时间浪费了
Extjs学习总结---RowExpander 的异步调用 -
ubuntu的疯狂:
第一段代码怎么用????求解释!!弄了很久还是不得结果……
Extjs学习总结---RowExpander 的异步调用 -
107x:
不错,谢谢分享!
[log4j]Slf4j的包冲突
整整折腾了3天终于通过CXF进行参数传递了。CXF的文档和sample都是存在问题的。这么一些简单的常用内容,硬是找不着。opensource的弊病。
目地:
通过webservice传递值以及错误信息。true:取result值,false:取errorNum和errorMsg
【Server】
1、Interface
2.impletement文件
3、描述文件
【client test】
2.配置文件
【总结】
1.当用到参数传递值时千万不要用acegi,不知道bug否,xfire的时候就发现有这个问题现在也未解决。
2.后续要认真研究aegis,没准能找到问题。
目地:
通过webservice传递值以及错误信息。true:取result值,false:取errorNum和errorMsg
【Server】
1、Interface
@WebService public interface DatasetExcute { // List<TableDataInfo> excuteSql(String sql); String excuteSqlWithReturnXml(String sql); // Document excuteSqlWithReturnDoc(String sql); public boolean excuteSqlWithReturnDocAndMsg( @WebParam(name = "excuteSql", header = true,mode = WebParam.Mode.IN) String sql, @WebParam(name = "excuteResult", targetNamespace = "",mode = WebParam.Mode.OUT) javax.xml.ws.Holder<java.lang.String> result, @WebParam(name = "errorNumber", targetNamespace = "", mode = WebParam.Mode.OUT) javax.xml.ws.Holder<java.lang.String> errorNumber, @WebParam(name = "errorMsg", targetNamespace = "", mode = WebParam.Mode.OUT) javax.xml.ws.Holder<java.lang.String> errorMsg); }
2.impletement文件
@WebService(endpointInterface = "com.tnt.mms.webservice.DatasetExcute") public class DatasetExcuteImpl implements DatasetExcute { private NativeDAO nativeDAO; public void setNativeDAO(NativeDAO nativeDAO) { this.nativeDAO = nativeDAO; } // // public List<TableDataInfo> excuteSql(String sql) { // // // List<TableDataInfo> ret=nativeDAO.bulkOperationWithReturnAndFields(sql); // return ret; // // } public String excuteSqlWithReturnXml(String sql) { String xmlRet = nativeDAO.bulkOperationWithReturnXml(sql); return xmlRet; } public Document excuteSqlWithReturnDoc(String sql) { Document xmlRet = nativeDAO.bulkOperationWithReturnDoc(sql); return xmlRet; } public boolean excuteSqlWithReturnDocAndMsg(String sql, javax.xml.ws.Holder<java.lang.String> result, javax.xml.ws.Holder<java.lang.String> errorNumber, javax.xml.ws.Holder<java.lang.String> errorMsg) { boolean blnReturn = false; try { result.value = nativeDAO.bulkOperationWithReturnXml(sql); blnReturn = true; } catch (Exception e) { errorNumber.value = "ES0001"; errorMsg.value = "Database Error!"; } return blnReturn; } }
3、描述文件
<jaxws:endpoint id="DatasetExcute" implementorClass="com.tnt.mms.webservice.DatasetExcuteImpl" implementor="#DatasetExcuteImpl" address="/DatasetExcute"> <!-- 用参数传递,就不要用aegis <jaxws:serviceFactory> <ref bean="jaxws-and-aegis-service-factory" /> </jaxws:serviceFactory>--> </jaxws:endpoint>
【client test】
public final class Client_DbExcute { private Client_DbExcute() { } public static void main(String args[]) throws Exception { // START SNIPPET: client ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( new String[] { "com/tnt/mms/webservice/client/client-DbExcute.xml" }); try { DatasetExcute client = (DatasetExcute) context.getBean("client"); // List<TableDataInfo> list=null; // list = client.excuteSql("select* from vendor"); // String list = client.excuteSqlWithReturnXml("select* from vendor // where vendorID like '111%'"); // Document list = client // .excuteSqlWithReturnDoc("select* from vendor where vendorID like // '111%'");. StringBuffer sql = new StringBuffer(); sql .append("if object_id('tempdb..#UOM150232076') is not null begin"); sql.append(" drop table #UOM150232076 "); sql.append(" end"); sql.append(" begin tran"); sql.append(" select distinct itemid, pack, EngUOM as UOM,"); sql .append("coalesce(ManualWeight,0) as ManualWeight, coalesce(GST,0) as GST,"); sql .append(" ' ' as flag, getdate() as chgtime, '754410' as chgby"); sql.append(" into #UOM150232076"); sql.append(" from [tntdb150].RIS_test.dbo.Pos"); sql.append(" where itemid = '663247'"); sql.append(" order by pack"); sql.append(" if @@ROWCOUNT=0"); sql .append(" insert into #UOM150232076 ( itemid , pack , UOM,"); sql.append("ManualWeight, GST, flag, chgtime, chgby)"); sql.append(" values('663247', 1000 * 0 + 1.0, 'ea',"); sql.append("0, 0, ' ', getdate(), '754410')"); sql.append(" select * from #UOM150232076"); sql.append(" if @@error <> 0"); sql.append(" rollback tran"); sql.append(" else"); sql.append(" commit tran"); // Document list = client // .excuteSqlWithReturnDoc("select* from vendor where vendorID='10118'"); // Document list = client // .excuteSqlWithReturnDoc(sql.toString()); // list.getFirstChild().getTextContent(); // XmlUtil.save(list, "c:/test.xml"); // String list1= ""; // String errorNumber="", errorMsg = ""; Holder<String> list1=new Holder<String>(); Holder<String> errorNumber=new Holder<String>(); Holder<String> errorMsg=new Holder<String>(); boolean ret=client.excuteSqlWithReturnDocAndMsg("select * from vendor where vendorID like '111%'", list1, errorNumber, errorMsg); if(ret) { System.out.println("result: " + list1+":"+list1.value); XmlUtil.writeXml(list1.value, "c:/ls.xml"); } else { System.out.println("Error: " + errorNumber.value+":"+errorMsg.value); } System.exit(0); // END SNIPPET: client } catch (Exception e) { e.printStackTrace(); System.out.println("error: " + e.getMessage()); } } }
2.配置文件
<?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"> <!-- Configure CXF to use Aegis data binding instead of JAXB --> <bean id="aegisBean" class="org.apache.cxf.aegis.databinding.AegisDatabinding" scope="prototype" /> <bean id="jaxwsAndAegisServiceFactory" class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean" scope="prototype"> <property name="dataBinding" ref="aegisBean" /> <property name="serviceConfigurations"> <list> <bean class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration" /> <bean class="org.apache.cxf.aegis.databinding.AegisServiceConfiguration" /> <bean class="org.apache.cxf.service.factory.DefaultServiceConfiguration" /> </list> </property> </bean> <bean id="client" class="com.tnt.mms.webservice.DatasetExcute" factory-bean="clientFactory" factory-method="create" /> <bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean"> <property name="serviceClass" value="com.tnt.mms.webservice.DatasetExcute" /> <property name="address" value="http://localhost:8080/extjsmms/services/DatasetExcute" /> <!-- --> <property name="serviceFactory" ref="jaxwsAndAegisServiceFactory" /> </bean> </beans> <!-- END SNIPPET: beans -->
【总结】
1.当用到参数传递值时千万不要用acegi,不知道bug否,xfire的时候就发现有这个问题现在也未解决。
2.后续要认真研究aegis,没准能找到问题。
发表评论
-
[JAVA]MyEclipse发生deployment failure错误
2013-08-20 04:43 1069一个项目组成员更新了一个jar文件,上传到服务器后。我们更 ... -
[JAVA]将java project转换为Maven project
2012-04-20 06:29 2857在项目folder中的.project文件中加入red 部分 ... -
[JAVA]Validator 应用
2011-11-15 08:06 1475Java validator的应用 Javax Ass ... -
[log4j]Slf4j的包冲突
2011-09-28 06:13 35345在SSH配置时,发现在junit4下测试时,出现 Cause ... -
[Quartz]Spring3.0不支持Quartz2.0
2011-09-13 08:28 4580将quartz从1.7升级到2.01 发现Caused by ... -
[BIRT]web中向Birt报表传参数
2011-07-15 07:06 2244原来用URL方式向Birt进行参数传递,发现二个问题 1.需 ... -
Java加密共通函数
2011-07-06 06:55 1719import java.io.File; import ja ... -
Eclipse---Jet Editor的安装
2010-09-01 01:52 3000JET(Java Emitter Templates)项目是E ... -
使用MoreUnit插件
2010-08-21 06:16 1808moreUnit是一个ec ... -
解决 svn中containing working copy admin area is missing问题
2010-08-18 01:22 17787svn中containing working copy adm ... -
Eclipse----Spring source tools 的安裝
2010-03-17 00:18 5503Eclipse 3.5 安裝 Spring Tool Suit ... -
Eclipse----My eclipse blue 8.0 必需
2010-03-03 07:49 1379用户名:jet_li 注册码:wLR8ZO-655556-6 ... -
Hibernate读书笔记-----一对多映射总结
2009-12-15 01:53 1114在一class中定义多属性 private List< ... -
SVN笔记--变更目录commit时遭遇outofdate
2009-12-04 02:19 2606变更目录后commit svn报out of date 错误。 ... -
几个好用工具
2009-11-11 01:52 1265http://www.eit.name/tools/ ... -
Java---Sonar二分钟安装
2009-10-09 06:02 61311.下载sonar安装版,解压; 2.bin\windo ... -
Java---Eclipse 常用插件
2009-10-08 06:40 21541. Subclipse http://subclip ... -
JBoss---由于启用gzip造成IE6假死机
2009-10-07 01:17 3087开发了一个Web项目,在IE7和Firefox下测试全部ok, ... -
Eclipse svn SVN PROPFIND Request Failed 处理
2009-09-22 05:20 1876公司重新部署了svn,但发现原来好用的svn报SVN PROP ... -
SVN笔记--SVN权限管理补充
2009-05-15 02:05 1361SVN中的权限管理,最容易出问题的地方在用户和权限分配的地方: ...
相关推荐
赠送jar包:cxf-rt-rs-client-3.0.1.jar; 赠送原API文档:cxf-rt-rs-client-3.0.1-javadoc.jar; 赠送源代码:cxf-rt-rs-client-3.0.1-sources.jar; 赠送Maven依赖信息文件:cxf-rt-rs-client-3.0.1.pom; 包含...
赠送jar包:cxf-rt-frontend-jaxrs-3.0.1.jar; 赠送原API文档:cxf-rt-frontend-jaxrs-3.0.1-javadoc.jar; 赠送源代码:cxf-rt-frontend-jaxrs-3.0.1-sources.jar; 赠送Maven依赖信息文件:cxf-rt-frontend-jaxrs...
赠送jar包:cxf-rt-transports-http-3.0.1.jar; 赠送原API文档:cxf-rt-transports-http-3.0.1-javadoc.jar; 赠送源代码:cxf-rt-transports-http-3.0.1-sources.jar; 赠送Maven依赖信息文件:cxf-rt-transports-...
赠送jar包:cxf-rt-frontend-simple-3.0.1.jar; 赠送原API文档:cxf-rt-frontend-simple-3.0.1-javadoc.jar; 赠送源代码:cxf-rt-frontend-simple-3.0.1-sources.jar; 赠送Maven依赖信息文件:cxf-rt-frontend-...
赠送jar包:cxf-rt-frontend-jaxws-3.0.1.jar; 赠送原API文档:cxf-rt-frontend-jaxws-3.0.1-javadoc.jar; 赠送源代码:cxf-rt-frontend-jaxws-3.0.1-sources.jar; 赠送Maven依赖信息文件:cxf-rt-frontend-jaxws...
赠送jar包:cxf-rt-bindings-soap-3.0.1.jar; 赠送原API文档:cxf-rt-bindings-soap-3.0.1-javadoc.jar; 赠送源代码:cxf-rt-bindings-soap-3.0.1-sources.jar; 赠送Maven依赖信息文件:cxf-rt-bindings-soap-...
赠送jar包:cxf-core-3.0.1.jar; 赠送原API文档:cxf-core-3.0.1-javadoc.jar; 赠送源代码:cxf-core-3.0.1-sources.jar; 赠送Maven依赖信息文件:cxf-core-3.0.1.pom; 包含翻译后的API文档:cxf-core-3.0.1-...
cxf-rt-frontend-jaxws-3.0.16.jar jar包下载3.0.16版本下载
赠送jar包:cxf-rt-bindings-xml-3.0.1.jar; 赠送原API文档:cxf-rt-bindings-xml-3.0.1-javadoc.jar; 赠送源代码:cxf-rt-bindings-xml-3.0.1-sources.jar; 赠送Maven依赖信息文件:cxf-rt-bindings-xml-3.0.1....
赠送jar包:cxf-rt-rs-extension-providers-3.0.1.jar; 赠送原API文档:cxf-rt-rs-extension-providers-3.0.1-javadoc.jar; 赠送源代码:cxf-rt-rs-extension-providers-3.0.1-sources.jar; 赠送Maven依赖信息...
赠送jar包:cxf-rt-ws-addr-3.0.1.jar; 赠送原API文档:cxf-rt-ws-addr-3.0.1-javadoc.jar; 赠送源代码:cxf-rt-ws-addr-3.0.1-sources.jar; 赠送Maven依赖信息文件:cxf-rt-ws-addr-3.0.1.pom; 包含翻译后的API...
<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"/>
赠送jar包:cxf-rt-databinding-jaxb-3.0.1.jar; 赠送原API文档:cxf-rt-databinding-jaxb-3.0.1-javadoc.jar; 赠送源代码:cxf-rt-databinding-jaxb-3.0.1-sources.jar; 赠送Maven依赖信息文件:cxf-rt-...
cxf-dosgi-ri-singlebundle-distribution-1.4.0.jar
源码包"apache-cxf-2.7.18-src.zip"包含了CXF框架的核心组件和相关模块,是深入理解CXF工作原理和进行定制开发的重要资源。 CXF主要由以下几个核心部分组成: 1. **Bus**:CXF的总线(Bus)是其核心组件,它管理...
标题 "cxf-rt-transports-http-jetty-3.0.2.zip" 指的是Apache CXF项目的一个特定版本的HTTP-Jetty传输模块。Apache CXF是一个流行的开源框架,用于构建和开发服务导向架构(SOA)和RESTful Web服务。这个版本,...
这个"apache-cxf-2.3.5-src.zip"文件是一个源代码压缩包,包含了Apache CXF 2.3.5版本的全部源码,这对于开发者深入理解其内部工作原理、进行定制化开发或调试是非常有价值的。 Apache CXF的核心功能包括: 1. **...
cxf-core-3.0.0.jar,cxf-rt-bindings-soap-3.0.0.jar,cxf-rt-databinding-jaxb-3.0.0.jar,cxf-rt-frontend-jaxws-3.0.0.jar,cxf-rt-frontend-simple-3.0.0.jar,cxf-rt-transports-http-3.0.0.jar,cxf-rt-...
cxf-core-3.1.16版本jar包,用于java开发使用
此外,还有其他如`cxf-rt-bindings-soap.jar`、`cxf-rt-databinding-jaxb.jar`、`cxf-rt-rs-extension-providers.jar`等,它们分别对应于不同的功能,如SOAP绑定、JAXB数据绑定和RESTful服务的提供者扩展。...