title: Parsing SOAP response message java
body: <p>I have the following SOAP response message, where I need to validate that the response code is 1, if project import was successful. How can I do this using RestAssured and Java? </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;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"&gt;
      &lt;env:Header/&gt;
  
  &lt;env:Body&gt;
      &lt;n1:importProjectResponse 
          xmlns:n1=" some text here......" 
          xmlns:n2="..some text here...." 
          xsi:type="n2:ArrayOfProjectImportResultCode"&gt;
          &lt;n2:ProjectImportResultCode&gt;
              &lt;n2:code&gt;1&lt;/n2:code&gt;
              &lt;n2:message&gt;Project 'test1' import was successful.&lt;/n2:message&gt;
          &lt;/n2:ProjectImportResultCode&gt;
      &lt;/n1:importProjectResponse&gt;
  &lt;/env:Body&gt;&lt;/env:Envelope&gt;
  </code></pre>
  
  <p>I am using RestAssured for testing, and it would be great if I could avoid code bloat by taking advantage of RestAssured instead of writing more classes or methods to do a seemingly simple task. Any ideas?</p>
  
  <p>I tried so far, which of course does not work..</p>
  
  <pre><code>response  = given().
      auth().basic(USER, PASSWORD).
      body(request).
      headers("Content-type", "text/xml").
      expect().
          statusCode(200).
          body("//n2:code/text()", is("1")). // does not match .. hmmm :(
      when().post(URL);
  </code></pre>