Hi,

Yes, you can write your own HTTPConduitConfigurer and register to the bus which 
you get from JaxWsDynamicClientFactory, some code should be like

public class MyHTTPConduitConfigurer implements HTTPConduitConfigurer {
     public void configure(String name, String address, HTTPConduit c) {
          AuthorizationPolicy authorizationPolicy = new AuthorizationPolicy();
          authorizationPolicy.setUserName("...");
          authorizationPolicy.setPassword("...");
          c.setAuthorization(authorizationPolicy);
     }
}

then register MyHTTPConduitConfigurer to the bus which you get from 
JaxWsDynamicClientFactory, something like
MyHTTPConduitConfigurer myHttpConduitConfig = new MyHTTPConduitConfigurer();
bus.setExtension(myHttpConduitConfig, MyHTTPConduitConfigurer.class);

Hope this helps
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: @Freeman小屋

On 2013-3-13, at 上午2:04, Alos wrote:

> This would force me to have a "hard coded" XML with http:conduits for each of 
> the services using this authentication and thus defeating the purpose of my 
> DynamicClient. Is there a way of creating these http:conduits in code? 
> 
> BTW thanks so much for responding so quickly :-) 
> 
> Sent from my iPhone
> 
> On Mar 11, 2013, at 8:40 PM, Freeman Fang <[email protected]> wrote:
> 
>> Hi,
>> 
>> You need add a spring configuration, add something like
>> 
>> <http:conduit name="http://example.com/.*";> 
>> <authorization>
>>     <sec:UserName>myuser</sec:UserName>
>>     <sec:Password>mypasswd</sec:Password>
>>     <sec:AuthorizationType>Basic</sec:AuthorizationType>
>>  </authorization>
>> </http:conduit>
>> 
>> take a look at [1] to get more details
>> 
>> [1]http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html
>> 
>> -------------
>> Freeman(Yue) Fang
>> 
>> Red Hat, Inc. 
>> FuseSource is now part of Red Hat
>> Web: http://fusesource.com | http://www.redhat.com/
>> Twitter: freemanfang
>> Blog: http://freemanfang.blogspot.com
>> http://blog.sina.com.cn/u/1473905042
>> weibo: @Freeman小屋
>> 
>> On 2013-3-12, at 上午8:09, alos wrote:
>> 
>>> Hey guys!
>>> 
>>> So I've been working with the JaxWsDynamicClientFactory. I´m always
>>> able to get the WSDL like this:
>>> 
>>> JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
>>> Client client = dcf.createClient("http://example.com/EchoService?wsdl";);
>>> 
>>> However a client's new WSDL requires me to pass along an
>>> authentication header in the HTTP message.
>>> 
>>> Is there a way to do this using the JaxWsDynamicClientFactory??
>>> 
>>> So far we´ve tried to get a hold of an Interceptor (so I can get the
>>> HTTPRequest object and do my thing) but it looks like these are
>>> created AFTER the client is instanced.
>>> 
>>> Any help will be appreciated!
>> 

Reply via email to