...
CXF
...
Example
...
CXF
...
example
...
for
...
routing
...
the
...
message
...
with
...
different
...
transport
...
The
...
...
...
...
is
...
a
...
demo
...
of
...
the
...
camel-cxf
...
component
...
to
...
show
...
how
...
to
...
route
...
the
...
message
...
between
...
to
...
CXF
...
endpoints
...
,
...
one
...
endpoint
...
consumes
...
the
...
SOAP
...
over
...
JMS
...
request
...
,
...
the
...
other
...
endpoint
...
provides
...
the
...
SOAP
...
over
...
http
...
request
...
for
...
the
...
actual
...
CXF
...
Service
...
endpoint.
...
This
...
camel
...
router
...
just
...
routs
...
the
...
SOAP
...
over
...
HTTP
...
CXF
...
client
...
request
...
to
...
the
...
SOAP
...
over
...
HTTP
...
CXF
...
service.
...
To
...
run
...
the
...
example
...
we
...
use
...
the
...
maven
...
exec
...
plugin.
...
For
...
example
...
from
...
the
...
source
...
or
...
binary
...
distribution
...
the
...
following
...
should
...
work
Code Block |
---|
} cd examples/camel-example-cxf mvn compile exec:java {code} |
We
...
start
...
with
...
creating
...
a
...
...
-
...
which
...
is
...
a
...
container
...
for
...
...
,
...
...
etc:
Wiki Markup |
---|
{snippet:id=e1|lang=java|url=activemq/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/CamelCxfExample.java} |
There
...
is
...
the
...
JMS
...
broker
...
and
...
CXF
...
server
...
set
...
up code
Wiki Markup |
---|
code {snippet:id=e2|lang=java|url=activemq/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/CamelCxfExample.java} |
Now
...
we
...
setup
...
the
...
router
...
for
...
the
...
two
...
endpoint
...
URI
...
which
...
we
...
mentioned
...
before,
...
ROUTER_ENDPOINT_URI
...
is
...
the
...
endpoint
...
for
...
consuming
...
the
...
request
...
of
...
SOAP
...
over
...
HTTP,
...
SERVICE_ENDPOINT_URI
...
is
...
the
...
endpoint
...
for
...
providing
...
the
...
request
...
for
...
the
...
SOAP
...
over
...
JMS
...
service.
Wiki Markup |
---|
{snippet:id=e3|lang=java|url=activemq/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/CamelCxfExample.java} |
Wiki Markup |
---|
{snippet:id=e4|lang=java|url=activemq/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/CamelCxfExample.java}
|
Then
...
we
...
start
...
up
...
the
...
camel
...
context
...
and
...
create
...
the
...
CXF
...
client
...
to
...
kick
...
off
...
the
...
request.
...
CXF
...
example
...
for
...
using
...
Camel
...
transport
...
Since
...
Camel
...
has
...
lots
...
of
...
components
...
and
...
is
...
a
...
great
...
mediation
...
rule
...
engine
...
,
...
we
...
can
...
leverage
...
these
...
camel
...
feature
...
in
...
CXF
...
by
...
using
...
the
...
camel
...
transport.
...
Here
...
is
...
an
...
example
...
to
...
show
...
how
...
to
...
use
...
the
...
Camel
...
transport
...
in
...
CXF.
...
In
...
this
...
example,
...
we
...
setup
...
a
...
load
...
balance
...
Camel
...
context
...
in
...
the
...
camel
...
destination.
Wiki Markup |
---|
{snippet:id=example {snippet |lang=xml|url=activemq/camel/trunk/examples/camel-example-cxf/src/main/resources/org/apache/camel/example/camel/transport/CamelDestination.xml} |
When
...
CXF
...
load
...
this
...
configuration,
...
it
...
will
...
attach
...
an
...
two
...
CXF
...
Endpoint
...
to
...
two
...
different
...
Camel
...
endpoints.
Wiki Markup |
---|
{snippet:id=e1|lang=java|url=activemq/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/camel/transport/Server.java} |
Here
...
is
...
the
...
code
...
that
...
show
...
how
...
to
...
publish
...
the
...
endpoint
...
to
...
different
...
Camel
...
context
...
endpoints,
...
you
...
can
...
specify
...
the
...
Camel
...
endpoint
...
uri
...
as
...
the
...
endpoint
...
address
...
parameter.
Wiki Markup |
---|
{snippet:id=e1e2|lang=java|url=/activemq/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/camel/transport/Server.java} h2. |
CXF
...
example
...
for
...
using
...
the
...
WebServiceProvider
...