- 浏览: 863455 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
hzw2312:
C = sin(MLatA)*sin(MLatB)*cos(M ...
根据地球上任意两点的经纬度计算两点间的距离 -
zhang_sun:
rewind方法的limit又是多少呢?等于capacity? ...
ByteBuffer的flip,clear及rewind区别 -
kalogen:
一种每次都获取到不同的随机数的办法int ranseed=12 ...
J2ME中Random类的使用 -
kalogen:
估计部署在某个端口下吧,仔细检查一下发布的配置文件
Tomcat负载均衡和集群环境的搭建 -
zhuchao_ko:
文件大点就嗝屁了~~~
Axis 1.4 上传二进制文件(base64Binary)
服务端代码:
Java代码
package samples.userguide.example5;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class BinaryServer {
public void saveImage(String filename, byte[] image) throws IOException {
String dir = "D:/workspace-java/axis1/web/WEB-INF/classes/samples/userguide/example5/";
if (image != null && image.length > 0) {
FileOutputStream output = new FileOutputStream(new File(dir
+ filename));
output.write(image);
output.flush();
output.close();
}
}
}
package samples.userguide.example5;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class BinaryServer {
public void saveImage(String filename, byte[] image) throws IOException {
String dir = "D:/workspace-java/axis1/web/WEB-INF/classes/samples/userguide/example5/";
if (image != null && image.length > 0) {
FileOutputStream output = new FileOutputStream(new File(dir
+ filename));
output.write(image);
output.flush();
output.close();
}
}
} 配置deploy.wsdl文件,由于byte[]是axis默认支持的,因此不需要额外的配置。
Xml代码
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="BinaryServer" provider="java:RPC">
<parameter name="className" value="samples.userguide.example5.BinaryServer"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="BinaryServer" provider="java:RPC">
<parameter name="className" value="samples.userguide.example5.BinaryServer"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>运行发布描述文件命令:
Cmd代码
D:\workspace-java\axis\web\WEB-INF>java -classpath %CLASSPATH% org.apache.axis.client.AdminClient -l http://localhost:8080/axis/services/BinaryServer deploy.wsdd
D:\workspace-java\axis\web\WEB-INF>java -classpath %CLASSPATH% org.apache.axis.client.AdminClient -l http://localhost:8080/axis/services/BinaryServer deploy.wsdd
客户端代码:
Java代码
package samples.userguide.example5;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
public class BinaryClient {
public static void main(String[] args) throws ServiceException, IOException {
String url = "http://localhost:8080/axis/services/BinaryServer";
String dir = BinaryClient.class.getResource(".").getFile().toLowerCase();
System.out.println(dir);
// System.exit(0);
FileInputStream input = new FileInputStream(new File(dir+"Desert.jpg"));
byte [] image = new byte[input.available()];
input.read(image);
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
org.apache.axis.client.Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
javax.xml.namespace.QName qn = new javax.xml.namespace.QName("BinaryServer","saveImage");
call.setOperationName(qn);
call.addParameter("arg0", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter("arg1", org.apache.axis.encoding.XMLType.SOAP_BASE64BINARY, javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.AXIS_VOID);
Object[] args1 = new Object[]{"desert1.jpg",image};
call.invoke(args1);
input.close();
}
}
package samples.userguide.example5;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
public class BinaryClient {
public static void main(String[] args) throws ServiceException, IOException {
String url = "http://localhost:8080/axis/services/BinaryServer";
String dir = BinaryClient.class.getResource(".").getFile().toLowerCase();
System.out.println(dir);
// System.exit(0);
FileInputStream input = new FileInputStream(new File(dir+"Desert.jpg"));
byte [] image = new byte[input.available()];
input.read(image);
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
org.apache.axis.client.Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
javax.xml.namespace.QName qn = new javax.xml.namespace.QName("BinaryServer","saveImage");
call.setOperationName(qn);
call.addParameter("arg0", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter("arg1", org.apache.axis.encoding.XMLType.SOAP_BASE64BINARY, javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.AXIS_VOID);
Object[] args1 = new Object[]{"desert1.jpg",image};
call.invoke(args1);
input.close();
}
} 运行测试,OK。确实上传成功。
Java代码
package samples.userguide.example5;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class BinaryServer {
public void saveImage(String filename, byte[] image) throws IOException {
String dir = "D:/workspace-java/axis1/web/WEB-INF/classes/samples/userguide/example5/";
if (image != null && image.length > 0) {
FileOutputStream output = new FileOutputStream(new File(dir
+ filename));
output.write(image);
output.flush();
output.close();
}
}
}
package samples.userguide.example5;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class BinaryServer {
public void saveImage(String filename, byte[] image) throws IOException {
String dir = "D:/workspace-java/axis1/web/WEB-INF/classes/samples/userguide/example5/";
if (image != null && image.length > 0) {
FileOutputStream output = new FileOutputStream(new File(dir
+ filename));
output.write(image);
output.flush();
output.close();
}
}
} 配置deploy.wsdl文件,由于byte[]是axis默认支持的,因此不需要额外的配置。
Xml代码
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="BinaryServer" provider="java:RPC">
<parameter name="className" value="samples.userguide.example5.BinaryServer"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="BinaryServer" provider="java:RPC">
<parameter name="className" value="samples.userguide.example5.BinaryServer"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>运行发布描述文件命令:
Cmd代码
D:\workspace-java\axis\web\WEB-INF>java -classpath %CLASSPATH% org.apache.axis.client.AdminClient -l http://localhost:8080/axis/services/BinaryServer deploy.wsdd
D:\workspace-java\axis\web\WEB-INF>java -classpath %CLASSPATH% org.apache.axis.client.AdminClient -l http://localhost:8080/axis/services/BinaryServer deploy.wsdd
客户端代码:
Java代码
package samples.userguide.example5;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
public class BinaryClient {
public static void main(String[] args) throws ServiceException, IOException {
String url = "http://localhost:8080/axis/services/BinaryServer";
String dir = BinaryClient.class.getResource(".").getFile().toLowerCase();
System.out.println(dir);
// System.exit(0);
FileInputStream input = new FileInputStream(new File(dir+"Desert.jpg"));
byte [] image = new byte[input.available()];
input.read(image);
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
org.apache.axis.client.Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
javax.xml.namespace.QName qn = new javax.xml.namespace.QName("BinaryServer","saveImage");
call.setOperationName(qn);
call.addParameter("arg0", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter("arg1", org.apache.axis.encoding.XMLType.SOAP_BASE64BINARY, javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.AXIS_VOID);
Object[] args1 = new Object[]{"desert1.jpg",image};
call.invoke(args1);
input.close();
}
}
package samples.userguide.example5;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
public class BinaryClient {
public static void main(String[] args) throws ServiceException, IOException {
String url = "http://localhost:8080/axis/services/BinaryServer";
String dir = BinaryClient.class.getResource(".").getFile().toLowerCase();
System.out.println(dir);
// System.exit(0);
FileInputStream input = new FileInputStream(new File(dir+"Desert.jpg"));
byte [] image = new byte[input.available()];
input.read(image);
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
org.apache.axis.client.Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
javax.xml.namespace.QName qn = new javax.xml.namespace.QName("BinaryServer","saveImage");
call.setOperationName(qn);
call.addParameter("arg0", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter("arg1", org.apache.axis.encoding.XMLType.SOAP_BASE64BINARY, javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.AXIS_VOID);
Object[] args1 = new Object[]{"desert1.jpg",image};
call.invoke(args1);
input.close();
}
} 运行测试,OK。确实上传成功。
发表评论
-
log4j配置输出hibernate执行的SQL和相应参数以及打印结果
2017-09-01 20:26 5411hibernate的配置文件:hibernate.prope ... -
使用Gson将对象类转成Json对象时出现\u003d的问题
2015-11-03 17:07 3870Gson将对象转成Json对象的方法 ... -
maven pom.xml加载不同properties配置
2015-10-30 11:52 12051.pom.xml =================== ... -
剖析淘宝TDDL(TAOBAO DISTRIBUTE DATA LAYER)
2015-10-19 19:03 653剖析淘宝 TDDL ( TAOBAO DISTRIBUTE ... -
"org.eclipse.wst.validation" has been removed
2015-10-15 11:22 1133从SVN服务器上导出maven工程遇到的问题," ... -
mysql/Java服务端对emoji的支持
2015-09-19 10:43 812前言: 最近开发的iOS项目因为需要用户文本的存储,自然就 ... -
Ehcache配置详解及CacheManager使用
2015-04-09 14:40 1943<?xml version="1.0&quo ... -
详解 Too many open files
2014-09-07 00:25 1185运行在Linux系统上的Java程序可能会出现" ... -
Could not find jar tool executable问题解决
2014-03-21 00:28 1214eclipse 中,在用PROGUARD生成混淆包Obfus ... -
eclipse不小心删除了代码文件的一个解决办法
2013-08-15 17:02 1246平时用eclipse写代码,不小心删除了一个文件,一般就找不回 ... -
关于ProGuard的学习了解
2012-09-20 09:51 1357在Android项目中用到JNI, ... -
Java实现MD5加密
2012-08-23 23:32 1040import java.io.UnsupportedEnco ... -
叫你怎么下载开源代码,例如:hg clone https://gtalksms.googlecode.com/hg/ gtalksms .
2012-07-04 17:29 1590svn的就不说了,git的也不说了,这些都是常用的,直说hg ... -
Java NIO与IO 区别和比较
2012-06-17 11:20 1422本文将通过一些实例来 ... -
jar打包出现java.io.IOException: invalid header field 解决方案
2012-06-10 12:10 4773执行: D:\aaa\DMDemo>jar -cvfm ... -
java内存原型分析-基本知识
2012-06-06 13:53 740java虚拟机内存原型寄存 ... -
java InputStream读取数据问题
2012-05-21 15:45 9341. 关于InputStream.read() 在从数 ... -
java读取文件夹下的所有文件夹和文件
2012-05-15 10:46 1108package com.borland.samples.wel ... -
Java中yield(),sleep()以及wait()的区别
2012-05-08 11:03 713往往混淆了这三个函数的使用。 从操作系统的角度讲,os会维护一 ... -
Netbeans 7和Subversion(svn) 1.7
2012-05-02 23:07 2031Netbeans的SVN插件,最后一次更新是07年了,所以它根 ...
相关推荐
axis1.4和axis2相关jar文件,axis1.4和axis2相关jar文件
axis1.4完整包下载Apache Axis是一种SOAP(简单对象访问协议”)实现。 包含 Axis1.4的所有完整包。
axis1.4生成客户端 根据WSDL生成客户端和服务端
springboot 集成axis1.4的webservice,该为maven的工程
Axis1.4如何实现头部鉴权(包括实现类模板)
内有axis1.4jar包以及使用eclipse和axis1.4 将WSDL和服务端代码互转方法 亲测可用
用于axis1.4开发webService。 文件包含,axis1.4.ZIP以及其他所需jar包,和生成webservice客户端,生成webService服务端发布 的详细教程说明。
axis1.4生成访问客户端代码
Axis1.4从服务端到客户端图文攻略,同时附赠Axis1.4 Jar包。 本攻略经过多次测试可靠耐用,并同时带有详细的文字说明,保证一学就会!从现在起axis不再是问题!让你爱上web service!
axis1.4的帮助文档,WEBService发布必备产品。
Axis1.4开发指南 介绍Axis1.4的开发方式,并附上不少范例代码
Axis1.4开发指南.pdf axis-bin-1_4.zip axis相关文档 axis1.4 开发jar包
Spring boot 集成Axis1.4 ,使用wsdd文件发布webservice
axis1.4学习示例(详细步骤说明)axis1.4
webservice axis1.4服务搭建
webservice4 二进制文件读取 webservice4 二进制文件读取
1. 将lib包下的所有的jar包,添加到classpath中。 2. 运行命令: ... -u 要访问的webservice的地址标准的wsdl文件 -p 生成java文件的包名 -t 生成的java文件中包含junit的测试代码。 详见文档。
本方法是用axis1.4技术,实现java客户端调用webservice。已经可实现过可行的,如果不行可加我QQ号302633进行详细解析。
axis1.4 webservice个人学习笔记