分析xml soap响应时Postman测试失败

分析xml soap响应时Postman测试失败,soap,postman,Soap,Postman,我正在使用POSTMAN发送SOAP请求,下面是我收到的soapenv响应。我想测试我的邮递员测试中收到的以下值,但邮递员测试失败,有人能建议在这里做什么吗 LicStatus <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:schemas.general.com.au:api:other"> <soapenv:Header xmlns:

我正在使用POSTMAN发送SOAP请求,下面是我收到的
soapenv
响应。我想测试我的邮递员测试中收到的以下值,但邮递员测试失败,有人能建议在这里做什么吗

LicStatus

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:schemas.general.com.au:api:other">
    <soapenv:Header xmlns:urn="urn:schemas.general.com.au:api:other" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
        <header xmlns:urn="urn:schemas.general.com.au:api:other" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://schemas.cordys.com/General/1.0/">
            <msg-id>005056B9-3921-A1E9-A327-64509F7362DC</msg-id>
            <messageoptions noreply="true"/>
        </header>
    </soapenv:Header>
    <soapenv:Body>
        <getSupplierDataResponse xmlns:urn="urn:schemas.general.com.au:api:other" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:schemas.general.com.au:api:other" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns6="http://schemas.cordys.com/default_005056B9-5D92-A1E9-904D-128C719CE2DD" xmlns:ns5="http://schemas.cordys.com/casemanagement/1.0" xmlns:ns4="http://schemas.XXTGGHG.org/2004/07/STRD.Models" xmlns:ns3="urn:schemas.general.com.au:canonical:technical:v1" xmlns:ns2="urn:schemas.general.com.au:api:other" xmlns:bpm="http://schemas.cordys.com/default" xmlns:sm="http://www.w3.org/2005/07/scxml" xmlns:instance="http://schemas.cordys.com/bpm/instance/1.0">
            <CustomerData>
                <DateLicenceExpires>28/01/2020</DateLicenceExpires>
                <Demonstration_Method>Certification</Demonstration_Method>
                <AuditLastAuditDate>05/03/2018</AuditLastAuditDate>
                <AuditOutcome>Non Compliance</AuditOutcome>
                <HeadOfficeRegion/>
                <ScopeOfLicencing>YES</ScopeOfLicencing>
                <LicStatus>Licensed</LicStatus>   
            </CustomerData>
            <OperationResult xmlns="urn:schemas.general.com.au:canonical:technical:v1">
                <Status>00</Status>
                <StatusMessage>Success</StatusMessage>
            </OperationResult>
        </getSupplierDataResponse>
    </soapenv:Body>
</soapenv:Envelope>

试着这样做:

pm.test('Verify the LicStatus', function() {
    var xmlTree = xml2Json(responseBody);
    var licenseStatus = xmlTree['soapenv:Envelope']['soapenv:Body'].getSupplierDataResponse.CustomerData.LicStatus;

    pm.expect(licenseStatus).to.eql("Licensed");
})

试着这样做:

pm.test('Verify the LicStatus', function() {
    var xmlTree = xml2Json(responseBody);
    var licenseStatus = xmlTree['soapenv:Envelope']['soapenv:Body'].getSupplierDataResponse.CustomerData.LicStatus;

    pm.expect(licenseStatus).to.eql("Licensed");
})

您从哪里获得
结果[0]
?通过查看响应,我会认为
responseJson.CustomerData.LicStatus
会更接近您所需要的。执行
console.log('responseJson')
时,您会看到什么?您从哪里获得
结果[0]
?通过查看响应,我会认为
responseJson.CustomerData.LicStatus
会更接近您所需要的。执行
console.log('responseJson')
时会看到什么?