AXIS2调用web service,返回结果用GZIP解压缩
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.zip.GZIPInputStream; import javax.xml.namespace.QName; import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient; public class Test3 { public static void main(String[] args) throws IOException {
RPCServiceClient serviceClient = new RPCServiceClient();
Options options = serviceClient.getOptions();
EndpointReference targetRPR = new EndpointReference(
"http://..../LoginWebService.asmx");
options.setTo(targetRPR);
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
//参数
Object[] opArgs = new Object[]{"test", "123456"};
QName opEntry = new QName("http://tempuri.org/", "doctorLogin", "ns1");
byte[] gzpdata = (byte[])serviceClient.invokeBlocking(opEntry, opArgs, new Class[]{byte[].class})[0];//第三个参数为返回类型,保存为字节数组 GZIPInputStream gzip = new GZIPInputStream(new ByteArrayInputStream(gzpdata));
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buffer = new byte[256];
int n;
while ((n = gzip.read(buffer)) >= 0) {
out.write(buffer, 0, n);
}
System.out.println(out.toString());
}
}
AXIS2调用web service,返回结果用GZIP解压缩的更多相关文章
- php5调用web service
工作中需要用php调用web service接口,对php不熟,上网搜搜,发现关于用php调用web service的文章也不多,不少还是php4里用nusoap这个模块调用的方法,其实php5里已经 ...
- 使用Android应用调用Web Service
Java本身提供了丰富的Web Service支持,比如Sun公司指定的JAX-WS 2规范,还有Apache开源组织所提供的Axis1.Axis2.CXF等,这些技术不仅可以用于非常方便地对外提 ...
- php5调用web service (笔者测试成功)
转自:http://www.cnblogs.com/smallmuda/archive/2010/10/12/1848700.html 感谢作者分享 工作中需要用php调用web service接口, ...
- Java 调用Web service 加入认证头(soapenv:Header)
前言 有时候调用web service 会出现 Message does not conform to configured policy [ AuthenticationTokenPolicy(S) ...
- Eclipse+tomcat+axis2进行web service部署
用Eclipse+axis2+tomcat进行web service部署 2016-12-07 目录 1 安装JDK 1.1 下载JDK 1.2 安装和配置JDK 1.3 验证2 安装Ecli ...
- ORACLE存储过程调用Web Service
1. 概述 最近在ESB项目中,客户在各个系统之间的服务调用大多都是在oracle存储过程中进行的,本文就oracle存储过程调用web service来进行说明.其他主流数据库,比如mysql和sq ...
- C#开发和调用Web Service
http://blog.csdn.net/h0322/article/details/4776819 1.1.Web Service基本概念 Web Service也叫XML Web Service ...
- 通过ksoap2-android来调用Web Service操作的实例
import java.io.IOException; import org.ksoap2.SoapEnvelope;import org.ksoap2.serialization.SoapObjec ...
- ASP.NET调用Web Service
1.1.Web Service基本概念 Web Service也叫XML Web Service WebService是一种可以接收从Internet或者Intranet上的其它系统中传递过来的请求, ...
随机推荐
- oracle 多表查询
1.注意点 在查询过程中,不确定数据库表中的数据量,先查询数据量,数据量较大,则不能直接查询(select * from emp),如果数据量较大,直接查询容易造成死机或者数据读取较慢,如果较小可以查 ...
- Java的访问控制
类内部 本包(实例.类变量和方法) 子类(任何位置) 外部包(实例.类变量和方法) public √ √ √ √ protected √ √ √ × default ...
- PHP学习(五)----jQuery和JSON数据
对于jQuery: jQuery 是一个 JavaScript 库. jQuery 极大地简化了 JavaScript 编程.
- anti-pattern - Hard coding
https://en.wikipedia.org/wiki/Hard_coding Considered an anti-pattern, hard coding requires the progr ...
- 关于Java中File的renameTo函数
先看Java编程实战经典中的一道习题: 编写程序,程序运行时输入目录名称,并把该目录下的所有文件名后缀修改成.txt. 按照题意,我在d盘新建了文件夹test,并在该文件夹下新建了一个文件file.d ...
- java CyclicBarrier
import java.io.IOException; import java.util.Random; import java.util.concurrent.BrokenBarrierExcept ...
- The Producer-Consumer Relationship Version 2
Listing -. The Producer-Consumer Relationship Version public class PC { public static void main(Stri ...
- ubuntu下c/c++开发环境配置
刚转好的UBUNTU14.04.01 TLS . 试了一下GCC,结果如下不能编译 gcc -o hello hello.cpp gcc: error trying to exec 'cc1plus' ...
- GLFW is an Open Source, multi-platform library for OpenGL
http://www.glfw.org/ http://download.csdn.net/user/hengyishu
- Mysql 按行dump出数据
mysqldump -u${user} -p${passwd} --skip-extended-insert --database ${dbname} --table ${tablename} > ...