cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Freeman Fang <freeman.f...@gmail.com>
Subject Re: Retrive WSDL using basic authentication
Date Thu, 14 Mar 2013 15:18:19 GMT
Hi,

Ensure the
bus.setExtension(myHttpConduitConfig, MyHTTPConduitConfigurer.class);
before
Client client = dcf.createClient("http://example.com/EchoService?wsdl");

-------------
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-14, at 下午11:08, Alos wrote:

> Thanks for all the help! 
> 
> I was unable to register the MyHTTPConduitConfigurer  as there is no way to get a reference
to the JaxWsDynamicClientFactory's bus. What I ended up doing was subclassing the JaxWsDynamicClientFactory
and overwriting the method where the bus is created! 
> 
> However when I use my new subclass I never see my System.outs that I added to my MyHTTPConduitConfigurer.

> 
> Any ideas on what might be happening?
> 
> Sent from my iPhone
> 
> On Mar 12, 2013, at 11:57 PM, Freeman Fang <freeman.fang@gmail.com> wrote:
> 
>> Hi,
>> 
>> Yes, you can write your own HTTPConduitConfigurer and register to the bus which you
get fromJaxWsDynamicClientFactory 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 <freeman.fang@gmail.com> 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!
>> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message