SOAP-空主体

时间:2018-06-29 18:23:29

标签: java http soap

enter image description here具有我无法解析为NodeList的SOAP响应。

    <?xml version="1.0" encoding="UTF-8" standalone="no"?> 
    <soap-env:Envelope 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">
        <soap-env:Body>
            <s0:response xmlns:s0="urn:company.processing.messages">
                <newOutput>
                    <messageType>OKAY</messageType>
                    <messageCode>00000000</messageCode>
                    <messageText>SUCCESSFUL</messageText>
                </newOutput>
            </s0:response>
        </soap-env:Body> 
    </soap-env:Envelope>

返回NullPointerException:

SOAPMessage soapMessage = ((SaajSoapMessage) messageContext.getResponse()).getSaajMessage();
NodeList nodeList = soapMessage.getSOAPBody().getChildNodes().item(0).getFirstChild().getChildNodes();

我猜这封邮件的格式有问题,但无法弄清楚到底是什么错误。

1 个答案:

答案 0 :(得分:0)

问题出在XML格式上。解决。