我正在使用 Postman 来测试使用XML格式的HTTP-POST请求。响应机构在 Postman 窗口中表现良好,200 响应成功。

但是,当我尝试使用xml2Json方法从响应中提取节点值时,它返回一个未定义的对象。我试图找到是否有人遇到类似问题,但没有找到任何问题。

下面是测试脚本。

测试:

var jsonObject = xml2Json(responseBody);
console.log("jsonObject is : ",jsonObject);

==============
Console Output:
jsonObject is :  undefined

Response example:
--uuid:960b8c52-9c48-4302-b7d6-88a21828a01a
Content-Id: 
<rootpart*960b8c52-9c48-4302-b7d6-88a21828a01a@example.jaxws.sun.com>
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary

    <?xml version='1.0' encoding='UTF-8'?>
    <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
        <S:Body>
            <ns2:setFavoriteResponse xmlns:ns2="http://confidential">
                <favoriteID>25316981</favoriteID>
            </ns2:setFavoriteResponse>
        </S:Body>
    </S:Envelope>
--uuid:960b8c52-9c48-4302-b7d6-88a21828a01a--