webservice客户端添加soap Header信息
根据wsdl文件的header信息,在客户端中添加相应的header
1.wsdl信息如图
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cti="http://soap.sforce.com/schemas/class/CTIInteractionWebservice">
<soapenv:Header>
<cti:SessionHeader>
<cti:sessionId>123456</cti:sessionId>
</cti:SessionHeader>
</soapenv:Header>
<soapenv:Body>
</soapenv:Body>
</soapenv:Envelope>
2.java客户端代码
String namespace = "http://soap.sforce.com/schemas/class/Webservice"; //命名空间
String prefix = "cti"; //前缀
SOAPElement sessionHeaderElm = SOAPFactory.newInstance().createElement("SessionHeader",prefix,namespace); //SessionHeader标签
SOAPElement sessionIdElm = SOAPFactory.newInstance().createElement("sessionId",prefix,namespace); //sessionId标签
sessionIdElm.addTextNode("123456"); //内容
sessionHeaderElm.addChildElement(sessionIdElm); SOAPHeaderElement soapHeaderElement = new SOAPHeaderElement(sessionHeaderElm);
binding.setHeader(soapHeaderElement);
webservice客户端添加soap Header信息的更多相关文章
- axios添加了header信息后发送的get请求自动编程option请求了
axios添加了header信息后发送的get请求自动编程option请求了 webpack 代理转发 Provisional headers are shown 在Vue中如何使用axios跨域访问 ...
- WebService客户端添加SOAPHeader信息
通过JAXBContext创建Marshaller对头信息进行解析为dom,获取WSBindingProvider,使用Headers.creat()创建soap的Header元素: 另外就是:将us ...
- 最简单易懂的webService客户端之soap+xml请求
代码准备: 1.网络上有提供一些免费的服务器测试地址,可以上这里找一找:https://my.oschina.net/CraneHe/blog/183471 2.我选择了一个翻译地址:http://w ...
- webService 客户端调用及异常信息First Element must contain the local name, Envelope , but found definitions
报错:“First Element must contain the local name, Envelope , but found definitions”: 原因:EndpointReferen ...
- Web Services使用SOAP Header
在Web Services方法进行通信使用SOAP遵循标准的SOAP格式,该格式的一部分是在XML文档中编码的数据.XML文档包含一个Envelope根元素(由必需的Body元素和可选的Header元 ...
- webservice系统学习笔记9-使用契约优先的方式的一个服务端demo(隐式传Header信息)
服务器端: 1.编写wsdl文件 <?xml version="1.0" encoding="UTF-8" standalone="no&quo ...
- 解决.NET WebService引用后添加HTTP Header的问题
麻蛋,搜索了好久,找到的都是对soap header的操作,不是对WebService的HTTP Header的操作,这是两种不同的概念,平常我们发起的WebService请求走的都是http通信协议 ...
- 【转帖】客户端通过 HTTP 请求和响应 的 Header 信息总结
请求Header原帖地址:http://technique-digest.iteye.com/blog/1174581 响应Header原帖地址:http://blog.pfan.cn/hurongl ...
- 接口测试:添加header信息
一.获取所有学生信息的接口文档内容 二.使用postman进行测试 选择请求方式.填写URL.填写Headers下的参数值(key是Referer.value是接口文档中的value值) 三.使用jm ...
随机推荐
- DeprecatedAttribute vs. ObsoleteAttribute
定义比较 ObsoleteAttribute [SerializableAttribute] [AttributeUsageAttribute(AttributeTargets.Class | Att ...
- LeetCode题解-----Wildcard Matching
题目描述: '?' Matches any single character. '*' Matches any sequence of characters (including the empty ...
- winform 用户控件、 动态创建添加控件、timer控件、控件联动
用户控件: 相当于自定义的一个panel 里面可以放各种其他控件,并可以在后台一下调用整个此自定义控件. 使用方法:在项目上右键.添加.用户控件,之后用户控件的编辑与普通容器控件类似.如果要在后台往窗 ...
- spring3 DI基础
Spring IOC容器的依赖有两层含义:Bean依赖容器和容器注入Bean的依赖资源: Bean依赖容器:bean要依赖于容器,这里的依赖是指容器负责创建Bean并管理bean的生命周期.正是由于由 ...
- Oracle 获取当前日期及日期格式
http://blog.sina.com.cn/s/blog_6168ee920100l2ye.html Oracle 获取当前日期及日期格式 获取系统日期: SYSDATE() 格式化日期: ...
- BZOJ 1565: [NOI2009]植物大战僵尸
1565: [NOI2009]植物大战僵尸 Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 2317 Solved: 1071[Submit][Stat ...
- $.ajax()方法详解
jquery中的ajax方法参数总是记不住,这里记录一下. 1.url: 要求为String类型的参数,(默认为当前页地址)发送请求的地址. 2.type: 要求为String类型的参数,请求方式(p ...
- 监控系统Opserver的配置调试
Stack Exchange开源其监控系统Opserver有一段时间了.之前在项目中用过他们的MiniProfile来分析页面执行效率和帮助新人了解项目,当他们开源了其监控系统的时候正好部门也在关注监 ...
- 解决 node-gyp rebuild 卡住 的问题
node-gyp在编译前会首先尝试下载node的headers文件,像这样: gyp http GET https://nodejs.org/download/release/v6.8.1/node- ...
- [LeetCode] Intersection of Two Arrays II 两个数组相交之二
Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1] ...