title: What is needed to get the text of an SOAP authenticated webpage in Powershell?
body: <p>Specifically, what values below are needed to actually get the information from the webpage that I want? It's behind a login page, and using Fiddler on my company's website, I was able to find the full header/cookie/request info of the page I'm trying to get. However, as I am still new, I'm not sure as to exactly what values/syntax is needed to pull the data from the correct webpage with powershell.</p>
  
  <p>I'm able to login to the page using a post invoke-webrequest, but the returned info is from the page you would get on a successful login(welcome to the site yourname), not the info of the url of the page being requested. </p>
  
  <p>The fiddler information on the page that I want to see is:</p>
  
  <pre><code>Get /com.fakename.fakename.fakename.fakename.detail.content.EntityDetailsContent.pa?id=17645401423347344&amp;entityType=project HTTP/1.1
  Accept: */*
  X-Requested-With: XMLHttpRequest
  Referer: https://fakename.fakename.com/home.pa
  Accept-Language: en-US
  Accept-Encoding: gzip, deflate
  User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
  Host: fakename.fakename.com
  Connection: Keep-Alive
  </code></pre>
  
  <p><strong>Cookie:</strong> </p>
  
  <pre><code>login=fakeid; 
  customerid=1215fakename; 
  lang=en;
  loginServer=fakeserver; 
  ISESSIONID=111111f-2111-1119-911d-21111112f918; 
  JSESSIONID=12381681FLINJLIjn79ED; 
  notificationLastRun=1533333246
  </code></pre>
  
  <p>The request returned the page with all the information that I wanted. Of course, the real issue is doing it programmatically with powershell. What I've tried so far, has failed. I also tried an httprequest-but I'm unsure about what headers/cookie/syntax to do it is-I tried a solution that only returned the login screen info, it didn't even make it passed that.</p>
  
  <pre><code>$username = "fakeid" : $password = "passwordtogetintosite"
  $url = "Https://PathtothissiteMainPage.com"
  $url2 = "Https://PathofUrlIwant.com/Id=112332323"
  $r = Invoke-WebRequest -uri $url -SessionVariable websession
  $form = $r.Forms[0]
  $form.fields['login'] = $username
  $form.fields['password'] = $password
  $r = Invoke-WebRequest -uri ($url + $form.Action) -WebSession $websession -Method Post -Body $form.Fields
  $r2 = Invoke-WebRequest -URI $url2 -WebSession $websession
  $r2.Content|select-string "id on the page I want"
  </code></pre>
  
  <p>Given the information provided, how/what am I missing to get the command to work for the request of the authenticated url? By the way, the $websession variable holds jsession, login, customerid, but no isession variable that fiddler found-if that helps. Also the pages seem to work with SOAP-if that make it easier.</p>