1.

 package com.glodon.gspm.adapter.plugin.common;

 import lombok.SneakyThrows;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.message.SOAPBodyElement;
import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.message.SOAPHeaderElement;
import org.w3c.dom.NodeList; import javax.xml.namespace.QName;
import java.net.URL;
import java.util.Map; /**
* webService工具类
* Created by shijl-a on 2017/4/16.
*/
public class AxisUtil { private AxisUtil() {
throw new IllegalStateException("Util class.");
} private static final int WS_TIMEOUT = 30000; private static final String NS = "http://tempuri.org/"; @SneakyThrows
public static String invokeGeps(String webServiceUrl, String serviceName, Map<String, ?> args, String userName, String password) { SOAPEnvelope soapEnvelope = new SOAPEnvelope();
Service service = new Service();
Call call = (Call) service.createCall();
call.setTimeout(WS_TIMEOUT);
call.setTargetEndpointAddress(new URL(webServiceUrl)); QName serviceQName = new QName(NS, serviceName);
QName credentialQName = new QName(NS, "ServiceCredential"); call.setOperationName(serviceQName);
call.setUseSOAPAction(true);
call.setSOAPActionURI(NS + serviceName); SOAPHeaderElement header = new SOAPHeaderElement(credentialQName);
header.addChildElement("User").setValue(userName);
header.addChildElement("Password").setValue(password); soapEnvelope.addHeader(header); SOAPBodyElement bodyElement = new SOAPBodyElement(serviceQName); for (Map.Entry<String, ?> item : args.entrySet()) {
bodyElement.addChildElement(item.getKey()).setValue(item.getValue().toString());
} soapEnvelope.addBodyElement(bodyElement); SOAPEnvelope result = call.invoke(soapEnvelope);
NodeList nodes = result.getElementsByTagName(serviceName + "Result");
if (null != nodes && nodes.getLength() > 0 && null != nodes.item(0).getFirstChild()) {
return nodes.item(0).getFirstChild().getNodeValue();
}
return "";
}
}

13.AxisUtil的更多相关文章

  1. TechEmpower 13轮测试中的ASP.NET Core性能测试

    应用性能直接影响到托管服务的成本,因此公司在开发应用时需要格外注意应用所使用的Web框架,初创公司尤其如此.此外,糟糕的应用性能也会影响到用户体验,甚至会因此受到相关搜索引擎的降级处罚.在选择框架时, ...

  2. .NET平台开源项目速览(13)机器学习组件Accord.NET框架功能介绍

    Accord.NET Framework是在AForge.NET项目的基础上封装和进一步开发而来.因为AForge.NET更注重与一些底层和广度,而Accord.NET Framework更注重与机器 ...

  3. 转:ORA-15186: ASMLIB error function = [asm_open], error = [1], 2009-05-24 13:57:38

    转:ORA-15186: ASMLIB error function = [asm_open], error = [1], 2009-05-24 13:57:38http://space.itpub. ...

  4. IIS启动失败,启动Windows Process Activation Service时,出现错误13:数据无效 ;HTTP 错误 401.2 - Unauthorized 由于身份验证头无效,您无权查看此页

    因为修改过管理员账号的密码后重启服务器导致IIS无法启动,出现已下异常 1.解决:"启动Windows Process Activation Service时,出现错误13:数据无效&quo ...

  5. CSharpGL(13)用GLSL实现点光源(point light)和平行光源(directional light)的漫反射(diffuse reflection)

    CSharpGL(13)用GLSL实现点光源(point light)和平行光源(directional light)的漫反射(diffuse reflection) 2016-08-13 由于CSh ...

  6. ABP(现代ASP.NET样板开发框架)系列之13、ABP领域层——数据过滤器(Data filters)

    点这里进入ABP系列文章总目录 基于DDD的现代ASP.NET开发框架--ABP系列之13.ABP领域层——数据过滤器(Data filters) ABP是“ASP.NET Boilerplate P ...

  7. 推荐13款javascript模板引擎

    javaScript 在生成各种页面内容时如果能结合一些模板技术,可以让逻辑和数据之间更加清晰,本文介绍 X 款 JavaScript 的模板引擎.(排名不分先后顺序) 1. Mustache 基于j ...

  8. ASP.NET Core 中文文档 第三章 原理(13)管理应用程序状态

    原文:Managing Application State 作者:Steve Smith 翻译:姚阿勇(Dr.Yao) 校对:高嵩 在 ASP.NET Core 中,有多种途径可以对应用程序的状态进行 ...

  9. C#开发微信门户及应用(13)-使用地理位置扩展相关应用

    本文继续上一篇<C#开发微信门户及应用(12)-使用语音处理>,继续介绍微信的相关应用.我们知道,地理位置信息可以用来做很多相关的应用,除了我们可以知道用户所在的位置,还可以关联出一些地理 ...

随机推荐

  1. 【UVA 437】The Tower of Babylon(拓扑排序+DP,做法)

    [Solution] 接上一篇,在处理有向无环图的最长链问题的时候,可以在做拓扑排序的同时,一边做DP; 设f[i]表示第i个方块作为最上面的最高值; f[y]=max(f[y],f[x]+h[y]) ...

  2. 11 hbase源码系列(十一)Put、Delete在服务端是如何处理

    hbase源码系列(十一)Put.Delete在服务端是如何处理?    在讲完之后HFile和HLog之后,今天我想分享是Put在Region Server经历些了什么?相信前面看了<HTab ...

  3. [Poi] Customize Babel to Build a React App with Poi

    Developing React with Poi is as easy as adding the babel-preset-react-appto a .babelrc and installin ...

  4. 网络project1101班2014-2015学年《网络软件开发实训》期末考试

    注意事项: *考试时间:2014年11月20日 第5.6节. *在计算机D盘,新建目录.并命名"学号+姓名".如:(称为考生目录.下同).考试中全部文件必须保存在此目录下. *启动 ...

  5. 怎样使Dialog像Activity一样随心所欲的使用?

    怎样使Dialog像Activity一样随心所欲的使用? android中的Dialog像是寄生在Activity中.在弹出Dialog时.因受到系统风格定义,导致Dialog怎么也不能如意,那么今天 ...

  6. POJ 3626 BFS

    思路:easy BFS //By SiriusRen #include <queue> #include <cstdio> #include <algorithm> ...

  7. BZOJ 3631 链剖+差分

    思路: 1.树链剖分+用带标记的线段树维护操作(复杂度O(nlog2n)) 2.树链剖分LCA(TarjanLCA等各种LCA)+差分 复杂度(O(n)->O(nlogn)之间) 下面就说说怎么 ...

  8. vue.js中compted与model的区别

    在p便签内写的{{reversemessage}}方法,若js里对应的函数为computed则不需要加上括号 若js里对应的函数为model则应该将{{reversemessage}}改为{{reve ...

  9. 搭建专属于自己的Leanote云笔记本

    搭建专属于自己的Leanote云笔记本 Leanote 依赖 MongoDB 作为数据存储,下面开始安装 MongoDB: 下载 MongoDB 进入 /home 目录,并下载 MongoDB: cd ...

  10. Nginx模型 & 惊群问题

    这篇写的不错 http://www.cnblogs.com/linguoguo/p/5511293.html Nginx为啥性能高-多进程异步IO模型 1. 对于每个worker进程来说,独立的进程, ...