You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by mule1 <ua...@yahoo.com> on 2007/10/21 03:37:48 UTC
cxf jms with java first
Hello,
I wanted to configure cxf jms in xml with my java first service
implementation. Can you provide me the sample cxf jms configuration?
--
View this message in context: http://www.nabble.com/cxf-jms-with-java-first-tf4664613.html#a13325142
Sent from the cxf-user mailing list archive at Nabble.com.
Re: cxf jms with java first
Posted by Ulhas Bhole <ul...@iona.com>.
Hi Christian,
Only requirement on the address is that it should start with "jms://"
rest of the stuff is all ignored currently. All the required stuff is
pulled out from jms:address wsdl Extensor which can be configured via
configuration the way you did.
once you set the address starting with jms:// CXF runtime will find the
appropriate transport factor in this case JMSTransportFactory and will
inject the Spring config that your xml configuration file.
Regards,
Ulhas Bhole
Christian Schneider wrote:
> I have found some clues to the necessary configuration. You need to
> configure a jms:conduit. And of course your JaxWsProxyFactoryBean.
> But what I did not yet find out is how to connect the two. What I know
> is that your setAddress Parameter in the factory has to start with
> jms://.
>
> Has anyone an idea how to go on from there?
>
> Best regards,
>
> Christian
>
> mule1 schrieb:
>> Hello,
>>
>> I wanted to configure cxf jms in xml with my java first service
>> implementation. Can you provide me the sample cxf jms configuration?
>>
> JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> factory.getInInterceptors().add(new LoggingInInterceptor());
> factory.getOutInterceptors().add(new LoggingInInterceptor());
> factory.setServiceClass(IHello.class);
>
> factory.setAddress("jms://{http://service.test/}IHelloService.jms-conduit");
> // This dows not seem correct... what is the right address for jms?
> //factory.setAddress("http://localhost:9000/Hello");
> IHello client = (IHello) factory.create();
> String reply = client.sayHi("HI");
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:cxf="http://cxf.apache.org/core"
> xmlns:soap="http://cxf.apache.org/bindings/soap"
> xmlns:jaxws="http://cxf.apache.org/jaxws"
> xmlns:jms="http://cxf.apache.org/transports/jms"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/bindings/soap
> http://cxf.apache.org/schema/bindings/soap.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
> http://cxf.apache.org/transports/jms
> http://cxf.apache.org/schemas/configuration/jms.xsd
> ">
>
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-local.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-jms.xml" />
>
> <jms:conduit
> name="{http://service.test/}IHelloService.jms-conduit">
> <jms:clientConfig clientReceiveTimeout="500"
> messageTimeToLive="500" />
> <jms:runtimePolicy messageType="binary" />
> <jms:sessionPool lowWaterMark="10" highWaterMark="5000" />
> <jms:address destinationStyle="queue"
> jndiConnectionFactoryName="MockConnectionFactory"
> jndiDestinationName="myOwnDestination"
> jndiReplyDestinationName="myOwnReplyDestination"
> connectionUserName="testUser"
> connectionPassword="testPassword">
> <jms:JMSNamingProperty name="java.naming.factory.initial"
>
> value="org.apache.activemq.jndi.ActiveMQInitialContextFactory" />
> <jms:JMSNamingProperty name="java.naming.provider.url"
> value="tcp://localhost:61616" />
> </jms:address>
> </jms:conduit>
>
> </beans>
>
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: cxf jms with java first
Posted by Christian Schneider <ch...@die-schneider.net>.
I have the example running ... phew ... That was some work. After some
cleanup I will write a wiki page about my example.
In fact once all is set up it is quite easy. Only the fact that you have
to connect jms:conduit and service by the endpoint name is not very
intuitive.
I would like to have a property inside the JaxWsServerFactoryBean where
I can simply set the transport to a jms conduit. This would be much clearer.
In the dev list I read that someone works on the spring jms config..
This would be much help.
I used the following cxf.xml and code for server and client.
Best regards and thanks for your help,
Christian
cxf.xml
--------------------------
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:soap="http://cxf.apache.org/bindings/soap"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:jms="http://cxf.apache.org/transports/jms"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schema/bindings/soap.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/transports/jms
http://cxf.apache.org/schemas/configuration/jms.xsd
">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-local.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-jms.xml" />
<cxf:bus>
<cxf:features>
<cxf:logging/>
</cxf:features>
</cxf:bus>
<jms:conduit
name="{http://service.test/}IHelloPort.jms-conduit">
<!--
<jms:clientConfig clientReceiveTimeout="500"
messageTimeToLive="500" />
<jms:runtimePolicy messageType="binary" />
<jms:sessionPool lowWaterMark="10" highWaterMark="5000" />
-->
<jms:address destinationStyle="queue"
jndiConnectionFactoryName="ConnectionFactory"
jndiDestinationName="dynamicQueues/test.cxf.jmstransport.queue"
connectionUserName="testUser" connectionPassword="testPassword">
<jms:JMSNamingProperty name="java.naming.factory.initial"
value="org.apache.activemq.jndi.ActiveMQInitialContextFactory" />
<jms:JMSNamingProperty name="java.naming.provider.url"
value="tcp://localhost:61616" />
</jms:address>
</jms:conduit>
<jms:destination
name="{http://service.test/}IHelloPort.jms-destination">
<!--
<jms:clientConfig clientReceiveTimeout="500"
messageTimeToLive="500" />
<jms:runtimePolicy messageType="binary" />
<jms:sessionPool lowWaterMark="10" highWaterMark="5000" />
-->
<jms:address destinationStyle="queue"
jndiConnectionFactoryName="ConnectionFactory"
jndiDestinationName="dynamicQueues/test.cxf.jmstransport.queue"
connectionUserName="testUser" connectionPassword="testPassword">
<jms:JMSNamingProperty name="java.naming.factory.initial"
value="org.apache.activemq.jndi.ActiveMQInitialContextFactory" />
<jms:JMSNamingProperty name="java.naming.provider.url"
value="tcp://localhost:61616" />
</jms:address>
</jms:destination>
</beans>
-------------------
Server:
-----------------------
Object implementor = new Hello();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(IHello.class);
svrFactory.setAddress("jms://");
svrFactory.setServiceBean(implementor);
svrFactory.getInInterceptors().add(new LoggingInInterceptor());
svrFactory.getOutInterceptors().add(new LoggingInInterceptor());
svrFactory.create();
-------------------
Client:
--------------------------
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingInInterceptor());
factory.setServiceClass(IHello.class);
factory.setAddress("jms://");
IHello client = (IHello) factory.create();
---------------------------
--
Christian Schneider
---
http://www.liquid-reality.de
Re: cxf jms with java first
Posted by Willem Jiang <ni...@iona.com>.
AFAIK, that is what you need to do.
Setting the factory's address to be the String which start with "jms://"
will be OK.
BTW, you do not need to include the below files in your spring.configuration
<import resource="classpath:META-INF/cxf/cxf-extension-local.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
And the most important thing is that you need to let this Spring
configuration file be load by CXF bus.
You can name it as the cxf.xml and put it into the class path, or use
the SpringBusFactory to load it.
Willem.
Christian Schneider wrote:
> I have found some clues to the necessary configuration. You need to
> configure a jms:conduit. And of course your JaxWsProxyFactoryBean.
> But what I did not yet find out is how to connect the two. What I know
> is that your setAddress Parameter in the factory has to start with
> jms://.
>
> Has anyone an idea how to go on from there?
>
> Best regards,
>
> Christian
>
> mule1 schrieb:
>> Hello,
>>
>> I wanted to configure cxf jms in xml with my java first service
>> implementation. Can you provide me the sample cxf jms configuration?
>>
> JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> factory.getInInterceptors().add(new LoggingInInterceptor());
> factory.getOutInterceptors().add(new LoggingInInterceptor());
> factory.setServiceClass(IHello.class);
>
> factory.setAddress("jms://{http://service.test/}IHelloService.jms-conduit");
> // This dows not seem correct... what is the right address for jms?
> //factory.setAddress("http://localhost:9000/Hello");
> IHello client = (IHello) factory.create();
> String reply = client.sayHi("HI");
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:cxf="http://cxf.apache.org/core"
> xmlns:soap="http://cxf.apache.org/bindings/soap"
> xmlns:jaxws="http://cxf.apache.org/jaxws"
> xmlns:jms="http://cxf.apache.org/transports/jms"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/bindings/soap
> http://cxf.apache.org/schema/bindings/soap.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
> http://cxf.apache.org/transports/jms
> http://cxf.apache.org/schemas/configuration/jms.xsd
> ">
>
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-local.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-jms.xml" />
>
> <jms:conduit
> name="{http://service.test/}IHelloService.jms-conduit">
> <jms:clientConfig clientReceiveTimeout="500"
> messageTimeToLive="500" />
> <jms:runtimePolicy messageType="binary" />
> <jms:sessionPool lowWaterMark="10" highWaterMark="5000" />
> <jms:address destinationStyle="queue"
> jndiConnectionFactoryName="MockConnectionFactory"
> jndiDestinationName="myOwnDestination"
> jndiReplyDestinationName="myOwnReplyDestination"
> connectionUserName="testUser"
> connectionPassword="testPassword">
> <jms:JMSNamingProperty name="java.naming.factory.initial"
>
> value="org.apache.activemq.jndi.ActiveMQInitialContextFactory" />
> <jms:JMSNamingProperty name="java.naming.provider.url"
> value="tcp://localhost:61616" />
> </jms:address>
> </jms:conduit>
>
> </beans>
>
Re: cxf jms with java first
Posted by Christian Schneider <ch...@die-schneider.net>.
I have found some clues to the necessary configuration. You need to
configure a jms:conduit. And of course your JaxWsProxyFactoryBean.
But what I did not yet find out is how to connect the two. What I know
is that your setAddress Parameter in the factory has to start with jms://.
Has anyone an idea how to go on from there?
Best regards,
Christian
mule1 schrieb:
> Hello,
>
> I wanted to configure cxf jms in xml with my java first service
> implementation. Can you provide me the sample cxf jms configuration?
>
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingInInterceptor());
factory.setServiceClass(IHello.class);
factory.setAddress("jms://{http://service.test/}IHelloService.jms-conduit");
// This dows not seem correct... what is the right address for jms?
//factory.setAddress("http://localhost:9000/Hello");
IHello client = (IHello) factory.create();
String reply = client.sayHi("HI");
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:soap="http://cxf.apache.org/bindings/soap"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:jms="http://cxf.apache.org/transports/jms"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schema/bindings/soap.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/transports/jms
http://cxf.apache.org/schemas/configuration/jms.xsd
">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-local.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-jms.xml" />
<jms:conduit
name="{http://service.test/}IHelloService.jms-conduit">
<jms:clientConfig clientReceiveTimeout="500"
messageTimeToLive="500" />
<jms:runtimePolicy messageType="binary" />
<jms:sessionPool lowWaterMark="10" highWaterMark="5000" />
<jms:address destinationStyle="queue"
jndiConnectionFactoryName="MockConnectionFactory"
jndiDestinationName="myOwnDestination"
jndiReplyDestinationName="myOwnReplyDestination"
connectionUserName="testUser" connectionPassword="testPassword">
<jms:JMSNamingProperty name="java.naming.factory.initial"
value="org.apache.activemq.jndi.ActiveMQInitialContextFactory" />
<jms:JMSNamingProperty name="java.naming.provider.url"
value="tcp://localhost:61616" />
</jms:address>
</jms:conduit>
</beans>
--
Christian Schneider
---
http://www.liquid-reality.de
Re: cxf jms with java first
Posted by Willem2 <ni...@iona.com>.
Hi,
You can find more information about the JMS configuration here [1][2]
CXF wiki
[1]http://cwiki.apache.org/CXF20DOC/jms-transport.html
Unit test configuration
[2]https://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/transports/jms/src/test/resources/jms_test_config.xml
Willem.
mule1 wrote:
>
> Hello,
>
> I wanted to configure cxf jms in xml with my java first service
> implementation. Can you provide me the sample cxf jms configuration?
>
--
View this message in context: http://www.nabble.com/cxf-jms-with-java-first-tf4664613.html#a13325248
Sent from the cxf-user mailing list archive at Nabble.com.
Re: cxf jms with java first
Posted by Christian Schneider <ch...@die-schneider.net>.
I also want to use java first with jms. Perhaps we can coordinate efforts.
Have you come any further?
Best regards
Christian
mule1 schrieb:
> Hello,
>
> I wanted to configure cxf jms in xml with my java first service
> implementation. Can you provide me the sample cxf jms configuration?
>
--
Christian Schneider
---
http://www.liquid-reality.de