title: Apache CXF - None of the policy alternatives can be satisfied
body: <p>I'm trying to create client of 3rd party WS. My app is running on JBoss AS 6 (with its Apache CXF 2.3.1 stack). I generated client code by wsconsume (wsdl2java). When I tried to connect to WS a got exception:</p>
  
  <pre><code>No assertion builder for type http://schemas.microsoft.com/ws/06/2004/policy/http}BasicAuthentication registered. 
  Exception in thread "main" org.apache.cxf.ws.policy.PolicyException: None of the policy alternatives can be satisfied.
  </code></pre>
  
  <p>Auth part of WSDL looks like:</p>
  
  <pre><code>&lt;wsp:Policy wsu:Id="abc_ssl_policy"&gt;
      &lt;wsp:ExactlyOne&gt;
          &lt;wsp:All&gt;
              &lt;http:BasicAuthentication
                  xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http" /&gt;
              &lt;sp:TransportBinding
                  xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
                  &lt;wsp:Policy&gt;
                      &lt;sp:TransportToken&gt;
                          &lt;wsp:Policy&gt;
                              &lt;sp:HttpsToken RequireClientCertificate="false" /&gt;
                          &lt;/wsp:Policy&gt;
                      &lt;/sp:TransportToken&gt;
                      &lt;sp:AlgorithmSuite&gt;
                          &lt;wsp:Policy&gt;
                              &lt;sp:Basic256 /&gt;
                          &lt;/wsp:Policy&gt;
                      &lt;/sp:AlgorithmSuite&gt;
                      &lt;sp:Layout&gt;
                          &lt;wsp:Policy&gt;
                              &lt;sp:Strict /&gt;
                          &lt;/wsp:Policy&gt;
                      &lt;/sp:Layout&gt;
                  &lt;/wsp:Policy&gt;
              &lt;/sp:TransportBinding&gt;
          &lt;/wsp:All&gt;
      &lt;/wsp:ExactlyOne&gt;
  &lt;/wsp:Policy&gt;
  </code></pre>
  
  <p>Client code:</p>
  
  <pre><code>@WebServiceClient(name = "Abc", 
                wsdlLocation = "https://hiddendomain.com/abc/abc.svc?wsdl",
                targetNamespace = "http://tempuri.org/")                  
  public class Abc extends Service {
  
  public final static URL WSDL_LOCATION;
  
  public final static QName SERVICE = new QName("http://tempuri.org/", "Abc");
  public final static QName AbcSsl = new QName("http://tempuri.org/", "abc_ssl");
  static {
  
      Authenticator.setDefault(new Authenticator() {
          @Override
          protected PasswordAuthentication getPasswordAuthentication() {
              return new PasswordAuthentication("user", "pas".toCharArray());
          }
  
      });
  
      URL url = null;
      try {
          url = new URL("https://hiddendomain.com/abc/abc.svc?wsdl");
  
      } catch (MalformedURLException e) {
          java.util.logging.Logger.getLogger(DistrInfo.class.getName())
              .log(java.util.logging.Level.INFO, 
                   "Can not initialize the default wsdl from {0}", "...");
      }
      WSDL_LOCATION = url;
  }
  </code></pre>
  
  <p>Exception is thrown whe I try get Conduit:</p>
  
  <pre><code>    Client client = ClientProxy.getClient(port);
      HTTPConduit con = (HTTPConduit) client.getConduit(); &lt;- exception
  </code></pre>
  
  <p>I suspect that is because of non-standard MS policy and I need proper Intercerptor to handle this policy, but can somebody show me a way how to do it?</p>
  
  <p>I dont even no, where I should put my HTTPS credentials to auth (I can't get conduit)</p>