【问题标题】:Reserved Word Error XML保留字错误 XML
【发布时间】:2015-02-11 06:39:11
【问题描述】:

我有一个简单地检查帐户余额的 SOAP 请求。

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:tns="urn:someurn">
<SOAP-ENV:Body>
<Execute xmlns="">
<sessionId xmlns="">SomeSessionID</sessionId>
<username xmlns="">SomeUserName</username>
<password xmlns="">SomePassword</password>
<command xmlns="">CommandName</command>
<data xmlns=""><?xml version="1.0"?><meta><accountNo></accountNo></meta>   
</data>
</Execute>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

每当我提出请求时,都会发生此错误,我已经阅读了一些关于此的堆栈问题,我需要清除我已经完成的空格,我还尝试使用 html 实体作为问号仍然无济于事。

错误是:XML error parsing SOAP payload on line 14: Reserved XML Name which is the data tag。

有人可以帮我吗?另外,我正在使用 Java 向服务器发出请求。

【问题讨论】:

    标签: java xml web-services soap nusoap


    【解决方案1】:

    第 14 行是

    <data xmlns=""><?xml version="1.0"?><meta><accountNo></accountNo></meta>   
    

    除了第一行之外,XML 中的任何位置都不能有 xml 标头(&lt;?xml...?&gt; 标记)。您必须使用实体对 &lt;data&gt;...&lt;/data&gt; 中的所有内容进行编码,如下所示:

    <data xmlns="">&lt;?xml version="1.0"?&gt;&lt;meta&gt; ...
    

    【讨论】:

      猜你喜欢
      • 2019-06-04
      • 1970-01-01
      • 1970-01-01
      • 2020-01-22
      • 2019-03-05
      • 2019-03-28
      • 2018-02-03
      • 1970-01-01
      • 2017-07-31
      相关资源
      最近更新 更多