You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by lekkie <le...@gmail.com> on 2010/01/26 21:49:05 UTC

XML request to CSV conversion

Hi guys,
I'd like to convert a soap request to a csv file. Also, I'd like the element
names to to be the headers for the csv data.

kr.
-- 
View this message in context: http://old.nabble.com/XML-request-to-CSV-conversion-tp27329471p27329471.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: XML request to CSV conversion

Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,

Could you verify that the class you're looking for is packaged inside
your service unit.  If that is the case, could you post the <bean ...>
entry you have in your Camel SU camelContext.xml together with the
ClassNotFoundException you're getting at runtime?

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



On 26 January 2010 22:10, lekkie <le...@gmail.com> wrote:
>
> Thanks for your quick response.
>
> I actually thought about this (bean method), however for some strange
> reason, my custom bean class is not seen by camel context.
>
> This is not the first time I am having this type of error, and I noticed
> (that might not be the problem though, may be just coincidence) that anytime
> my project artifact id is the only package existing in my java src,
> servicemix always says class not found.  This has happened to me twice,
> however, if I have more than one (sub) package in the src, SMX does not
> usually complain.
>
> kr.
>
>
> Jean-Baptiste Onofré wrote:
>>
>> Hi,
>>
>> 1/ First solution: use SMX components
>> First, you need two endpoints:
>> - the first one is CXF-BC or HTTP component based. This endpoint expects
>> incoming SOAP envelop. For exemple, using the HTTP component, the
>> xbean.xml looks like:
>>
>> <beans xmlns:example="http://www.example.org"
>>         xmlns:http="http://servicemix.apache.org/http/1.0">
>>    <http:soap-consumer service="example:stoc"
>>       target="http"
>>       targetService="example:stoc"
>>       targetEndpoint="transform"
>>       locationURI="http://0.0.0.0:8192/example"
>>       wsdl="classpath:stoc.wsdl"/>
>> </beans>
>> - the second one is the file endpoint that write an incomding Normalized
>> Message into a file:
>>
>> <bean xmlns:example="http://www.example.org"
>>        xmlns:file="http://servicemix.apache.org/file/1.0">
>>       <file:sender service="example:stoc"
>>               target="file"
>>               directory="file:target/files"/>
>> </bean>
>> - the third one is the endpoint in the middle (between the HTTP and the
>> file one) that take the soap env (coming from the HTTP endpoint) the in
>> normalized message, transforms to csv format and send to the file
>> endpoint. You can achieve it using servicemix-bean. I let you implement
>> the transformation logic.
>>
>> 2/ Second solution: use Camel
>> Another solution is to use Camel to apply transformation. For example
>> using a velocity template or a bean.
>> For example, using velocity
>> from("jbi:a").to("velocity:myvel.vm").to("file:target/file.csv")
>> or using bean:
>> from("jbi:a").beanRef("mybean",
>> "mytransformmethod").to("file:target/file.csv")
>>
>> where A is a HTTP SOAP endpoint.
>>
>> I hope it helps you.
>>
>> Regards
>> JB
>>
>> lekkie wrote:
>>> Hi guys,
>>> I'd like to convert a soap request to a csv file. Also, I'd like the
>>> element
>>> names to to be the headers for the csv data.
>>>
>>> kr.
>>
>>
>
> --
> View this message in context: http://old.nabble.com/XML-request-to-CSV-conversion-tp27329471p27329815.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>

Re: XML request to CSV conversion

Posted by lekkie <le...@gmail.com>.
Thanks for your quick response.

I actually thought about this (bean method), however for some strange
reason, my custom bean class is not seen by camel context.

This is not the first time I am having this type of error, and I noticed
(that might not be the problem though, may be just coincidence) that anytime
my project artifact id is the only package existing in my java src,
servicemix always says class not found.  This has happened to me twice,
however, if I have more than one (sub) package in the src, SMX does not
usually complain.

kr.


Jean-Baptiste Onofré wrote:
> 
> Hi,
> 
> 1/ First solution: use SMX components
> First, you need two endpoints:
> - the first one is CXF-BC or HTTP component based. This endpoint expects 
> incoming SOAP envelop. For exemple, using the HTTP component, the 
> xbean.xml looks like:
> 
> <beans xmlns:example="http://www.example.org"
>         xmlns:http="http://servicemix.apache.org/http/1.0">
>    <http:soap-consumer service="example:stoc"
> 	target="http"
> 	targetService="example:stoc"
> 	targetEndpoint="transform"
> 	locationURI="http://0.0.0.0:8192/example"
> 	wsdl="classpath:stoc.wsdl"/>
> </beans>
> - the second one is the file endpoint that write an incomding Normalized 
> Message into a file:
> 
> <bean xmlns:example="http://www.example.org"
>        xmlns:file="http://servicemix.apache.org/file/1.0">
> 	<file:sender service="example:stoc"
> 		target="file"
> 		directory="file:target/files"/>
> </bean>
> - the third one is the endpoint in the middle (between the HTTP and the 
> file one) that take the soap env (coming from the HTTP endpoint) the in 
> normalized message, transforms to csv format and send to the file 
> endpoint. You can achieve it using servicemix-bean. I let you implement 
> the transformation logic.
> 
> 2/ Second solution: use Camel
> Another solution is to use Camel to apply transformation. For example 
> using a velocity template or a bean.
> For example, using velocity
> from("jbi:a").to("velocity:myvel.vm").to("file:target/file.csv")
> or using bean:
> from("jbi:a").beanRef("mybean", 
> "mytransformmethod").to("file:target/file.csv")
> 
> where A is a HTTP SOAP endpoint.
> 
> I hope it helps you.
> 
> Regards
> JB
> 
> lekkie wrote:
>> Hi guys,
>> I'd like to convert a soap request to a csv file. Also, I'd like the
>> element
>> names to to be the headers for the csv data.
>> 
>> kr.
> 
> 

-- 
View this message in context: http://old.nabble.com/XML-request-to-CSV-conversion-tp27329471p27329815.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: XML request to CSV conversion

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

1/ First solution: use SMX components
First, you need two endpoints:
- the first one is CXF-BC or HTTP component based. This endpoint expects 
incoming SOAP envelop. For exemple, using the HTTP component, the 
xbean.xml looks like:

<beans xmlns:example="http://www.example.org"
        xmlns:http="http://servicemix.apache.org/http/1.0">
   <http:soap-consumer service="example:stoc"
	target="http"
	targetService="example:stoc"
	targetEndpoint="transform"
	locationURI="http://0.0.0.0:8192/example"
	wsdl="classpath:stoc.wsdl"/>
</beans>
- the second one is the file endpoint that write an incomding Normalized 
Message into a file:

<bean xmlns:example="http://www.example.org"
       xmlns:file="http://servicemix.apache.org/file/1.0">
	<file:sender service="example:stoc"
		target="file"
		directory="file:target/files"/>
</bean>
- the third one is the endpoint in the middle (between the HTTP and the 
file one) that take the soap env (coming from the HTTP endpoint) the in 
normalized message, transforms to csv format and send to the file 
endpoint. You can achieve it using servicemix-bean. I let you implement 
the transformation logic.

2/ Second solution: use Camel
Another solution is to use Camel to apply transformation. For example 
using a velocity template or a bean.
For example, using velocity
from("jbi:a").to("velocity:myvel.vm").to("file:target/file.csv")
or using bean:
from("jbi:a").beanRef("mybean", 
"mytransformmethod").to("file:target/file.csv")

where A is a HTTP SOAP endpoint.

I hope it helps you.

Regards
JB

lekkie wrote:
> Hi guys,
> I'd like to convert a soap request to a csv file. Also, I'd like the element
> names to to be the headers for the csv data.
> 
> kr.