title: SharePoint Framework httpClient.post to _vti_bin/lists.asmx response
body: <p>i'm trying to rewrite a javascript webpart to Sharepoint Framework.</p>
  
  <p>in this webpart i need to do a soap post to /_vti_bin/Lists.asmx in order to get all the events from a calendar list expanded, with the recurring events in it.</p>
  
  <p>The javascript code looks like this</p>
  
  <pre><code>    wsURL = webUrl + "/_vti_bin/Lists.asmx";
      var xmlCall =
          "&lt;soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'&gt; &lt;soap:Body&gt;" +
          "&lt;GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'&gt;" +
          "&lt;listName&gt;" + calendarList + "&lt;/listName&gt;" +
          "&lt;query&gt;" +
          "&lt;Query&gt;" +
          "&lt;Where&gt;" +
             "&lt;DateRangesOverlap&gt;" +
             "&lt;FieldRef Name=\"EventDate\" /&gt;" +
             "&lt;FieldRef Name=\"EndDate\" /&gt;" +
             "&lt;FieldRef Name=\"RecurrenceID\" /&gt;" +
             "&lt;Value Type='DateTime'&gt;&lt;Year/&gt;&lt;/Value&gt;" +
             "&lt;/DateRangesOverlap&gt;" +
          "&lt;/Where&gt;" +
          "&lt;/Query&gt;" +
          "&lt;/query&gt;" +
          "&lt;queryOptions&gt;" +
          "&lt;QueryOptions&gt;" +
              "&lt;ExpandRecurrence&gt;TRUE&lt;/ExpandRecurrence&gt;" +
          "&lt;/QueryOptions&gt;" +
          "&lt;/queryOptions&gt;" +
          "&lt;/GetListItems&gt;" +
          "&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;";
  
      var result = [];
      $.ajax({
          url: wsURL,
          type: "POST",
          dataType: "xml",
          async: false,
          data: xmlCall,
          complete: function (xData, status) {
              if (status === "success") {
                  var root = $(xData.responseText);
                  root.find("listitems").children().children().each(function () {
                      $this = $(this);
                      var ids = $this.attr("ows_UniqueId").split(";");
                      var rec = $this.attr("ows_fRecurrence");
  
                          result.push({
                              "StartTime": $this.attr("ows_EventDate"),
                              "EndTime": $this.attr("ows_EndDate"),
                              "Title": $this.attr("ows_Title"),
                              "Recurrence": (rec === "1" ? true : false),
                              "Description": $this.attr("ows_Description"),
                              "Guid": ids[1],
                              "Id": ids[0],
                          });
  
                  });
              }
          },
          contentType: "text/xml; charset=\"utf-8\""
      });
      return result;
  };
  </code></pre>
  
  <p>But now i'm trying to rewrite this code in typescript, but i cannot seem to get the responseText back?</p>
  
  <p>this is my TypeScript function</p>
  
  <pre><code>private makeRequest(listName: string): Promise&lt;HttpClientResponse&gt; {
  
  let wsURL = this.context.pageContext.web.absoluteUrl + "/_vti_bin/Lists.asmx";
  var xmlCall =
      "&lt;soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'&gt; &lt;soap:Body&gt;" +
      "&lt;GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'&gt;" +
      "&lt;listName&gt;" + listName + "&lt;/listName&gt;" +
      "&lt;query&gt;" +
      "&lt;Query&gt;" +
      "&lt;Where&gt;" +
         "&lt;DateRangesOverlap&gt;" +
         "&lt;FieldRef Name=\"EventDate\" /&gt;" +
         "&lt;FieldRef Name=\"EndDate\" /&gt;" +
         "&lt;FieldRef Name=\"RecurrenceID\" /&gt;" +
         "&lt;Value Type='DateTime'&gt;&lt;Year/&gt;&lt;/Value&gt;" +
         "&lt;/DateRangesOverlap&gt;" +
      "&lt;/Where&gt;" +
      "&lt;/Query&gt;" +
      "&lt;/query&gt;" +
      "&lt;queryOptions&gt;" +
      "&lt;QueryOptions&gt;" +
          "&lt;ExpandRecurrence&gt;TRUE&lt;/ExpandRecurrence&gt;" +
      "&lt;/QueryOptions&gt;" +
      "&lt;/queryOptions&gt;" +
      "&lt;/GetListItems&gt;" +
      "&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;";
  
    const requestHeaders: Headers = new Headers();
    requestHeaders.append('Content-type', "text/xml; charset=\"utf-8\"");
    const httpClientOptions: IHttpClientOptions = {
      body: xmlCall,
      headers: requestHeaders
    };
  
    console.log("About to make REST API request.");
  
    return this.context.httpClient.post(
      wsURL,
      HttpClient.configurations.v1,
      httpClientOptions)
      .then((response: HttpClientResponse) =&gt; {
        console.log("REST API response received.");
        console.log(response);
        console.log(response.text());
        console.log(response.json());
        debugger;
        return response.json();
      });
  }
  </code></pre>
  
  <p>How can i do a post to a soap webservice from my Sharepoint Framework in TypeScript and get the xml response back?</p>