The title says it all. I couldn't find an example of a Smooks config mapping a POJO to a CSV.
OOTB, Smooks doesn't have a writer that is specific to CSV. Use Smooks's template cartridge (i.e., Freemarker or StringTemplate) or develop a visitor to read from the SAX stream and generate CSV.
Related
Does any of you know any open-source API where the following input output can be processed and generated:
Input: CSV File
Output: Graph/Chart representing the simple CSV**
I need to consume an API like this in my Spring Boot Project, to save time for having to write all the code myself.
How to parse HDF files(.h5) using Apache Tika.
Apache Tika provides parser for .h5 files, but Using that I'm not able to parse the data.
Parser parser=new HDFParser();
Metadata metadata=new Metadata();
ContentHandler handler=new BodyContentHandler();
FileInputStream fileInputStream=new FileInputStream(path+h5File);
parser.parse(fileInputStream,handler,metadata,new ParseContext());
I can see metadata of file, but I can't get content using handler.
If anyone has done this, Please help me through this.
Simply you can't for the nature of HDF format file.
You have to use metadata.get(field-name-in-string-format); for retrieving information you want.
Alternatively you can try directly this Java library: NetCDF (which it is used, under the hood, by Tika)
I am receiving an xml file and my requirement is to create an edifact
file from that xml. But in the dataweaver component of mule, there is
not support for edifact file formats. So is there a way I can generate
an edifact in mule from dataweaver or any other component.
If you want to generate valid edi documents then you should use edifact-module in mule. It looks complicated but once you start it its really easy. You just need to understand EDI Schema Language (ESL) which is a predefined structure in Mule. You can use DataWeave with output type as application/java. Then pass this output to EDI Connector and it should be able to output EDI document.
I recently used X12 EDI connectors and was able to get it working once I understood ESL. Mule documents https://docs.mulesoft.com/anypoint-b2b/edifact-module should be the good place to start.
this component suits your needs ?
https://docs.mulesoft.com/anypoint-b2b/edifact-module
How can i create a simple api using mulesoft stodio? I am using the MySql Database and trying to create REST apis and following this tutorial.
http://www.mulesoft.org/documentation/display/current/Creating+an+API+for+a+MySQL+Database
But facing the error
Error executing graph: ERROR (com.mulesoft.mule.module.datamapper.api.exception.DataMapperExecutionException). Message payload is of type: ArrayList
You have something wrong with your DataMapper definitions, probably a mismatch between the data coming from MySql and the data types for the fields in your DataMapper. Check your data types, the complete error message in Mule Studio, and the output of the Logger between the MySql component and DataMapper if you have a configuration similar to the example in the tutorial.
i was in assumption that the data mapper source data does not match with the payload it received.
according to error , the data-mapper input is of some format you defined but the received input is of array-list.
I am getting the 404 response on the link that you had mentioned in your question.
Your error is not related to what you were asking about How to create Rest API in mule.
As per concern about creating Rest API mule offers two ways:
Using the Rest Component (Recommended when you have rest specification defined in java using the jersey or apache-axis)
ApiKit Router with RAML (Higly recommended by mulesoft community)
As per your concern about error.
you might have not properly mapped the input fields of datamapper with the outbound messages from DB connector.
DB Connector always returns the response as ArrayList that need to be caste into any collection like Map or Array.
I recommend kindly use data sense feature of mulesoft DB connector that will automatically map the input fields of data mapper.
if possible share your flow.
Hope this helps.
Check the inbound properties of data mapper. output of DB query should not be in unknown format. If it is unknown format, then there is something wrong with your query output.
If you are looking for API creation, then check out the below link.
https://docs.mulesoft.com/anypoint-platform-for-apis/walkthrough-design-existing
check the document how to create API
https://docs.mulesoft.com/anypoint-platform-for-apis/
and regarding the DataMapper error just check the input data type to the output data type you are mapping. just cross check the input format to output format.
I suggest to use data weave now . Data mapper is obsolete . Define metadata for your HTTP end by giving some sample JSON and with database you will automatically get metadata extracted by data sense. Now you can use drag and drop for mapping your fields and it will transform input to requited output. you can also look data weave expression generated and now you can change that easily to tweak that.
I want to post a message to a SOAP webservice with MULE Enterprise edition.
For creating the Request object i am using a data mapper with the
input a POJO and for
the output i selected XML , and from example XML schema i added my own XSD.
Because there are a lot of elements in the xsd, i selected the root element from the list provided.
Then i am dragging the fields from input to the corresponding values i want in the output.
(i also tried to map just one field, to be sure that i keep the minimum the probability for error).
And now the problem:
when the flow is accessed, the following WARN is shown and the data-mapper fails
*[XML WRITER:EXT_XML_WRITER0] - Invalid mapping (With port binded to root element, result might contain multiple root elements. Such XML is not well-formed. To avoid that, set 'Records per file' or 'Max number of records' component attribute to '1'.)*
Where can i set this kind of options in the data mapper ?
And also i want the root element to be only one, i don't need a foreach for the root element, i just need to fill the contents of it. Can i specify this anywhere in the data mapper ?
Thanks.
Mule EE DataMapper uses CloverETL for data transformations, and this annoying warning concerns CloverETL settings. I don't know if you can advise CloverETL to use a specific configuration file in the context of Mule DataMapper, but you can always edit the mapping file generated by Mule with a text editor. Just find your root Node entry in the mapping file and add recordsPerFile="1" attribute.
The problem with this is that Mule may overwrite your manual edits if you use the graphical editor, though.
Check out the Anypoint Studio May 2014. Mule now includes a new Web Service Connector for posting messages to a SOAP web service using just a WSDL. Studio will read the XML Schema from the WSDL and automatically create the metadata for DataMapper for you. See http://www.mulesoft.org/documentation/display/current/Web+Service+Consumer for more details.