Hi Juanjo,

I did not find any code of the client invoking the server, such as client.setMessage("hello");

Willem.


Juan José Vázquez Delgado wrote:
Hi!,

After hard work with JMS and CXF, it seems I´m near the end (but not
totally).

I changed the JMS configuration from Spring to WSDL:

WSDL

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions
    name="JMSDummyService"
    targetNamespace="http://es.services/jms_dummy/";
    xmlns:jms="http://cxf.apache.org/transports/jms";
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
    xmlns:tns="http://es.services/jms_dummy/";
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
 <wsdl:types>
   <xsd:schema targetNamespace="http://es.services/jms_dummy/";>
           <xsd:element name="getJMSHelloWorld">
               <xsd:complexType />
           </xsd:element>
           <xsd:element name="getJMSHelloWorldResponse">
               <xsd:complexType>
                   <xsd:sequence>
                       <xsd:element name="out"
type="xsd:string"></xsd:element>
                   </xsd:sequence>
               </xsd:complexType>
           </xsd:element>

           <xsd:element name="setMessage">
               <xsd:complexType>
                   <xsd:sequence>
                       <xsd:element name="in"
type="xsd:string"></xsd:element>
                   </xsd:sequence>
               </xsd:complexType>
           </xsd:element>
       </xsd:schema>
 </wsdl:types>

 <wsdl:message name="getJMSHelloWorldRequest">
     <wsdl:part name="in" element="tns:getJMSHelloWorld"></wsdl:part>
 </wsdl:message>
 <wsdl:message name="getJMSHelloWorldResponse">
     <wsdl:part name="out"
element="tns:getJMSHelloWorldResponse"></wsdl:part>
 </wsdl:message>

 <wsdl:message name="setMessageRequest">
     <wsdl:part name="in" element="tns:setMessage"></wsdl:part>
 </wsdl:message>

 <wsdl:portType name="JMSDummyPortType">
       <wsdl:operation name="getJMSHelloWorld">
<wsdl:input message="tns:getJMSHelloWorldRequest"></wsdl:input>
           <wsdl:output
message="tns:getJMSHelloWorldResponse"></wsdl:output>
       </wsdl:operation>

       <wsdl:operation name="setMessage">
           <wsdl:input message="tns:setMessageRequest"></wsdl:input>
       </wsdl:operation>
 </wsdl:portType>
 <wsdl:binding name="JMSDummyBinding" type="tns:JMSDummyPortType">
     <soap:binding style="document"
         transport="http://schemas.xmlsoap.org/soap/http"; />
     <wsdl:operation name="getJMSHelloWorld">
         <soap:operation
soapAction="http://es.services/jms_dummy/getJMSHelloWorld"; />
         <wsdl:input>
             <soap:body use="literal" />
         </wsdl:input>
         <wsdl:output>
             <soap:body use="literal" />
         </wsdl:output>
     </wsdl:operation>
     <wsdl:operation name="setMessage">
         <soap:operation
             soapAction="http://es.services/jms_dummy/setMessage"; />
         <wsdl:input>
             <soap:body use="literal" />
         </wsdl:input>
         <wsdl:output>
             <soap:body use="literal" />
         </wsdl:output>
     </wsdl:operation>
 </wsdl:binding>
 <wsdl:service name="JMSDummyService">
   <wsdl:port binding="tns:JMSDummyBinding" name="JMSDummyPort">
        <jms:address
            destinationStyle="queue"
            jndiConnectionFactoryName="ConnectionFactory"
            jndiDestinationName="dynamicQueues/foo.bar"
            jndiReplyDestinationName="dynamicQueues/foo2.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:clientConfig clientReceiveTimeout="500" messageTimeToLive="500"
/>
       <jms:sessionPool lowWaterMark="10" highWaterMark="5000" />
       <jms:runtimePolicy messageType="text"/>
    </wsdl:port>
 </wsdl:service>
</wsdl:definitions>

EndpointInterface

@WebService(targetNamespace = "http://es.services/jms_dummy/";,
           name = "JMSDummyPortType")
public interface JMSDummyService {

   @WebResult(targetNamespace = "", name = "out")
   @WebMethod
   String getJMSHelloWorld();


   @WebMethod
   void setMessage(@WebParam(targetNamespace = "", name = "in") String
message);
}

Implementor

@WebService(portName = "JMSDummyPort",
           serviceName = "JMSDummyService",
           targetNamespace = "http://es.services/jms_dummy/";,
           endpointInterface = "es.services.JMSDummyService",
           wsdlLocation = "classpath:es/schemas/wsdl/jms_dummy.wsdl")

public class JMSDummyServiceImpl implements JMSDummyService {

   public String getJMSHelloWorld() {
       System.out.println("Invocado el método getJMSHelloWorld!!!");
       return "Hola Mundo desde JMSDummyServiceImpl";
   }

   public void setMessage(String message) {
       System.out.println("Message Received -- " + message);

   }
}

Server (Spring Config)

<jaxws:endpoint
       id="dummyJMSService"
       implementor="es.services.JMSDummyServiceImpl"
address="http://cxf.apache.org/transports/jms"; /> <!-- I´m not sure
about this address -->

Client (Spring Config)

<bean id="jmsDummyServiceClient" class="es.services.JMSDummyService"
             factory-bean="jmsDummyServiceClientFactory"
factory-method="create"/>

   <bean id="jmsDummyServiceClientFactory"
         class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass" value="es.services.JMSDummyService"
/>
         <property name="wsdlURL"
value="classpath:es/schemas/wsdl/jms_dummy.wsdl" />
         <property name="serviceName">
             <bean class="javax.xml.namespace.QName" scope="prototype">
<constructor-arg value="http://es.services/jms_dummy/"; />
                 <constructor-arg value="JMSDummyService" />
             </bean>
         </property>
         <property name="endpointName">
             <bean class="javax.xml.namespace.QName" scope="prototype">
<constructor-arg value="http://es.services/jms_dummy/"; />
                 <constructor-arg value="JMSDummyPort" />
             </bean>
         </property>
   </bean>

Test

Then, I have this test

public class IntTest extends AbstractSpringTest {


   private JMSDummyService jmsDummyServiceClient;

   public void testJmsDummyService() throws Exception {

       String message = jmsDummyServiceClient.getJMSHelloWorld();
       jmsDummyServiceClient.setMessage("Sent to the queue foo.bar");
       System.out.println(message);
   }

   public void setJmsDummyServiceClient(JMSDummyService
jmsDummyServiceClient) {
       this.jmsDummyServiceClient = jmsDummyServiceClient;
   }

}


When i run the test, i cannot see any message in the "foo.bar". Although,
there is no errors!!!. Everything it seems to be ok. It seems the
communication between client and endpoint is ok over JMS, but no messages in
the queue. What is wrong?.

Thanks for help.

Juanjo.

On 7/25/07, Willem Jiang  <[EMAIL PROTECTED]> wrote:

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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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
>>
>


Reply via email to