1

我正在尝试Force.com Streaming API 演示,但出现以下错误:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body><soapenv:Fault>
        <faultcode>UNKNOWN_EXCEPTION</faultcode>
        <faultstring>UNKNOWN_EXCEPTION: Element type &quot;soapenv:Envelope&quot; must be followed by either attribute specifications, &quot;&gt;&quot; or &quot;/&gt;&quot;.   </faultstring>
        <detail>
            <sf:UnexpectedErrorFault xsi:type="sf:UnexpectedErrorFault">   
                <sf:exceptionCode>UNKNOWN_EXCEPTION</sf:exceptionCode>
                <sf:exceptionMessage>Element type &quot;soapenv:Envelope&quot; must be followed by either attribute specifications, &quot;&gt;&quot; or &quot;/&gt;&quot;.</sf:exceptionMessage>
            </sf:UnexpectedErrorFault>  
        </detail> 
    </soapenv:Fault></soapenv:Body>
</soapenv:Envelope>
4

1 回答 1

1

第 22 行有一个错位的双引号,您的编译器没有捕捉到它。

替换此代码:

private static final String ENV_START =
"
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
         + "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " +
         "xmlns:urn='urn:partner.soap.sforce.com'><soapenv:Body>";

使用此代码:

private static final String ENV_START =
    "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'"
    + "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " +
         "xmlns:urn='urn:partner.soap.sforce.com'><soapenv:Body>";
于 2013-08-16T04:48:35.793 回答