title: Getting the xml soap response instead of raw data
body: <p>I am trying to get the soap response and read few tags and then put the key and values inside a dictionary.</p>
  
  <p>Better would be if I could use the response generated directly and preform regd operations to it.
  But since I was not able to do that, I tried storing the response in an xml file and then using that for operations.</p>
  
  <p>My problem is that the response generated is in a raw form. How to resolve this.</p>
  
  <pre><code>Example: &amp;lt;medical:totEeCnt val=&amp;quot;2&amp;quot; /&amp;gt;&amp;#xd;
            &amp;lt;medical:totMbrCnt val=&amp;quot;2&amp;quot; /&amp;gt;&amp;#xd;
            &amp;lt;medical:totDepCnt val=&amp;quot;0&amp;quot; /&amp;gt;&amp;#xd;
  
  
  def soapTest():
      request = """&lt;soapenv:Envelope.......
      auth = HTTPBasicAuth('', '')
          headers = {'content-type': 'application/soap+xml', 'SOAPAction': "", 'Host': 'bfx-b2b....com'}
          url = "https://bfx-b2b....com/B2BWEB/services/IProductPort"
          response = requests.post(url, data=request, headers=headers, auth=auth, verify=True)
  
          # Open local file
          fd = os.open('planRates.xml', os.O_RDWR|os.O_CREAT)
  
          # Convert response object into string
          response_str = str(response.content)
  
          # Write response to the file
          os.write(fd, response_str)
  
          # Close the file
          os.close(fd)
  
          tree = ET.parse('planRates.xml')
          root = tree.getroot()
          dict = {}
  
          print root
          for plan in root.findall('.//{http://services.b2b.../types/rates/dental}dentPln'):  # type: object
  
              plan_id = plan.get('cd')
              print plan
  
              print plan_id
  
              for rtGroup in plan.findall('.//{http://services.b2b....com/types/rates/dental}censRtGrp'):
  
                  #print rtGroup
                  for amt in rtGroup.findall('.//{http://services.b2b....com/types/rates/dental}totAnnPrem'):
                      # print amt
                      print amt.get('val')
                      amount =  amt.get('val')
                      dict[plan_id] = amount
  
                  print dict
  </code></pre>
  
  <p>Update-:
  I did few things, what I am not able to understand is that ,
  using this, the operations further are working,</p>
  
  <pre><code>     tree = ET.parse('data/planRates.xml')
          root = tree.getroot()
          dict = {}
          print tree
          print root
  for plan in root.findall(..
  </code></pre>
  
  <p>output -</p>
  
  <pre><code>&lt;xml.etree.ElementTree.ElementTree object at 0x100d7b910&gt;
  &lt;Element '{http://schemas.xmlsoap.org/soap/envelope/}Envelope' at 0x101500450&gt;
  </code></pre>
  
  <p>But after using this ,it is not working</p>
  
  <pre><code>    tree = ET.fromstring(response.text)
      print tree
  for plan in tree.findall(..
  </code></pre>
  
  <p>output-:</p>
  
  <pre><code>&lt;Element '{http://schemas.xmlsoap.org/soap/envelope/}Envelope' at 0x10d624910&gt;
  </code></pre>
  
  <p>Basically I am using the same object only .</p>