title: Sending form data from a jsp to a web service client (SOAP)
body: <p>Basically I have a web service connected to a database, that has an insert method.
  I've created a registration form in a jsp and I need to send data the user inserted in the registration.jsp form to my web service. So I used a web service client invocation as the action to the registration.jsp when clicking the submit button.</p>
  
  <p>I dont know how to get the data the user entered in the form and pass it to the web client who in turn insert it in my web service database.</p>
  
  <p>Here are my codes:</p>
  
  <pre><code>    &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
        &lt;title&gt; Registration&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt; Welcome&lt;/h1&gt;
  
  
          &lt;form name="test" action="Wclient2.jsp" method="POST" enctype="multipart/formdata"&gt;
  
                     &lt;table border="0"&gt;
                  &lt;thead&gt;
                      &lt;tr&gt;
                          &lt;th&gt;Register Here&lt;/th&gt;
                        &lt;th&gt;&lt;/th&gt;
                      &lt;/tr&gt;
                  &lt;/thead&gt;
                  &lt;tbody&gt;
                      &lt;tr&gt;
                          &lt;td&gt;First Name:&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="fname" value="" size="50" /&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td&gt;Last Name:&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="lname" value="" size="50" /&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td&gt;Email:&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="email" value="" size="50" /&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td&gt;Password:&lt;/td&gt;
                          &lt;td&gt;&lt;input type="password" name="password" value="" size="50"/&gt;      &lt;/td&gt;
                      &lt;/tr&gt;
  
                      &lt;tr&gt;
                          &lt;td&gt;&lt;/td&gt;
                          &lt;td&gt; &lt;input type="submit" value="submit" name="submit" /&gt; &lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/tbody&gt;
              &lt;/table&gt;
  
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And this is the code for the web client upon clicking the submit button of the</p>
  
  <blockquote>
    <p>registration(  action="Wclient2.jsp" method="POST")</p>
  </blockquote>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
        &lt;title&gt; Enroll&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt; Welcome&lt;/h1&gt;
  
          &lt;form name="test"&lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;JSP Page&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
  
             &lt;%-- start web service invocation --%&gt;&lt;hr/&gt;
          &lt;%        
  
              try {
                  mypack.Bioweb_Service service = new mypack.Bioweb_Service();
                  mypack.Bioweb port = service.getBiowebPort();
                  // TODO initialize WS operation arguments here
  
                  java.lang.String fname = "";
                  java.lang.String lname = "";
                  java.lang.String email = "";
                  java.lang.String password = "";
  
                  // TODO process result here
  
                  java.lang.String result = port.insert(fname, lname, email, password);
                  out.println("Result = " + result);
  
              } catch (Exception ex) {
                  // TODO handle custom exceptions here
              }
          %&gt;
          &lt;%-- end web service invocation --%&gt;&lt;hr/&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I dont know how to get the parameters for fname from the registration.jsp to put in the web client.
  When I write:</p>
  
  <blockquote>
    <p>java.lang.String fname = request.getParameter("fname");</p>
  </blockquote>
  
  <p>to get the value of textfield fname into my web service, in my database a row is created but NULL is inserted instead of the values my user entered in the form. </p>
  
  <p>Please help.</p>