0

i'm not able to find the text from resultDesc:

given().config(RestAssured.config().xmlConfig(xmlConfig().with().namespaceAware(false)))
        .log().all()
        .body(requestAsString)
        .when().post("/services/SubscribeMgrService")
        .then().log().all()
        .assertThat().statusCode(200)
    //            .body("ChangeOptionalOfferResultMsg/ResultHeader/ResultCode",equalTo("102023093"));
//            .body("ns2:ResultCode",equalTo("102023093"));
                .body("/soapenv:Envelope/soapenv:Body/ns4:ChangeOptionalOfferResultMsg/ResultHeader/ns2:ResultCode",equalTo("102023093"));
       

I have tried both with and with namespace but i keep getting:

XML path /soapenv:Envelope/soapenv:Body/ns4:ChangeOptionalOfferResultMsg/ResultHeader/ns2:ResultCode doesn't match.
Expected: 102023093
  Actual: <ChangeOptionalOffer161102010133The current request is duplicate with the earlier request that was received and was processed.020220215154146nullnullnullnullnull>

The actual response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
    <ns4:ChangeOptionalOfferResultMsg xmlns:ns7="http://www.amdocs.com/wsdl/bss/acctcredit" xmlns:ns6="http://www.amdocs.com/wsdl/bss/query" xmlns:ns5="http://www.amdocs.com/wsdl/bss/newsubscriber" xmlns:ns4="http://www.amdocs.com/wsdl/bss/subscribemgr" xmlns:ns3="http://www.amdocs.com/wsdl/bss/subscribe" xmlns:ns2="http://www.amdocs.com/wsdl/bss/shared">
      <ResultHeader>
        <ns2:CommandId>ChangeOptionalOffer</ns2:CommandId>
        <ns2:Version>1</ns2:Version>
        <ns2:TransactionId>6</ns2:TransactionId>
        <ns2:SequenceId>1</ns2:SequenceId>
        <ns2:ResultCode>102010133</ns2:ResultCode>
        <ns2:ResultDesc>The current request is duplicate with the earlier request that was received and was processed.</ns2:ResultDesc>
        <ns2:OrderId>0</ns2:OrderId>
        <ns2:OperationTime>20220215154146</ns2:OperationTime>
        <ns2:Reserve1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <ns2:Reserve2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <ns2:Reserve3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <ns2:TenantId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <ns2:Language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      </ResultHeader>
    </ns4:ChangeOptionalOfferResultMsg>
  </soapenv:Body>
</soapenv:Envelope>

Some links I've tried: https://github.com/rest-assured/rest-assured/wiki/Usage#xml-namespaces

and yes the below might work but i would really appreciate the ability to understand this issue at hand?

https://stackoverflow.com/questions/28298851/finding-all-xml-nodes-with-rest-assureds-xmlpath

imp
  • 435
  • 6
  • 20

1 Answers1

0

well I was forgetting about actually declaring the NS right after the .namespaceAware(true) bit

.declareNamespace("soapenv","http://schemas.xmlsoap.org/soap/envelope/")

thanks to:

https://stackoverflow.com/questions/55434178/how-to-validate-specific-node-from-soap-xml-response-with-several-namespaces-usi

imp
  • 435
  • 6
  • 20