You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by imiten <im...@yahoo.com> on 2012/04/24 12:26:13 UTC

cxf 2.5.2 webservice, jms/activemq 5.1.0 integration

Hi,

I have existing web service (SEI and not provider) working fine for soap
over http.  Here is the request printed in server log.

<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:save_product xmlns:ns2="http://webservice.mkyong.com/">
  <product>
    <productCode>Laptop</productCode>
    <productDesc>Laptop Computer</productDesc>
  </product>
  <qoh>10</qoh>
</ns2:save_product></S:Body></S:Envelope>

I want to have the same webservice/webmethod be invoked when I post above
message to activemq queue.
To enable that I added following to cxf-servlet.xml (I deploy war to
tomcat).
<?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:soap="http://cxf.apache.org/bindings/soap"
<b>	xmlns:jms="http://cxf.apache.org/transports/jms"
	xmlns:ct="http://cxf.apache.org/configuration/types"
*	xsi:schemaLocation="http://www.springframework.org/schema/beans 
	http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
	http://cxf.apache.org/bindings/soap 
	http://cxf.apache.org/schemas/configuration/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-extension-policy.xml"/>
	<jaxws:endpoint xmlns:tns="http://webservice.mkyong.com/"
		id="productwebservice" implementor="#myProductWebService"
		wsdlLocation="wsdl/ProductWebService.wsdl"
endpointName="tns:ProductWebServicePort"
		serviceName="tns:ProductWebServiceService"
address="/ProductWebServicePort">
		<jaxws:features>
			<bean class="org.apache.cxf.feature.LoggingFeature" />
		</jaxws:features>
	</jaxws:endpoint>
	<jaxws:endpoint xmlns:tns="http://webservice.mkyong.com/"
		id="productwebservice_javafirst" 
		implementor="#myProductWebServiceJavaFirst"
		address="/IProductWebServicePort">
		<jaxws:features>
			<bean class="org.apache.cxf.feature.LoggingFeature" />
		</jaxws:features>
	</jaxws:endpoint>
	<import resource="classpath:spring/config/BeanLocations.xml" />
	<bean id="myProductWebService"
class="com.mkyong.webservice.ProductWebService">
		<property name="productBo" ref="productBoProxy"></property>
	</bean>
	<bean id="myProductWebServiceJavaFirst"
class="com.mkyong.webservice.ProductWebServiceImpl">
		<property name="productBo" ref="productBoProxy"></property>
	</bean>
	
  *  <jms:destination
name="{http://webservice.mkyong.com}ProductWebServicePort.jms-destination">     
<jms:address destinationStyle="queue"
               jndiConnectionFactoryName="ConnectionFactory"
               jndiDestinationName="miten.test.request.queue"
               jndiReplyDestinationName="miten.test.reply.queue"
               connectionUserName=""
               connectionPassword="">
	    <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>


I do not see any messages in tomcat log which gives me any indication of jms
setup nor does activemq webconsole show any subscribers.  Even after posting
the message to queue there is no effect or action of webservice being
invoked.  

I followed the information on  http://cxf.apache.org/docs/jms-transport.html
website 

I have added following jms related dependency to pom.
        <dependency>
		<groupId>org.apache.activemq</groupId>
   		*<artifactId>activemq-core</artifactId>*
    		<version>${cxf.amq.version}</version>
	</dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            *<artifactId>cxf-rt-transports-jms</artifactId>*
            <version>${cxf.version}</version>
         </dependency>


I do not see any errors for jms while loading in tomcat in fact I do not see
any logs related to jms in tomcat.

Regards,

Miten.

--
View this message in context: http://cxf.547215.n5.nabble.com/cxf-2-5-2-webservice-jms-activemq-5-1-0-integration-tp5661590p5661590.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: cxf 2.5.2 webservice, jms/activemq 5.1.0 integration

Posted by imiten <im...@yahoo.com>.
Hi,

I used the information related to features 
http://cxf.apache.org/docs/using-the-jmsconfigfeature.html here   and it
works.  Also the Namespace handler not found for jaxrs is some thing to do
with tomcat may be since I try couple of times to restart the tomcat and it
would work in some attempt.

Regards,

Miten.

--
View this message in context: http://cxf.547215.n5.nabble.com/cxf-2-5-2-webservice-jms-activemq-5-1-0-integration-tp5661590p5667186.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: cxf 2.5.2 webservice, jms/activemq 5.1.0 integration

Posted by Daniel Kulp <dk...@apache.org>.
There is really nothing in your configs (that I can tell) to tell CXF to use 
JMS transport.   You likely need to update the second jaxws:endpoint to add 
a transportId attribute specifying the JMS transport 
("http://cxf.apache.org/transports/jms") as well as change the "address" on 
it to something like "jms://" to force it into JMS.

Dan


On Tuesday, April 24, 2012 03:26:13 AM imiten wrote:
> Hi,
> 
> I have existing web service (SEI and not provider) working fine for soap
> over http.  Here is the request printed in server log.
> 
> <?xml version="1.0" ?>
> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
> <S:Body>
> <ns2:save_product xmlns:ns2="http://webservice.mkyong.com/">
>   <product>
>     <productCode>Laptop</productCode>
>     <productDesc>Laptop Computer</productDesc>
>   </product>
>   <qoh>10</qoh>
> </ns2:save_product></S:Body></S:Envelope>
> 
> I want to have the same webservice/webmethod be invoked when I post above
> message to activemq queue.
> To enable that I added following to cxf-servlet.xml (I deploy war to
> tomcat).
> <?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:soap="http://cxf.apache.org/bindings/soap"
> <b>	xmlns:jms="http://cxf.apache.org/transports/jms"
> 	xmlns:ct="http://cxf.apache.org/configuration/types"
> *	xsi:schemaLocation="http://www.springframework.org/schema/beans
> 	http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> 	http://cxf.apache.org/bindings/soap
> 	http://cxf.apache.org/schemas/configuration/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-extension-policy.xml"/>
> 	<jaxws:endpoint xmlns:tns="http://webservice.mkyong.com/"
> 		id="productwebservice" implementor="#myProductWebService"
> 		wsdlLocation="wsdl/ProductWebService.wsdl"
> endpointName="tns:ProductWebServicePort"
> 		serviceName="tns:ProductWebServiceService"
> address="/ProductWebServicePort">
> 		<jaxws:features>
> 			<bean class="org.apache.cxf.feature.LoggingFeature" />
> 		</jaxws:features>
> 	</jaxws:endpoint>
> 	<jaxws:endpoint xmlns:tns="http://webservice.mkyong.com/"
> 		id="productwebservice_javafirst"
> 		implementor="#myProductWebServiceJavaFirst"
> 		address="/IProductWebServicePort">
> 		<jaxws:features>
> 			<bean class="org.apache.cxf.feature.LoggingFeature" />
> 		</jaxws:features>
> 	</jaxws:endpoint>
> 	<import resource="classpath:spring/config/BeanLocations.xml" />
> 	<bean id="myProductWebService"
> class="com.mkyong.webservice.ProductWebService">
> 		<property name="productBo" ref="productBoProxy"></property>
> 	</bean>
> 	<bean id="myProductWebServiceJavaFirst"
> class="com.mkyong.webservice.ProductWebServiceImpl">
> 		<property name="productBo" ref="productBoProxy"></property>
> 	</bean>
> 
>   *  <jms:destination
> name="{http://webservice.mkyong.com}ProductWebServicePort.jms-destination"
> > <jms:address destinationStyle="queue"
>                jndiConnectionFactoryName="ConnectionFactory"
>                jndiDestinationName="miten.test.request.queue"
>                jndiReplyDestinationName="miten.test.reply.queue"
>                connectionUserName=""
>                connectionPassword="">
> 	    <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>
> 
> 
> I do not see any messages in tomcat log which gives me any indication of
> jms setup nor does activemq webconsole show any subscribers.  Even after
> posting the message to queue there is no effect or action of webservice
> being invoked.
> 
> I followed the information on 
> http://cxf.apache.org/docs/jms-transport.html website
> 
> I have added following jms related dependency to pom.
>         <dependency>
> 		<groupId>org.apache.activemq</groupId>
>    		*<artifactId>activemq-core</artifactId>*
>     		<version>${cxf.amq.version}</version>
> 	</dependency>
>         <dependency>
>             <groupId>org.apache.cxf</groupId>
>             *<artifactId>cxf-rt-transports-jms</artifactId>*
>             <version>${cxf.version}</version>
>          </dependency>
> 
> 
> I do not see any errors for jms while loading in tomcat in fact I do not
> see any logs related to jms in tomcat.
> 
> Regards,
> 
> Miten.
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/cxf-2-5-2-webservice-jms-activemq-5-1-0-i
> ntegration-tp5661590p5661590.html Sent from the cxf-user mailing list
> archive at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com