camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "vs.souza" <vs.so...@gmail.com>
Subject CXFRS to consume OSVDB Restful APIs
Date Wed, 04 Apr 2012 00:07:39 GMT
Hello Friends,

I am trying to use CXFRS to consume the OSVDB Vulnerability Database API but
things doesn't seem to work out. First problem is that it complains that
there is no cxf.xml under META-INF/cxf. I tried to add this file but it is
not working yet (if I add the file it complains that I should declare beans
there). And I get the following errors if I don't add the file:

21:00:00,453 | INFO  | camel-9_Worker-1 | alidationXmlBeanDefinitionReader |
66 - org.springframework.beans - 3.0.6.RELEASE | Loading XML bean
definitions from class path resource [META-INF/cxf/cxf.xml]
21:00:00,456 | WARN  | camel-9_Worker-1 | SpringBusFactory                 |
137 - org.apache.cxf.bundle - 2.4.4 | Initial attempt to create application
context was unsuccessful.
org.springframework.beans.factory.BeanDefinitionStoreException: IOException
parsing XML document from class path resource [META-INF/cxf/cxf.xml]; nested
exception is java.io.FileNotFoundException: class path resource
[META-INF/cxf/cxf.xml] cannot be opened because it does not exist
	at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)


----------------------------------------------------------------------------------------------------------------------


21:00:01,085 | WARN  | camel-9_Worker-1 | PhaseInterceptorChain            |
137 - org.apache.cxf.bundle - 2.4.4 | Interceptor for
{http://osvdb.org/api/vulns_added_since_osvdb_id/i3z5onUTaayfLBzjXtZ5epLlWf/}WebClient
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: .No message body writer has been found for
class : class org.springframework.util.LinkedCaseInsensitiveMap, ContentType
: application/xml.

The restful service URL I am trying to consume is this:

http://osvdb.org/api/vulns_added_since_osvdb_id/i3z5onUTaayfLBzjXtZ5epLlWf/?osvdb_id=78316

And this is my camel route:


<?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:camel="http://camel.apache.org/schema/spring"
       xmlns:cxf="http://camel.apache.org/schema/cxf"
       xmlns:jaxrs="http://cxf.apache.org/jaxrs"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
       http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd
       http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">

  <bean id="sql" class="org.apache.camel.component.sql.SqlComponent">
	<property name="dataSource" ref="osvdbDS" />
  </bean>

  <bean id="osvdbDS" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
	<property name="driverClassName" value="com.mysql.jdbc.Driver" />
	<property name="url" value="jdbc:mysql://localhost:3306/osvdb" />
	<property name="username" value="root"/>
	<property name="password" value="mysql"/>
  </bean>

  <camelContext xmlns="http://camel.apache.org/schema/spring" trace="false">
    <package>com.test.general.osvdb.service</package>
    <route>
      <camel:from
uri="quartz://generalDS/osvdbUpdateTimer?cron=0+*+*+*+*+?"/>
      <camel:to uri="sql:SELECT max(osvdb_id) FROM
`osvdb`.`vulnerabilities`?dataSourceRef=osvdbDS"/>
      <camel:to
uri="cxfrs://http://osvdb.org/api/vulns_added_since_osvdb_id/i3z5onUTaayfLBzjXtZ5epLlWf/?osvdb_id=78316"/>
      <camel:to uri="log:org.osvdb.update?level=WARN"/>
      
      
    </route>
  </camelContext>

</beans>

I already tried to follow the camel-cxfrs documentation without success and
couldn't find an example from camel examples folder.

Do you have any ideas about where I can find a solution or a full example to
follow?

Thanks and regards.

--
View this message in context: http://camel.465427.n5.nabble.com/CXFRS-to-consume-OSVDB-Restful-APIs-tp5616658p5616658.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message