Soap: The root element is required in a well-formed document.
2011-09-26 13:56
459 查看
当soap请求出现如下错误的时候:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server.generalException</faultcode>
<faultstring>org.xml.sax.SAXParseException: The root element is required in a well-formed document. Message being parsed: </faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
是因为soap的请求没有明确写出请求包的长度,使server端不能完整读取请求包,server端便错误的认为请求的xml文件不完整。
只要明确的写上请求包得长度即可,java代码如下:
out.println("Content-Length: 257");
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server.generalException</faultcode>
<faultstring>org.xml.sax.SAXParseException: The root element is required in a well-formed document. Message being parsed: </faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
是因为soap的请求没有明确写出请求包的长度,使server端不能完整读取请求包,server端便错误的认为请求的xml文件不完整。
只要明确的写上请求包得长度即可,java代码如下:
out.println("Content-Length: 257");
相关文章推荐
- The markup in the document following the root element must be well-formed
- The markup in the document following the root element must be well-formed. Quartz.xml .......
- 解决The markup in the document following the root element must be well-formed.
- The markup in the document preceding the root element must be well-formed
- spring配置文件报错:the markup in the document preceding the root element must be well-formed
- the markup in the document preceding the root element must be well-formed
- JSF简单实例及无法正常访问的解决方法(404和The markup in the document preceding the root element must be well-formed. )
- 编写xml文件时,The markup in the document preceding the root element must be well-formed.等bug
- Caused by: org.xml.sax.SAXParseException; systemId: file:/home/hadoop/hive-0.12.0/conf/hive-site.xml; lineNumber: 5; columnNumber: 2; The markup in the document following the root element must be well
- The markup in the document following the root element must be well-formed.
- org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-fo
- org.xml.sax.SAXParseException: The markup in the document following the root element must be well-fo
- Weblogic发布小问题——The root element weblogic-web-app is missing in the descriptor file
- 关于xml配置文件无元素提示和the root element of the document is not <xsd:schema>.错误
- White space is required before the attribute type in the declaration of attribute "t" for element "b
- ReactJs 报错 Element type is invalid: expected a string (from built-in components) or a class/function (for composite components) but got: undefined. Check the render method of `Me`.
- The installer is unable to run in graphical mode: required operating system packages for Linux
- The type java.lang.reflect.AnnotatedElement cannot be resolved. It is indirectly referenced from required .class files
- .net邮件错误 :The specified string is not in the form required for a subject.
- RunningMapReduceExampleTFIDF - hadoop-clusternet - This document describes how to run the TF-IDF MapReduce example against ascii books. - This project is for those who wants to experiment hadoop as a skunkworks in a small cluster (1-10 nodes) - Google Pro