title: Java How to Parse SOAPMessage
body: <p>I am using w3schools CelciusToFahrenheit example. </p>
  
  <pre><code>String soapEndpointUrl = "https://www.w3schools.com/xml/tempconvert.asmx";
  //https://www.w3schools.com/xml/CelsiusToFahrenheit
  String soapAction = "https://www.w3schools.com/xml/CelsiusToFahrenheit";
  </code></pre>
  
  <p>This is my SoapResponse calling method which is a valid xml.</p>
  
  <pre><code>ByteArrayOutputStream bout = new ByteArrayOutputStream();
          soapResponse.writeTo(bout);
  
          soapConnection.close();
          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          DocumentBuilder builder = null;
          try {
              builder = factory.newDocumentBuilder();
          } catch (ParserConfigurationException e) {
              e.printStackTrace();
          }
          String xml = bout.toString("UTF-8"); // &lt;-- The XML SOAP response
          Document xmlDocument = builder.parse(new ByteArrayInputStream(xml.getBytes()));
          xmlDocument.getDocumentElement().normalize();
  
          NodeList nList = xmlDocument.getElementsByTagName("CelsiusToFahrenheitResponse");
          for (int temp = 0; temp &lt; nList.getLength(); temp++) {
  
              Node nNode = nList.item(temp);
          }
  </code></pre>
  
  <p>w3schools xml response</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;soap:Body&gt;&lt;CelsiusToFahrenheitResponse xmlns="https://www.w3schools.com/xml/"&gt;&lt;CelsiusToFahrenheitResult&gt;212&lt;/CelsiusToFahrenheitResult&gt;&lt;/CelsiusToFahrenheitResponse&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>İ can't just get the value because dom parser can't parse and thinks document is null.</p>
  
  <p><strong><em>Long story short; How can i PARSE or GET value from SOAPesponse</em></strong>?</p>