title: Consuming a Web Service purely from an aspx page
body: <p>My company hosts a SOAP webservice on one of it servers and a requirement has come up to use this webservice to create 'tasks' directly from a web front-end which I am developing.  I have access to the WSDL.</p>
  
  <p>The webservice documentation states that I have to:</p>
  
  <p><strong>1. Call LoginSI, providing the username and password for authentication, 
         receiving the SessionId as a result</strong></p>
  
  <p><strong>2. Execute any number of method calls to the WebService, passing in the SessionId</strong></p>
  
  <p><strong>3. Call LogoutSI, passing in the SessionId. This will abandon the session that was
         established with LoginSI</strong></p>
  
  <p>This sounds reasonable enough, I have managed to call the LoginSI webservice and retrieve a SessionID using the following simple HTML form:</p>
  
  <pre><code>&lt;form action="http://webservice_server/webservice.asmx/LoginSI" method="post"&gt;
      &lt;p&gt;
          Username:&lt;br /&gt;
          &lt;input type="text" name="username"/&gt;
      &lt;/p&gt;
      &lt;p&gt;
          Password:&lt;br /&gt;
          &lt;input type="password" name="password"/&gt;
      &lt;/p&gt;
  
      &lt;input type="submit" value="Test login"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>So far so good.  The next step is to start executing the other webservices.  However what I want is to do all of this from the same page (initially).  For example, once you've successfully logged in, the codebehind will handle the webservice response and grab your session ID.  Then some other options on the page will appear and then every subsequent call to the webservices will use the session ID.</p>
  
  <p>I have no idea how to consume a webservice purely from codebehind (or in any other way to achieve the desired behaviour).  I've found some articles but they mostly mention about adding Assembly references to the project, which I don't think I will be able to do as I didn't write the webservices myself.  </p>
  
  <p>Can anyone prod me in the right direction?</p>