You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by shekher awasthi <sh...@gmail.com> on 2011/08/08 07:03:50 UTC

Fetching xslt file over HTTP using Camel

Hi All,

Till now i was able to work in smooth way with camel but the moment we
started working on xslt component it giving a lot of issues, earlier we were
facing issues in fetching xslt file to covert XML to our custom format XML,
when we were trying to fetch xsl file form the path outside the classpath
camel was unable to recognize that path below is the discussion thread

http://camel.465427.n5.nabble.com/Custom-URIResolver-for-Camel-td4665485.html

though we solved the problem but now we are trying to fetch xls file over
HTTP so that we can provide  flexibility to change file at any time without
any server restart or major change.
for testing we placed the file in our web-application under following
location

webContent
      ----------------sxlt
                          ----XMLConverter.xls

and we are able to open this file on the web browser which indicates that
the file is accessible over HTTP (we are using tomcat )

here is the line of code we are using to fetch xsl over HTTP

  <route id="test">
      <from uri="file://target/inventory/updates?noop=true"/>
          <unmarshal>
                <csv />
            </unmarshal>
       <to uri="bean:XMLConverter?method=processCSVInvoice" />
       <to uri="xslt:http://localhost:7777/Adapt/xslt/XMLConverter.xsl"/>
      <to uri="file://target/inventory/updates/test?fileName=test11.xml"/>
    </route>

but this is not working as we are getting server timeout error and if i will
remove this line

<to uri="xslt:http://localhost:7777/Adapt/xslt/XMLConverter.xsl"/>
with
<to
uri="xslt:file:///C://target\\inventory\\updates\\xlsconvertor\\XMLConverter.xsl"/>

things will start working out here is the out put from console

INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
Aug 8, 2011 10:18:03 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'dispatcher'
[                          main] DispatcherServlet              INFO
FrameworkServlet 'dispatcher': initialization started
[                          main] XmlWebApplicationContext       INFO
Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup
date [Mon Aug 08 10:18:03 IST 2011]; root of context hierarchy
[                          main] XmlBeanDefinitionReader        INFO
Loading XML bean definitions from ServletContext resource
[/WEB-INF/dispatcher-servlet.xml]
[                          main] CamelNamespaceHandler          INFO  OSGi
environment not detected.
[                          main] DefaultListableBeanFactory     INFO
Pre-instantiating singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@103c29b:
defining beans
[template,consumerTemplate,test123:beanPostProcessor,test123,customURIResolver,tFactory,XMLConverter,viewResolver,/adapter/*.htm,myAdapterManager];
root of factory hierarchy
[                          main] BeanNameUrlHandlerMapping      INFO  Mapped
URL path [/adapter/*.htm] onto handler '/adapter/*.htm'
[                          main] SpringCamelContext             INFO  Apache
Camel 2.7.2 (CamelContext: test123) is starting
[                          main] SpringCamelContext             INFO  JMX
enabled. Using ManagedManagementStrategy.

it getting strucked at "[                          main]
SpringCamelContext             INFO  JMX enabled. Using
ManagedManagementStrategy." and than server is throwing timeout exception, i
even tried by increasing timeout in tomcat but it did not helped

so any one have idea why it is behaving like this

Thanks in advance

Re: Fetching xslt file over HTTP using Camel

Posted by shekher awasthi <sh...@gmail.com>.
will try to do that, but i have already provided what console is showing up
and it is not giving any other exception/error

On Mon, Aug 8, 2011 at 3:17 PM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> You would need to use contentCache=false option to force xslt
> component to re-load the xslt file when a message is processed.
>
> I dont know why you get a timeout exception. Maybe past the stacktrace
> as it may help others with ideas what is the problem.
>
>
>
> On Mon, Aug 8, 2011 at 7:03 AM, shekher awasthi
> <sh...@gmail.com> wrote:
> > Hi All,
> >
> > Till now i was able to work in smooth way with camel but the moment we
> > started working on xslt component it giving a lot of issues, earlier we
> were
> > facing issues in fetching xslt file to covert XML to our custom format
> XML,
> > when we were trying to fetch xsl file form the path outside the classpath
> > camel was unable to recognize that path below is the discussion thread
> >
> >
> http://camel.465427.n5.nabble.com/Custom-URIResolver-for-Camel-td4665485.html
> >
> > though we solved the problem but now we are trying to fetch xls file over
> > HTTP so that we can provide  flexibility to change file at any time
> without
> > any server restart or major change.
> > for testing we placed the file in our web-application under following
> > location
> >
> > webContent
> >      ----------------sxlt
> >                          ----XMLConverter.xls
> >
> > and we are able to open this file on the web browser which indicates that
> > the file is accessible over HTTP (we are using tomcat )
> >
> > here is the line of code we are using to fetch xsl over HTTP
> >
> >  <route id="test">
> >      <from uri="file://target/inventory/updates?noop=true"/>
> >          <unmarshal>
> >                <csv />
> >            </unmarshal>
> >       <to uri="bean:XMLConverter?method=processCSVInvoice" />
> >       <to uri="xslt:http://localhost:7777/Adapt/xslt/XMLConverter.xsl"/>
> >      <to uri="file://target/inventory/updates/test?fileName=test11.xml"/>
> >    </route>
> >
> > but this is not working as we are getting server timeout error and if i
> will
> > remove this line
> >
> > <to uri="xslt:http://localhost:7777/Adapt/xslt/XMLConverter.xsl"/>
> > with
> > <to
> >
> uri="xslt:file:///C://target\\inventory\\updates\\xlsconvertor\\XMLConverter.xsl"/>
> >
> > things will start working out here is the out put from console
> >
> > INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
> > Aug 8, 2011 10:18:03 AM org.apache.catalina.core.ApplicationContext log
> > INFO: Initializing Spring FrameworkServlet 'dispatcher'
> > [                          main] DispatcherServlet              INFO
> > FrameworkServlet 'dispatcher': initialization started
> > [                          main] XmlWebApplicationContext       INFO
> > Refreshing WebApplicationContext for namespace 'dispatcher-servlet':
> startup
> > date [Mon Aug 08 10:18:03 IST 2011]; root of context hierarchy
> > [                          main] XmlBeanDefinitionReader        INFO
> > Loading XML bean definitions from ServletContext resource
> > [/WEB-INF/dispatcher-servlet.xml]
> > [                          main] CamelNamespaceHandler          INFO
>  OSGi
> > environment not detected.
> > [                          main] DefaultListableBeanFactory     INFO
> > Pre-instantiating singletons in
> >
> org.springframework.beans.factory.support.DefaultListableBeanFactory@103c29b
> :
> > defining beans
> >
> [template,consumerTemplate,test123:beanPostProcessor,test123,customURIResolver,tFactory,XMLConverter,viewResolver,/adapter/*.htm,myAdapterManager];
> > root of factory hierarchy
> > [                          main] BeanNameUrlHandlerMapping      INFO
>  Mapped
> > URL path [/adapter/*.htm] onto handler '/adapter/*.htm'
> > [                          main] SpringCamelContext             INFO
>  Apache
> > Camel 2.7.2 (CamelContext: test123) is starting
> > [                          main] SpringCamelContext             INFO  JMX
> > enabled. Using ManagedManagementStrategy.
> >
> > it getting strucked at "[                          main]
> > SpringCamelContext             INFO  JMX enabled. Using
> > ManagedManagementStrategy." and than server is throwing timeout
> exception, i
> > even tried by increasing timeout in tomcat but it did not helped
> >
> > so any one have idea why it is behaving like this
> >
> > Thanks in advance
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Re: Fetching xslt file over HTTP using Camel

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You would need to use contentCache=false option to force xslt
component to re-load the xslt file when a message is processed.

I dont know why you get a timeout exception. Maybe past the stacktrace
as it may help others with ideas what is the problem.



On Mon, Aug 8, 2011 at 7:03 AM, shekher awasthi
<sh...@gmail.com> wrote:
> Hi All,
>
> Till now i was able to work in smooth way with camel but the moment we
> started working on xslt component it giving a lot of issues, earlier we were
> facing issues in fetching xslt file to covert XML to our custom format XML,
> when we were trying to fetch xsl file form the path outside the classpath
> camel was unable to recognize that path below is the discussion thread
>
> http://camel.465427.n5.nabble.com/Custom-URIResolver-for-Camel-td4665485.html
>
> though we solved the problem but now we are trying to fetch xls file over
> HTTP so that we can provide  flexibility to change file at any time without
> any server restart or major change.
> for testing we placed the file in our web-application under following
> location
>
> webContent
>      ----------------sxlt
>                          ----XMLConverter.xls
>
> and we are able to open this file on the web browser which indicates that
> the file is accessible over HTTP (we are using tomcat )
>
> here is the line of code we are using to fetch xsl over HTTP
>
>  <route id="test">
>      <from uri="file://target/inventory/updates?noop=true"/>
>          <unmarshal>
>                <csv />
>            </unmarshal>
>       <to uri="bean:XMLConverter?method=processCSVInvoice" />
>       <to uri="xslt:http://localhost:7777/Adapt/xslt/XMLConverter.xsl"/>
>      <to uri="file://target/inventory/updates/test?fileName=test11.xml"/>
>    </route>
>
> but this is not working as we are getting server timeout error and if i will
> remove this line
>
> <to uri="xslt:http://localhost:7777/Adapt/xslt/XMLConverter.xsl"/>
> with
> <to
> uri="xslt:file:///C://target\\inventory\\updates\\xlsconvertor\\XMLConverter.xsl"/>
>
> things will start working out here is the out put from console
>
> INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
> Aug 8, 2011 10:18:03 AM org.apache.catalina.core.ApplicationContext log
> INFO: Initializing Spring FrameworkServlet 'dispatcher'
> [                          main] DispatcherServlet              INFO
> FrameworkServlet 'dispatcher': initialization started
> [                          main] XmlWebApplicationContext       INFO
> Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup
> date [Mon Aug 08 10:18:03 IST 2011]; root of context hierarchy
> [                          main] XmlBeanDefinitionReader        INFO
> Loading XML bean definitions from ServletContext resource
> [/WEB-INF/dispatcher-servlet.xml]
> [                          main] CamelNamespaceHandler          INFO  OSGi
> environment not detected.
> [                          main] DefaultListableBeanFactory     INFO
> Pre-instantiating singletons in
> org.springframework.beans.factory.support.DefaultListableBeanFactory@103c29b:
> defining beans
> [template,consumerTemplate,test123:beanPostProcessor,test123,customURIResolver,tFactory,XMLConverter,viewResolver,/adapter/*.htm,myAdapterManager];
> root of factory hierarchy
> [                          main] BeanNameUrlHandlerMapping      INFO  Mapped
> URL path [/adapter/*.htm] onto handler '/adapter/*.htm'
> [                          main] SpringCamelContext             INFO  Apache
> Camel 2.7.2 (CamelContext: test123) is starting
> [                          main] SpringCamelContext             INFO  JMX
> enabled. Using ManagedManagementStrategy.
>
> it getting strucked at "[                          main]
> SpringCamelContext             INFO  JMX enabled. Using
> ManagedManagementStrategy." and than server is throwing timeout exception, i
> even tried by increasing timeout in tomcat but it did not helped
>
> so any one have idea why it is behaving like this
>
> Thanks in advance
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/