title: Adding User/Password to SOAPHeader for WebService client call with AXIS2
body: <p>Please help: I am trying to call a WebService from SOAPUI and I notice that the service requires username and password which I am providing through the request parameters. I notice that raw XML contains user/password snippet added to SOAPHeader. The snippet is as below:</p>
  
  <pre><code>&lt;wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt;&lt;wsse:UsernameToken wsu:Id="UsernameToken-3" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&gt;&lt;wsse:Username&gt;testuser&lt;/wsse:Username&gt;&lt;wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"&gt;testpassword&amp;amp;&lt;/wsse:Password&gt;&lt;wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"&gt;RYadQak91mr7dB+5hyt8yw==&lt;/wsse:Nonce&gt;&lt;wsu:Created&gt;2011-10-24T20:13:43.039Z&lt;/wsu:Created&gt;&lt;/wsse:UsernameToken&gt;
  &lt;/wsse:Security&gt;
  </code></pre>
  
  <p>Now the same thing I want to achieve by adding user/password details as in the below code: code snippet is:</p>
  
  <pre><code>org.tempuri.myService.MyServiceStub stub = new  org.tempuri.myService.MyServiceStub();
  
  ServiceClient sc = stub._getServiceClient();
  HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
  auth.setUsername("testuser");
  auth.setPassword("password$");
  
  sc.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,auth);
  
  org.tempuri.myService.MyServiceDocument myService4 = (org.tempuri.myService.MyServiceDocument)getTestObject(org.tempuri.myService.MyServiceDocument.class);
  
  MyService lval = MyService4.addNewMyService();
  
  MyServiceParameters lvParams = lval.addNewParameters();
  lvParams.setA("24");
  lvParams.setB("10");
  
  lval.setParameters(lvParams);
  myService4.setMyService(lval);
  </code></pre>
  
  <p>But I get following Axis fault exception, Need help in the mistake I am doing with the above code. Axis Fault Exception details:</p>
  
  <pre><code>org.apache.axis2.AxisFault: Exception occurred while executing service 'MyService'.
      at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
      at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)
      at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
      at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
      at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
      at org.tempuri.myService.MyServiceStub.myService(MyServiceStub.java:182)
      at org.tempuri.myService.MyServiceTest.main(MyServiceTest.java:55)
  
  MyServiceResponseDocument lvdoc = stub.myService(myService4);
  </code></pre>