validation - Parsing SOAP response message java -


i have following soap response message, need validate response code 1, if project import successful. how can using restassured , java?

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <env:envelope      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"      xmlns:xsd="http://www.w3.org/2001/xmlschema"      xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"      xmlns:xsi="http://www.w3.org/2001/xmlschema-instance">     <env:header/>  <env:body>     <n1:importprojectresponse          xmlns:n1=" text here......"          xmlns:n2="..some text here...."          xsi:type="n2:arrayofprojectimportresultcode">         <n2:projectimportresultcode>             <n2:code>1</n2:code>             <n2:message>project 'test1' import successful.</n2:message>         </n2:projectimportresultcode>     </n1:importprojectresponse> </env:body></env:envelope> 

i using restassured testing, , great if avoid code bloat taking advantage of restassured instead of writing more classes or methods seemingly simple task. ideas?

i tried far, of course not work..

response  = given().     auth().basic(user, password).     body(request).     headers("content-type", "text/xml").     expect().         statuscode(200).         body("//n2:code/text()", is("1")). // not match .. hmmm :(     when().post(url); 

this 1 should work //*[name()='n2:code']/text()


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -