Re: CXF Spring client: getting the message´s XML payload

2008-04-17 Thread Juan José Vázquez Delgado
Hi Freeman,

Definitely, Option 2 is the most suitable way for my configuration because
is less intrusive than others. I´ll try it.

Thanks a lot for your support.

Regards,

Juanjo.


Re: Hibernate and cxf 2.01 problem.

2007-09-12 Thread Juan José Vázquez Delgado
I had to add this dependencies:

dependency
groupIdasm/groupId
artifactIdasm-all/artifactId
version3.0/version
/dependency
dependency
groupIdcglib/groupId
artifactIdcglib-nodep/artifactId
version2.1_3/version
/dependency

On 9/12/07, Vincenzo Vitale [EMAIL PROTECTED] wrote:

 Hi,

 in my project I use Hibernate 3.2.4.sp1 and with cxf 2.0.1-incubator I get
 the exception:

 org.springframework.beans.factory.BeanCreationException: Error creating
 bean
 with name 'sessionFactory' defined in class path resource [
 oasis-db-context.xml]: Invocation of init method failed; nested exception
 is
 java.lang.NoClassDefFoundError
 Caused by:
 java.lang.NoClassDefFoundError
 at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory
 (
 CGLIBLazyInitializer.java :117)

 when the server starts.

 Here I have red it could be for the asm library but also excluding it in
 the
 pom file the problem persist.

 I solved it just using cxf 2.0-incubator but maybe there is another
 solution
 using the last cxf release.


 Someone with the same problem?



 Ciao,
 V.



Re: CXF and Spring annotated transactions

2007-08-22 Thread Juan José Vázquez Delgado
Now, I have this:

jaxws:endpoint id=myServiceEndpoint
implementor=#myServiceImpl
implementorClass=com.xx.MyServiceImpl
address=/MyService /

and everything seems to be ok,

Thank you Daniel!

Regards.

Juanjo.


On 8/21/07, Daniel Kulp [EMAIL PROTECTED] wrote:



 Mustafa,

 This error (according to the toArray javadocs) would be caused if
 something in the Collection is not of the same type as the array.   What
 we do is take the generic type and create and array of that type and
 call toArray with that.

 Thus, if you have VectorInteger,  we create an Integer[] and call
 toArray with that.   If somehow you got a non-Integer into the Vector,
 that would cause the above error.

 Not sure if that helps or not.   :-( Before returning the Vector, you
 might want to try the same thing:
 vector.toArray(new Integer[0]);
 just to see if you get the same error.

 Dan



 On Tuesday 21 August 2007, Mustafa Egilmezbilek wrote:
  Juan,
 
  In fact I am using CXF 2.0.1 and I got the following error:
  INFO: Interceptor has thrown exception, unwinding now
  java.lang.ArrayStoreException
  at java.lang.System.arraycopy(Native Method)
  at java.util.Arrays.copyOf(Unknown Source)
  at java.util.Vector.toArray(Unknown Source)
  at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(
  JAXBEncoderDecoder.java:102)
  
 
  Any ideas ?
 
  On 8/21/07, Juan José Vázquez Delgado [EMAIL PROTECTED] wrote:
   Hi, Mustafa.
  
   I don´t use wsdl2java after generate the wsdl. You can use complex
   types and
   tunning the mappings with JAXB annotations over the classes (in
   jax-ws front-end of course).
  
   But, you must migrate to CXF-2.0.1 because there was an issue in
   CXF-2.0.
  
   I hope this help you.
  
   Regards
  
   On 8/21/07, Mustafa Egilmezbilek [EMAIL PROTECTED] wrote:
Hi,
   
I have a similar architecture with yours and I have a question
about publishing your web services (hope you don't mind):
(Assuming you use Java First Development) After you generate the
wsdl,
  
   are
  
you using wsdl2java tool ?
If you have a complex return type in your interface how do you
define
  
   the
  
mapping ?
   
Thanks,
   
Mustafa
   
On 8/21/07, Juan José Vázquez Delgado [EMAIL PROTECTED]
 wrote:
 Hi, guys!

 I have an application architecture with CXF + Spring + JPA +
  
   Hibernate.
  
My
   
 goal is having transactional services with the @Transactional
   
annotation.
   
 Although, when the application starts i get an parsing error.
 The relevant configuration includes this:

 bean id=transactionManager class=
 org.springframework.orm.jpa.JpaTransactionManager /

 tx:annotation-driven /

 bean id=myServiceImpl
 class=com.xx.MyServiceImpl /

 jaxws:endpoint id=myServiceEndpoint
 implementor=#myServiceImpl
 address=/MyService /

 @Transactional
 public interface MyService() {

 }


 Any ideas?

 Thanks a lot
   
--
Mustafa Egilmezbilek



 --
 J. Daniel Kulp
 Principal Engineer
 IONA
 P: 781-902-8727C: 508-380-7194
 [EMAIL PROTECTED]
 http://www.dankulp.com/blog



Re: CXF and Spring annotated transactions

2007-08-22 Thread Juan José Vázquez Delgado
good idea!

On 8/22/07, Mustafa Egilmezbilek [EMAIL PROTECTED] wrote:

 Ok I found it ! I have defined that attribute as @XmlTransient and also
 removed it from @XmlType.

 Thanks.


 On 8/22/07, Mustafa Egilmezbilek [EMAIL PROTECTED] wrote:
 
  Juan,
 
  How do yo manage cycles in your JPA entity object graph ? For example I
  have ServiceUsage and ServiceUsageDetails and they have bi-directional
  relationship.
  In ServiceUsage:
   @OneToMany(mappedBy=serviceUsage, fetch = FetchType.EAGER)
   private ListServiceUsageDetail serviceUsageList;
 
  In ServiceUsageDetail:
   @ManyToOne
   @JoinColumn(name=SERVICE_USAGE_ID)
   ServiceUsage serviceUsage;
 
  This is causing : com.sun.istack.SAXException2: A cycle is detected in
 the
  object graph
 
  How do you handle this cases ?
 
  Thanks.
 
   On 8/22/07, Juan José Vázquez Delgado [EMAIL PROTECTED] wrote:
  
   Now, I have this:
  
   jaxws:endpoint id=myServiceEndpoint
  implementor=#myServiceImpl
  implementorClass=com.xx.MyServiceImpl
  address=/MyService /
  
   and everything seems to be ok,
  
   Thank you Daniel!
  
   Regards.
  
   Juanjo.
  
  
   On 8/21/07, Daniel Kulp  [EMAIL PROTECTED] wrote:
   
   
   
Mustafa,
   
This error (according to the toArray javadocs) would be caused if
something in the Collection is not of the same type as the array.
   What
we do is take the generic type and create and array of that type
 and
call toArray with that.
   
Thus, if you have VectorInteger,  we create an Integer[] and call
toArray with that.   If somehow you got a non-Integer into the
 Vector,
that would cause the above error.
   
Not sure if that helps or not.   :-( Before returning the
 Vector,
   you
might want to try the same thing:
vector.toArray(new Integer[0]);
just to see if you get the same error.
   
Dan
   
   
   
On Tuesday 21 August 2007, Mustafa Egilmezbilek wrote:
 Juan,

 In fact I am using CXF 2.0.1 and I got the following error:
 INFO: Interceptor has thrown exception, unwinding now
 java.lang.ArrayStoreException
 at java.lang.System.arraycopy (Native Method)
 at java.util.Arrays.copyOf(Unknown Source)
 at java.util.Vector.toArray(Unknown Source)
 at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(
 JAXBEncoderDecoder.java :102)
 

 Any ideas ?

 On 8/21/07, Juan José Vázquez Delgado [EMAIL PROTECTED]
   wrote:
  Hi, Mustafa.
 
  I don´t use wsdl2java after generate the wsdl. You can use
 complex
  types and
  tunning the mappings with JAXB annotations over the classes (in
  jax-ws front-end of course).
 
  But, you must migrate to CXF-2.0.1 because there was an issue in
  CXF-2.0.
 
  I hope this help you.
 
  Regards
 
  On 8/21/07, Mustafa Egilmezbilek [EMAIL PROTECTED] wrote:
   Hi,
  
   I have a similar architecture with yours and I have a question
   about publishing your web services (hope you don't mind):
   (Assuming you use Java First Development) After you generate
 the
   wsdl,
 
  are
 
   you using wsdl2java tool ?
   If you have a complex return type in your interface how do you
   define
 
  the
 
   mapping ?
  
   Thanks,
  
   Mustafa
  
   On 8/21/07, Juan José Vázquez Delgado 
 [EMAIL PROTECTED]
   
wrote:
Hi, guys!
   
I have an application architecture with CXF + Spring + JPA +
 
  Hibernate.
 
   My
  
goal is having transactional services with the
 @Transactional
  
   annotation.
  
Although, when the application starts i get an parsing
 error.
The relevant configuration includes this:
   
bean id=transactionManager class=
org.springframework.orm.jpa.JpaTransactionManager /
   
tx:annotation-driven /
   
bean id=myServiceImpl
class=com.xx.MyServiceImpl  /
   
jaxws:endpoint id=myServiceEndpoint
implementor=#myServiceImpl
address=/MyService /
   
@Transactional
public interface MyService() {
   
}
   
   
Any ideas?
   
Thanks a lot
  
   --
   Mustafa Egilmezbilek
   
   
   
--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727C: 508-380-7194
[EMAIL PROTECTED]
http://www.dankulp.com/blog
   
  
 
 
 
  --
  Mustafa Egilmezbilek




 --
 Mustafa Egilmezbilek



CXF and Spring annotated transactions

2007-08-21 Thread Juan José Vázquez Delgado
Hi, guys!

I have an application architecture with CXF + Spring + JPA + Hibernate. My
goal is having transactional services with the @Transactional annotation.
Although, when the application starts i get an parsing error.
The relevant configuration includes this:

bean id=transactionManager class=
org.springframework.orm.jpa.JpaTransactionManager /

tx:annotation-driven /

bean id=myServiceImpl
class=com.xx.MyServiceImpl /

jaxws:endpoint id=myServiceEndpoint
implementor=#myServiceImpl
address=/MyService /

@Transactional
public interface MyService() {

}


Any ideas?

Thanks a lot


Re: CXF and Spring annotated transactions

2007-08-21 Thread Juan José Vázquez Delgado
Hi, Mustafa.

I don´t use wsdl2java after generate the wsdl. You can use complex types and
tunning the mappings with JAXB annotations over the classes (in jax-ws
front-end of course).

But, you must migrate to CXF-2.0.1 because there was an issue in CXF-2.0.

I hope this help you.

Regards

On 8/21/07, Mustafa Egilmezbilek [EMAIL PROTECTED] wrote:

 Hi,

 I have a similar architecture with yours and I have a question about
 publishing your web services (hope you don't mind):
 (Assuming you use Java First Development) After you generate the wsdl, are
 you using wsdl2java tool ?
 If you have a complex return type in your interface how do you define the
 mapping ?

 Thanks,

 Mustafa


 On 8/21/07, Juan José Vázquez Delgado [EMAIL PROTECTED] wrote:
 
  Hi, guys!
 
  I have an application architecture with CXF + Spring + JPA + Hibernate.
 My
  goal is having transactional services with the @Transactional
 annotation.
  Although, when the application starts i get an parsing error.
  The relevant configuration includes this:
 
  bean id=transactionManager class=
  org.springframework.orm.jpa.JpaTransactionManager /
 
  tx:annotation-driven /
 
  bean id=myServiceImpl
  class=com.xx.MyServiceImpl /
 
  jaxws:endpoint id=myServiceEndpoint
  implementor=#myServiceImpl
  address=/MyService /
 
  @Transactional
  public interface MyService() {
 
  }
 
 
  Any ideas?
 
  Thanks a lot
 



 --
 Mustafa Egilmezbilek



Re: Urgent - Failed to read schema document 'http://cxf.apache.org/schemas/jaxws.xsd'

2007-08-19 Thread Juan José Vázquez Delgado
Hi,

Try this:

 New document and named, for example cxf.xmlcatalog
 Copy/Paste this:

?xml version=1.0 encoding=UTF-8 standalone=no?
catalog xmlns=urn:oasis:names:tc:entity:xmlns:xml:catalog
  system systemId=
http://cxf.apache.org/schemas/configuration/cxf-beans.xsd;
uri=jar:file:C:/SW/cxf/apache-cxf-2.0-incubator/lib/cxf-
2.0-incubator.jar!/schemas/configuration/cxf-beans.xsd/
  system systemId=http://cxf.apache.org/schemas/jaxws.xsd;
uri=jar:file:C:/SW/cxf/apache-cxf-2.0-incubator/lib/cxf-
2.0-incubator.jar!/schemas/jaxws.xsd/
/catalog

where obviously you must change C:/SW/cxf... for your root CXF path, and
save it.

 Eclipse  Window  Preferences  XML Catalog  Advanced  Import 
Import Files  Browse the cxf.xmlcatalog  Finish

Then you will see two new entries in your Eclipse XML Catalog.

I hope this help you.

Regards,

Juanjo.

On 8/19/07, Mustafa Egilmezbilek [EMAIL PROTECTED] wrote:

 Hi,
 I am developing a service with CXF-Spring in Eclipse 3.3 and I got the
 following error:
 cvc-complex-type.2.4.c: The matching wildcard is strict, but no
 declaration
 can be found for element 'jaxws:endpoint'.

 and the following warning:
 schema_reference.4: Failed to read schema document '
 http://cxf.apache.org/schemas/jaxws.xsd', because 1) could not find the
 document; 2) the document could not be read; 3) the root element of the
 document is not xsd:schema.

 I know that jaxws.xsd is in both cxf-2.0.1-incubator.jar and
 cxf-rt-frontend-jaxws-2.0.1-incubator.jar and I am sure that
 cxf-2.0.1-incubator.jar is in among the libraries for the project. I also
 tried to include cxf-rt-frontend-jaxws-2.0.1-incubator.jar but nothing has
 changed :(

 I also defined an XML Catalog for the key:
 http://cxf.apache.org/schemas/jaxws.xsd that points to the
 cxf-2.0.1-incubator.jar then I started to get the error:
 Referenced file contains errors (file:/C:/tools/WebServices/apache-
 cxf-2.0.1-incubator/lib/cxf-2.0.1-incubator.jar).  For more information,
 right click on the message and select Show Details Unfortunately, I
 could not figure out the message to right click to see the details.

 Shortly, I am stuck at this point. Any help will be highly appreciated.

 Thanks.

 --
 Mustafa Egilmezbilek



Re: JMS Endpoints with Spring configuration

2007-07-27 Thread Juan José Vázquez Delgado
Hi Willem,

Yes, here you have the client code:

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;
}

}


The client is jmsDummyServiceClient and the code invoking the server is:

jmsDummyServiceClient.setMessage(Sent to the queue foo.bar);

Any ideas?.

Thanks a lot.

Juanjo

On 7/27/07, Willem Jiang [EMAIL PROTECTED] wrote:

 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

Re: JMS Endpoints with Spring configuration

2007-07-26 Thread Juan José Vázquez Delgado
=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

JMS Endpoints with Spring configuration

2007-07-24 Thread Juan José Vázquez Delgado

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


Re: JMS Endpoints with Spring configuration

2007-07-24 Thread Juan José Vázquez Delgado

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