title: JAX-WS Request with Basic Authentication
body: <p>i am trying to call a SOAP Webservice  using handlers with Basic Authorization but somehow API is responding with 401 unauthorized.</p>
  
  <pre><code>@Override
  public boolean handleMessage(SOAPMessageContext context) {
      Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
      if (outboundProperty.booleanValue()) {
          String authString = parameter.getUser() + ":" + parameter.getPassword();
          try {
               Map&lt;String, List&lt;String&gt;&gt; headers = (Map&lt;String, List&lt;String&gt;&gt;)
                       context.get(MessageContext.HTTP_REQUEST_HEADERS);
  
               if (null == headers) {
                   headers = new HashMap&lt;String, List&lt;String&gt;&gt;();
               }
  
               headers.put("Authorization", Collections.singletonList(
                   "Basic " + new String(Base64.encode(authString.getBytes()))));
          } catch(Exception e) {
              log4j.error(e.getMessage(), e);
          }
      }
      return outboundProperty;
  }
  </code></pre>
  
  <p>When i use SOAP UI and manually add the Authorziation Header (value from code during debug) then i recieve response from the Endpoint but using code it fails as of now.</p>
  
  <p>Any pointers would be really helpful. Thanks</p>