请教webservice 报文中这样的报文怎么解析

17:33 提问
java调用webservice接口发送xml报文
1.webservice接口是axis1发布的
2.请求报文格式如下
&?xml version="1.0" encoding="gbk"?&&SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&
&SOAP-ENV:Header xmlns=""&
&sysID&SW&/sysID&
&sysPassWord&123456&/sysPassWord&
&requestTime&&/requestTime&
&currentPage&1&/currentPage&
&pageSize&2&/pageSize&
&totalNum&100&/totalNum&
&/SOAP-ENV:Header&
&SOAP-ENV:Body xmlns=""&
&KPRQQ&&/KPRQQ&
&KPRQZ&&/KPRQZ&
&RZJG&&/RZJG&
&FPDM&&/FPDM&
&FPHM&&/FPHM&
&FPLX&&/FPLX&
&/SOAP-ENV:Body&
&/SOAP-ENV:Envelope&
如果我要调用这个接口并且严格按照这个格式发送请求,需要用什么方式调用?
求大神给个实例参考。
按赞数排序
用soap协议发送这个xml数据
没有wsdl文件吗?用wsdl2java生成Java类再调用
其他相关推荐相关文章推荐
今日公司要做一个协同办公系统(OA),PC端已经完成。现在要做一个手机端网页端的。从登陆入手,需要向 服务端发送一段请求报文获取响应报文,对响应报文进行解析判断是否登录成功。
lApacheAxis下载和安装
a)下载axis2-1.6.1-war.zip,该文件用于将WebService发布到Web容器中。下载地址是:
http://axis.apache.org/a...
axis2报错:org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement...
本文使用JAX-WS2.2编译webservice,并使用HttpUrlConnection的POST方式对wsdl发送soap报文进行请求返回数据,
对错误Server returned HTTP ...
MessageContext messageContext = _call.getMessageContext();
Message reqMsg = messageContext.getReq...
根据一个wsdl的url,如(.cn/webservices/EnglishChinese.asmx?wsdl),要返回该url对应的wsdl的内容。将Inpu...
Web Services 是由xml来定义数据格式的,通过SOAP协议在各个系统平台中传输,那么接下来讨论下SOAP和WSDL的各自作用。
SOAP和WSDL对Web Service、WCF进行深入...
原文地址:http://blog.csdn.net/tropica/archive//3203892.aspx
恩,我想说的是,是不是经常有人在开发的时候,特别是和第三方有...
有时候调用web service 会出现
Message does not conform to configured policy [ AuthenticationTokenPolicy(S) ]...
他的最新文章
讲师:董晓杰
讲师:姚远
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)博客分类:
前段时间开发ACS,是基于SOAP协议的通信,一次通信过程包含多个soap报文,而且也不想普通的webserivice那样,
soap报文是自动生成的。ACS的通信的报文是硬编码编出来的,虽然能正确运行,但是实在是不雅,最近闲来无事,
想着如何用像webservice那样,用Java对象设置参数后,将对象转换成String格式的SOAP报文,这样以后程序的维护
问题就得到解决了。
然后在google中baidu了一把,找了个例子,然后开始试验了。其实程序并不难,写这个文章,主要是帮助那些直接使用SOAP
协议进行开发的朋友们参考,也给自己留个备注,呵呵。
package com.seahigh.acs.
import java.util.ArrayL
import java.util.L
import javax.xml.namespace.QN
import javax.xml.parsers.DocumentBuilderF
import javax.xml.soap.MessageF
import javax.xml.soap.SOAPB
import javax.xml.soap.SOAPE
import javax.xml.soap.SOAPE
import javax.xml.soap.SOAPE
import javax.xml.soap.SOAPF
import javax.xml.soap.SOAPH
import javax.xml.soap.SOAPM
import javax.xml.soap.SOAPP
import javax.xml.transform.OutputK
import javax.xml.transform.S
import javax.xml.transform.T
import javax.xml.transform.TransformerF
import javax.xml.transform.dom.DOMS
import javax.xml.transform.sax.SAXS
import javax.xml.transform.stream.StreamR
import org.w3c.dom.D
import org.w3c.dom.N
import org.xml.sax.InputS
* @author 汪心利
* Date 下午02:51:30
* (c)CopyRight seahigh 2010
public class SoapUtil {
public SOAPPart initSoapPart() throws SOAPException {
SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
SOAPHeader soapHeader = soapEnvelope.getHeader();
SOAPElement cwmp = soapEnvelope.addNamespaceDeclaration("cwmp",
"urn:dslforum-org:cwmp-1-0");
SOAPElement xsi = soapEnvelope.addNamespaceDeclaration("xsi",
"http://www.w3.org/2001/XMLSchema-instance");
SOAPElement xsd = soapEnvelope.addNamespaceDeclaration("xsd",
"http://www.w3.org/2001/XMLSchema");
SOAPElement enc = soapEnvelope.addNamespaceDeclaration("SOAP-ENC",
"http://schemas.xmlsoap.org/soap/encoding/");
SOAPElement id = soapHeader.addChildElement("ID", "cwmp");
id.setTextContent("1");
return soapP
public void soap2String(Source source) throws Exception {
if (source != null) {
Node root =
if (source instanceof DOMSource) {
root = ((DOMSource) source).getNode();
} else if (source instanceof SAXSource) {
InputSource inSource = ((SAXSource) source).getInputSource();
DocumentBuilderFactory dbf = DocumentBuilderFactory
.newInstance();
dbf.setNamespaceAware(true);
Document doc = dbf.newDocumentBuilder().parse(inSource);
root = (Node) doc.getDocumentElement();
Transformer transformer = TransformerFactory.newInstance()
.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.transform(new DOMSource(root), new StreamResult(
System.out));
public Source informResponse(SOAPPart part) throws Exception {
SOAPEnvelope soapEnvelope = part.getEnvelope();
SOAPBody soapBody = soapEnvelope.getBody();
SOAPElement informRes = soapBody.addChildElement("InformResponse",
SOAPElement max = SOAPFactory.newInstance().createElement(
"MaxEnvelopes", "", "");
max.setTextContent("1");
informRes.addChildElement(max);
return part.getContent();
public Source getParameterValues(SOAPPart part, List list) throws Exception {
SOAPEnvelope soapEnvelope = part.getEnvelope();
SOAPBody soapBody = soapEnvelope.getBody();
SOAPElement informRes = soapBody.addChildElement("GetParameterValues",
SOAPFactory soapFactory = SOAPFactory.newInstance();
SOAPElement names = soapFactory.createElement("ParameterNames", "", "");
names.addAttribute(new QName("SOAP-ENC:arrayType"), "xsd:string["
+ list.size() + "]");
SOAPElement nameElement =
for (int i = 0; i & list.size(); i++) {
nameElement = soapFactory.createElement("string", "", "");
nameElement.setTextContent((String) list.get(i));
names.addChildElement(nameElement);
informRes.addChildElement(names);
return part.getContent();
public static void main(String[] args) throws Exception {
SoapUtil util = new SoapUtil();
SOAPPart part = util.initSoapPart();
Source inform = util.getParameterValues(part, util.getTestnames());
util.soap2String(inform);
public List&String& getTestnames() {
List&String& list = new ArrayList&String&();
list.add("InternetGatewayDevice.DeviceInfo.X_CT-COM_CPU");
list.add("InternetGatewayDevice.DeviceInfo.X_CT-COM_WorkTime");
list.add("InternetGatewayDevice.DeviceInfo.SoftwareVersion");
list.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_ReceiveNoise");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_LAN-TotalBytesReceived");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_LAN-TotalBytesSent");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_WAN-TotalBytesReceived");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_WAN-TotalBytesSent");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_LAN-TotalPacketsReceived");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_LAN-TotalPacketsSent");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_WAN-TotalPacketsReceived");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_WAN-TotalPacketsSent");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.ResponsePass");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.AskPass");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.SuccessPass");
list.add("InternetGatewayDevice.DeviceInfo.X_CT-COM_Temp");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.LAN-PacketsError");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.LAN-TotalBytesReceived");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.LAN-TotalBytesSent");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.WAN-TotalBytesReceived");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.WAN-PacketsError");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.WAN-TotalBytesSent");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.AssociatedDevice.1.X_CT-COM_ReceiveRate");
.add("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.AssociatedDevice.1.X_CT-COM_SendRate");
list.add("InternetGatewayDevice.DeviceInfo.SerialNumber");
list.add("InternetGatewayDevice.DeviceInfo.ManufacturerOUI");
这就是研究的成果了,看下结果:
对应TR069协议中的RCP Method:GetParameterValues
&?xml version="1.0" encoding="UTF-8" standalone="no"?&
&SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:cwmp="urn:dslforum-org:cwmp-1-0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&
&SOAP-ENV:Header&
&cwmp:ID&1&/cwmp:ID&
&/SOAP-ENV:Header&
&SOAP-ENV:Body&
&cwmp:GetParameterValues&
&ParameterNames SOAP-ENC:arrayType="xsd:string[27]"&
&string&InternetGatewayDevice.DeviceInfo.X_CT-COM_CPU&/string&
&string&InternetGatewayDevice.DeviceInfo.X_CT-COM_WorkTime&/string&
&string&InternetGatewayDevice.DeviceInfo.SoftwareVersion&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_ReceiveNoise&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_LAN-TotalBytesReceived&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_LAN-TotalBytesSent&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_WAN-TotalBytesReceived&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_WAN-TotalBytesSent&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_LAN-TotalPacketsReceived&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_LAN-TotalPacketsSent&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_WAN-TotalPacketsReceived&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_WAN-TotalPacketsSent&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.ResponsePass&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.AskPass&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.SuccessPass&/string&
&string&InternetGatewayDevice.DeviceInfo.X_CT-COM_Temp&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.LAN-PacketsError&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.LAN-TotalBytesReceived&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.LAN-TotalBytesSent&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.WAN-TotalBytesReceived&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.WAN-PacketsError&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_CT-COM_Stat.WAN-TotalBytesSent&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.AssociatedDevice.1.X_CT-COM_ReceiveRate&/string&
&string&InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.AssociatedDevice.1.X_CT-COM_SendRate&/string&
&string&InternetGatewayDevice.DeviceInfo.SerialNumber&/string&
&string&InternetGatewayDevice.DeviceInfo.ManufacturerOUI&/string&
&/ParameterNames&
&/cwmp:GetParameterValues&
&/SOAP-ENV:Body&
&/SOAP-ENV:Envelope&
CPE InformResponse
&?xml version="1.0" encoding="UTF-8" standalone="no"?&
&SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:cwmp="urn:dslforum-org:cwmp-1-0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&
&SOAP-ENV:Header&
&cwmp:ID&1&/cwmp:ID&
&/SOAP-ENV:Header&
&SOAP-ENV:Body&
&cwmp:InformResponse&
&MaxEnvelopes&1&/MaxEnvelopes&
&/cwmp:InformResponse&
&/SOAP-ENV:Body&
&/SOAP-ENV:Envelope&
itwangxinli
浏览: 98886 次
来自: 上海
想请教一下博主,applet可以在不B/S结构的客户端访问吗? ...
我和楼主一样~现在也工作三年了~不知楼主现在混的如何?
我用HttpClient实现,怎么让AP主动连ACS呢?
你好,我现在正在做acs服务端,可在调用cpe的downloa ...
总结的真不错,我刚入职,对这些东西稍有些体会~我用的是JSP, ...
(window.slotbydup=window.slotbydup || []).push({
id: '4773203',
container: s,
size: '200,200',
display: 'inlay-fix'2017年8月 Java大版内专家分月排行榜第三2017年4月 Java大版内专家分月排行榜第三2016年3月 Java大版内专家分月排行榜第三
匿名用户不能发表回复!|
每天回帖即可获得10分可用分!小技巧:
你还可以输入10000个字符
(Ctrl+Enter)
请遵守CSDN,不得违反国家法律法规。
转载文章请注明出自“CSDN(www.csdn.net)”。如是商业用途请联系原作者。}

我要回帖

更多关于 webservice响应报文 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信