Does CXF 3.1.X uses Apache HttpComponents - HttpClient? - cxf

Does CXF 3.1.x really uses Apache HttpComponents - HttpClient for http transport? Maven dependencies does not list "Apache HttpComponents" as dependency nor do I see any HttpClient class in the CXF jars? However CXF JIRA CXF-6704 discusses about it?
I need access to HttpClient in CXF for NTLM support per connection basis which CXF by default relies on Java 6+ Authenticator which is set per JVM.

CXF has a decoupled runtime layer. Mostly they start with cxf-rt-*.
In the case of transports, cxf-rt-transports-*.
Take a look at this. I believe that this is the HTTP Components transport runtime.
EDIT: I think this is for asynchronous transport - (looked at the pom after I posted this).
EDIT2: I did a little more research on this and found this documentation. It says that the async client can be used for synchronous calls by setting use.async.http.conduit bus property to true. This also specifically refers to NTLM authentication.

Related

SSL (HTTPS) support in functional web framework

How am I supposed to to configure SSL for a Spring Boot Service using the functional web framework?
The configuration via setting server.ssl.* properties does not work (meaning nothing happens at all) and if I am reading the docs right, only server.port and server.address are supported.
As runtime I prefer netty, but I would be fine with tomcat as well.
Indeed, using the server.ssl.* configuration keys is the right way to go. This is not yet supported as of Spring Boot 2.0.0.M5, but it will be in a future Milestone version (you can follow issue #9431 for that).
You could use customizers as a workaround; Spring Boot provides a few of those for Tomcat already (see TomcatConnectorCustomizer), but unfortunately not yet for Netty (see #10418).
In the meantime, you can provide your own ReactiveWebServerFactory bean and manually set up your Netty server to do that.

Apache Camel on a JAXRS API?

Could anybody explain how Apache Camel is able to behave as a routing and mediation engine on a JAXRS API?
As far I've being reading about I've not been able to figure out what's it for?
You can consider Apache Camel as a great integration framework. It doesn't provide functionality itself, but it makes easy to glue multiple services and protocols together.
Apache Camel can expose a REST endpoint using the CXFRS component. This means it listens for a REST call on certain endpoint (URL). On invocation it doesn't invoke the implementing bean (service) itself, but executes a defined mediation route (invoke a route with its Exchange object).
It is very useful when you need to integrate multiple services or translate the call to other protocols. You can implement a REST service by a bean itself and it's ok until the bean provides some functionality or data itself. For integration you often need more flexibility to integrate multiple sources and protocols. Then Apache Camel can be much more practical tool.

Apache Camel - CXF: general endpoint's customer configuration

I have many WSDL(>100) files in my projects (many WS java interfaces generated). I want to use general configuration for cxf endpoints, not to configure many endpoints in camel xml configuration file for each ws.
<cxf:cxfEndpoint id="orderEndpoint"
address="http://localhost:9000/order/"
serviceClass="camelinaction.order.OrderEndpoint"/>
Is it any other way to configure camel cxf endpoint without manually adding it to xml file for each ws?
Is it possible to use some camel annotations in generated interfaces (automatically)?
There is no Camel annotation to auto-discover JAX-WS interfaces in the classpath and load them as CXF endpoints. That's something too specific to your usecase.
What you can do is use programmatic Spring configuration to register the endpoints in the Spring registry which Camel then uses to resolve endpoints.
Create a class and annotate it with #Configuration and make it implement BeanDefinitionRegistryPostProcessor in order to get a callback along with a BeanDefinitionRegistry which will allow you to add new beans to the registry. Find an example here: Spring - Programmatically generate a set of beans (answer 2).
So now that you have the means to register new beans, you'll need to find the JAX-WS endpoints by searching your classpath. This SO question lists several alternatives: Find Java classes implementing an interface. Since you're using Spring, I would suggest you try out this one.
You'll need to define a technique to generate the bean name and the URL in a meaningful and predictable way, so you can access the bean from the Camel route, and the endpoint from the outside.
Don't forget enabling <context:component-scan /> in your Spring XML to instruct Spring to search Java classes for components.
P.S.: This does not require you to use the Java DSL of Camel. You're simply using Java code to introspect the classpath and dynamically inject the appropriate beans into the Spring registry.
You can use Java DSL (rather than Spring XML) to declare your endpoints programmatically. See the question Apache Camel: RouteBuilder with CxfEndpoint for an example.
Dynamically discovering all of your web services is a separate issue, with many different possible solutions (such as naming conventions, implementing a shared interface, annotation processing).

What is benefit of developing webservice using Apache CXF over normal JAX-WS with Java6

Can some body expalain what is the benefit of developing JAX-WS webservice using apache CXF over normal JAX-WS provided by Java 6.
JAX-WS is only the api / specification - to use it you need an implementation. It can be something like CXF, Axis or the one provided by the application server (JBoss, Weblogic et..).
One advantage of using CXF is that you have more flexibility in terms of deployment. It can be deployed in a web container or you can use an embedded web container and runt it as a stand alone application.
CXF also provides integration with other frameworks like spring.
It also provides tools to work with schema / WSDL etc..
Apache CXF is a open source webservice framework which contains JAX-WE and JAX-RS and also it helps to integrate with spring framework
CXF Supports
1) XML , JSON Format
2)JAXB Data Binding
3) SAOP ,REST,HTTP protocal binding
I have recently completed the web service implementation with JAX-WS using reference implementation apache-cxf. And I found with CXF - integration with Spring is very easy. Moreover, It provides various features like:
Customization of Logging features
Inbound and Outbound interceptor
Application Level security
Easy Exception handling using custom Fault.
For more detail, if you want, please checkout this link: http://predic8.com/axis2-cxf-jax-ws-comparison.htm
And, I read above link, its preety helpful for me.
Thanks !

Using ServiceMix to Proxy Remote Web Service

This might be obvious but i just still don't understand how i'd do it with ServiceMix :
An external web service http://mypartner.com/service/partnerService
My platform is for example http://myservicemix.com/
I'd like to use OSGI bundles
Is this what i need ? :
A cxfbc:provider (this is the one that talks to the remote service, just a wsdl in the bundle right ?)
A camel route and transformations to bridge the two
A jaxrs:server (i'd like to expose it as a REST service)
The cxfbc is a JBI component. JBI is essentially dead/legacy, so I suggest to not use that for new projects. You can read more about JBI is dead here: http://gnodet.blogspot.com/2010/12/thoughts-about-servicemix.html
So Apache ServiceMix is the server where you can host your Camel applications. So I suggest to look into how to do a webservice proxy with Camel.
For example there is an example with Camel
http://camel.apache.org/cxf-proxy-example.html
That example is OSGi ready and can be deployed in Apache ServiceMix.
Also check out some of the CXF examples that are shipped with Apache ServiceMix, in the examples directory
The Camel CXF component can do both REST and WS.
Also there is the camel-restlet component for REST support as well: http://camel.apache.org/restlet

Resources