Notepad++配置Python开发环境
2016-01-25 15:20
701 查看
cxf附件传递:
spring配置文件:
服务接口就不说了,直接贴实现类:
就完成服务段的编程了。
客户段附件里有。有兴趣的看一看看。
如果想了解mtom,可以看下面连接 http://boyingking.blog.sohu.com/27075328.html
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:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core" xmlns:wsa="http://cxf.apache.org/ws/addressing" xsi:schemaLocation=" http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd 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" /> <!-- 注解注入bean --> <context:component-scan base-package="ws.upload" /> <cxf:bus> <cxf:features> <!--日志拦截功能,用于监控soap内容,开发后可以删除 --> <cxf:logging/> <wsa:addressing/> </cxf:features> </cxf:bus> <jaxws:endpoint id="fileUploadWebServiceEndpoint" implementor="#fileUploadWebService" address="/uploadwebservice" > <jaxws:properties> <!--开启mtom附件功能 --> <entry key="mtom-enabled" value="true"/> </jaxws:properties> </jaxws:endpoint> </beans>
服务接口就不说了,直接贴实现类:
package ws.upload; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.activation.DataHandler; import javax.jws.WebService; import org.springframework.stereotype.Service; @WebService(endpointInterface="ws.upload.IFileUploadWebService") @Service("fileUploadWebService") public class FileUploadWebServiceImp implements IFileUploadWebService { @Override public void upload(DataHandler dataHandler) { try { InputStream is=dataHandler.getInputStream(); byte[] temp=new byte[1024]; File file=new File("c:\\a.sql"); OutputStream os=new FileOutputStream(file); int length=-1; while((length=is.read(temp))!=-1){ System.out.println(length); os.write(temp); } } catch (IOException e) { e.printStackTrace(); } } }
就完成服务段的编程了。
客户段附件里有。有兴趣的看一看看。
如果想了解mtom,可以看下面连接 http://boyingking.blog.sohu.com/27075328.html
相关文章推荐
- Python爬虫实战六之抓取爱问知识人问题并保存至数据库
- 我的Python成长之路---第四天---Python基础(14)---2016年1月23日(寒风刺骨)
- python 闭包
- Python延迟打印字符
- Python 多线程编程threading模块
- python中函数参数,函数调用参数传递,可变参数,*expression,**expression
- python算法——第四天
- Python基本语法
- Python――几款流行ORM框架(SQLAlchemy ,Django ORM)
- python多线程与多进程 超简单使用
- 基于python unitest架构的接口自动化监控
- 使用python打印所有汉字
- Python常用lib
- Python获取目录、文件的注意事项
- 45. Jump Game II leetcode python 2016 new season
- Python 基础【二】 上
- 《Python项目开发实战》--熟悉Python基础后我能做什么?
- python分布式进程
- Python -- collection 系列
- Python 字符编码学习-ascii编码,Unicode和UTF-8之间的关系