您的位置:首页 > 产品设计 > UI/UE

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");
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐