Features/interceptors can be configured on a per-client basis as well. For the most part, I would suggest a single bus, and then configure the desired features and stuff on each client.

Assuming you are using JAX-WS, you can use the jaxws:client element in the spring config to configure things on a per-client basis. The jaxws:client has features/inInterceptors/outInterceptors/etc... elements just like the bus.

Dan



On Jul 7, 2008, at 3:51 PM, Manolescu, Radu (IT) wrote:

We need to write a program that connects (as a client) to more than one
web service. We have written CXF clients for each service separately,
and they each work.
As we try to combine the code bases and run them in the same JRE, we are
not sure how to make sure things continue to work.


For instance, we have come to believe that we need more than one
instance of the CXF Bus (org.apache.cxf.bus.CXFBusImpl) configured in
our program. This is because the CXF Bus bean references a
WSS4JOutInterceptor bean which is configured to access a specific
service.
To configure more than one CXF bus, we have switched from the "cxf:bus"
namespace configuration tags to the basic Spring config style:
<cxf:bus><cxf:features><cxf:logging/></cxf:features>  <!-- "cxf:bus"
tags, no bean name -->
<bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl"> <!-- regular
Spring bean, with a name -->
This works for one service, but it seems that the client code expects
the CXFBus bean to be bound under the name "cxf". The client never
references the CXFBus bean explicitly, and therefore probably finds it
by some hard-coded reference to the bean name.  In the above
configuration fragment, we get an error if we change the bean's name
away from "cxf".

Since we need more than one CXFBus bean to be configured, we need to
control these beans' names.
Furthermore, we believe that we need to specify that a given CXF client
should be "bound" to a CXF Bus instance (since this bus instance is
configured to interact with the service).
Is there an API call that can bind a CXF client to an instance of CXF
Bus?

Since CXF is configured in Spring files, we have tried to load the
Spring application context explicitly in the client code. This has
resulted in errors, since the map CXFBusImpl.extensions turned out empty
at runtime.

Is there a way to load the CXF Bus bean directly and associate it to a
service object?
Looking at
org.apache.cxf.bus.spring.SpringBusFactory.defaultBusNotExists(), it
seems that the BusFactory will always return the bean named "cxf" from
the application context.

How can we develop a program that uses CXF to connect to more than one
service?


Thanks,

Radu Manolescu
Morgan Stanley | Technology
2000 Westchester Ave, 1st Floor | Purchase, NY  10577
[EMAIL PROTECTED]
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.

---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog




Reply via email to