cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <ning.ji...@iona.com>
Subject Re: JMS Endpoints with Spring configuration
Date Wed, 25 Jul 2007 10:11:56 GMT
Hi

There are some differences between the <jaxws:endpoint ... and  
<jms:conduit
They are doing the configuration in different level

jaxws:endpoint working directly on the Jaxws API , it equals to call the 
endpoint.publish()
jms:conduit only do some jms transport level configuration

If you had specified the jms transport information in the wsdl,  you 
could just use
<jaxws:endpoint  and set the wsdl location for it to publish the service

BTW If you want to use the jms server you still need to start the jms 
broker.

Willem.


Juan José Vázquez Delgado wrote:
> Thanks Ulhas,
>
> Anyway, i think the JMS transport configuration with Spring is a 
> little bit
> tricky.
>
> With http transport, It´s very easy for me to configure and start the 
> server
> with a few lines, like this:
>
> <jaxws:endpoint
>        id="dummyService"
>        implementor="es.DummyServiceImpl"
>        address="/DummyService" />
>
> I guess it´s the CXFServlet who starts the service, isn´t it?. But 
> with JMS
> configuration can i have something similar?.
>
> On the other hand, if i have to start the server, plus start the jms 
> broker,
> i think it´s easier for me to use Spring JMS to send the message instead.
>
> Regards,
>
> Juanjo.
>
>
> On 7/24/07, Ulhas Bhole <ulhas.bhole@iona.com> wrote:
>>
>> Hi Juanjo,
>>
>> you can have a dummy wsdl with one-way operation sending messaage to the
>> queue which your service is accessing. Also, make sure you use conduit
>> configuration for configuring client. destination configuration is used
>> for the service.
>>
>> your configuration should look like following snippet taken from CXF jms
>> test config :
>>
>> <beans
>>     xmlns="http://www.springframework.org/schema/beans"
>>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>     xmlns:ct="http://cxf.apache.org/configuration/types"
>>     xmlns:jms="http://cxf.apache.org/transports/jms"
>>     xsi:schemaLocation="
>> http://cxf.apache.org/transports/jms
>> http://cxf.apache.org/schemas/configuration/jms.xsd
>> http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans.xsd">
>>
>>     <jms:conduit
>> name="{
>> http://cxf.apache.org/jms_conf_test}HelloWorldQueueBinMsgPort.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.cxf.transport.jms.MockInitialContextFactory"/>
>>           <jms:JMSNamingProperty name="java.naming.provider.url"
>> value="tcp://localhost:61616"/>
>>       </jms:address>
>>     </jms:conduit>
>> </beans>
>>
>> Regards,
>>
>> Ulhas Bhole
>>
>>
>>
>>
>>
>> Juan José Vázquez Delgado wrote:
>> > Thank you guys, it looks that this configuration works:
>> >
>> > <?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: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/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-jms.xml"/>
>> >
>> >    <jms:destination name="{
>> > http://services.com/}DummyJMSServiceImplPort.jms-destination">
>> >        <jms:address destinationStyle="queue"
>> >                     jndiConnectionFactoryName="ConnectionFactory"
>> >                     jndiDestinationName="foo.bar">
>> >
>> >        <jms:JMSNamingProperty name="java.naming.factory.initial"
>> >                               value="
>> > org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
>> >        <jms:JMSNamingProperty name="java.naming.provider.url"
>> >                               value="tcp://localhost:2212"/>
>> >
>> >        </jms:address>
>> >    </jms:destination>
>> >
>> > </beans>
>> >
>> > Although i´m very confused about how can i make a client to this
>> > Service JMS
>> > Endpoint. I have been looking the sample "jms_queue" in the cxf
>> > 2.0distribution but it´s not clear for me doing it with the Spring
>> > configuration.
>> >
>> > A few questions:
>> >
>> > 1. Should I have an implementor class, i mean, an DummyJMSServiceImpl
>> > class?
>> >
>> > 2. Should I have a DummyJMSService interface for the server and 
>> client?
>> >
>> > 2. Should I have a wsdl file?
>> >
>> > I´d like having similar to an HTTP client like this:
>> >
>> > <?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:jaxws="http://cxf.apache.org/jaxws"
>> >    xsi:schemaLocation="http://www.springframework.org/schema/beans
>> > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>> >                           http://cxf.apache.org/jaxws
>> > http://cxf.apache.org/schemas/jaxws.xsd">
>> >
>> >    <bean id="penelope.wsclient.dummyServiceClient" class="
>> > es.cm.penelope.services.DummyService"
>> >              
>> factory-bean="penelope.wsclient.dummyServiceClientFactory"
>> > factory-method="create"/>
>> >
>> >    <bean id="penelope.wsclient.dummyServiceClientFactory"
>> >          class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>> >          <property name="serviceClass" value="
>> > es.cm.penelope.services.DummyService" />
>> >          <property name="address" value="
>> > http://toshiba001:8080/penelope-wsprovider/DummyService" />
>> >    </bean>
>> > </beans>
>> >
>> >
>> > Is this possible?.
>> >
>> > Do you have a JMS sample with Spring configuration?.
>> >
>> > (I only want to send a message to a queue, snif)
>> >
>> > Thanks a lot!.
>> >
>> > On 7/24/07, Willem Jiang <ning.jiang@iona.com> wrote:
>> >>
>> >> Hi,
>> >>
>> >>
>> >> You can use CXF over JMS, we support JMS transport in CXF.
>> >>
>> >> There are some JMS spring configuration updates in CXF 2.0, you 
>> need to
>> >> change
>> >> <jms:destination id="{
>> >> http://services.com/}DummyJMSServiceImplPort.jms-destination">
>> >>
>> >> to
>> >>
>> >> <jms:destination name="{
>> >> http://services.com/}DummyJMSServiceImplPort.jms-destination"> .
>> >>
>> >> It just need to change the 'id' to 'name'. I will update the wiki for
>> >> it.
>> >>
>> >> BTW,  if you just do not want to use servlet transport , you could
>> >> remove
>> >> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />  from

>> the
>> >> spring configuration file.
>> >>
>> >>
>> >> Cheers,
>> >>
>> >> Willem.
>> >>
>> >> Juan José Vázquez Delgado wrote:
>> >> > Hi guys,
>> >> >
>> >> > I´m trying configure an endpoint to use JMS queues with CXF. The 
>> use
>> >> > case is
>> >> > a client that sends a message to an activemq queue. I have a few
>> >> > questions
>> >> > about this:
>> >> >
>> >> > 1. Should I using CXF over JMS?
>> >> >
>> >> > I´m not sure if i should using CXF over HTTP, and for example Camel
>> >> for
>> >> > routing the message towards the queue, instead.
>> >> >
>> >> > 2. Spring configuration
>> >> >
>> >> > I have tried to configure an endpoint over JMS with Spring but it
>> >> doesn´t
>> >> > work. I used this documentation:
>> >> >
>> >> > http://cwiki.apache.org/CXF20DOC/jms-transport.html
>> >> >
>> >> > First of all, if I only use the configuration namespace xmlns:jms="
>> >> > http://cxf.apache.org/transports/jms" like this:
>> >> >
>> >> > <?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: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/jaxws
>> >> > http://cxf.apache.org/schemas/jaxws.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-servlet.xml" />
>> >> >    <import 
>> resource="classpath:META-INF/cxf/cxf-extension-jms.xml"/>
>> >> >
>> >> >
>> >> >    <jms:destination id="{
>> >> > http://services.com/}DummyJMSServiceImplPort.jms-destination">
>> >> >        <jms:address destinationStyle="queue"
>> >> >                     jndiConnectionFactoryName="ConnectionFactory"
>> >> >                     jndiDestinationName="foo.bar">
>> >> >
>> >> >        <jms:JMSNamingProperty name="java.naming.factory.initial"
>> >> >                               value="
>> >> > org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
>> >> >        <jms:JMSNamingProperty name="java.naming.provider.url"
>> >> >                               value="tcp://localhost:2212"/>
>> >> >
>> >> >        </jms:address>
>> >> >    </jms:destination>
>> >> >
>> >> > </beans>
>> >> >
>> >> >
>> >> > i get this error:
>> >> >
>> >> > The matching wildcard is strict, but no declaration can be found 
>> for
>> >> > element
>> >> > 'jms:destination'.
>> >> >
>> >> > Then i tried to add the schemaLocation like this:
>> >> >
>> >> > <beans xmlns="http://www.springframework.org/schema/beans"
>> >> >    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >> >    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/jaxws
>> >> > http://cxf.apache.org/schemas/jaxws.xsd
>> >> >                           http://cxf.apache.org/transports/jms
>> >> > http://cxf.apache.org/schemas/configuration/jms.xsd">
>> >> >
>> >> > but then i get this error:
>> >> >
>> >> > org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: '{
>> >> > http://services.com/}DummyJMSServiceImplPort.jms-destination' is 
>> not
>> a
>> >> > valid
>> >> > value for 'NCName'.
>> >> >    at
>> >> >
>> >>
>> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException

>>
>> >>
>> >> >
>> >> > (ErrorHandlerWrapper.java:236)...
>> >> >
>> >> > Please, i need help to continue, any ideas?.
>> >> >
>> >> > Thanks.
>> >> >
>> >> > Juanjo
>> >> >
>> >>
>> >
>>
>> ----------------------------
>> IONA Technologies PLC (registered in Ireland)
>> Registered Number: 171387
>> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, 
>> Ireland
>>
>

Mime
View raw message