How to create an edifact file in data waever component of mule - mule

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

Related

JCAPS EDI standard exchange format to Mule ESL format

I have an EDI SEF (X12 835 template) file which we are using currently. I want to develop application using mule ESB. I have to use X12 connector to read and parse file but in mule i need to pass ".esl" file as schema to parse X12 instead SEF. Is there any way to read EDI (X12 835) and parse it using customized EDI implementation in Mule 3.7.
EDI SEF defines the structure of EDI message. So does Mule ESL. Mule B2B ships with all standard ESL's including the one for X12 835 (check the list here).
If you have customized the standard definitions then it is possible to extend default 835 ESL and create the new one. See here for how to overlay standard schemas.

Create api using mulesoft studio

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.

How can i use the Mule Studio data mapper for producing output generated from a complex XSD schema ?

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.

how to create an output file based on xml data in mule

Im very new to mule so hopefully someone out there can help me out. Im trying to create an output based on a content in my xml
Ex
<Header>
<UniqueID>AAA_12345</UniqueID>
</Header>
Id like the filename to be the the UniqueID ie AAA_1245.xml
I found a few syntax on the net but it doesnt work for me. My syntax is
<file:outbound-endpoint path="${cwMessagesPath}/out" outputPattern="#[xpath:/Header/UniqueID].xml" connector-ref="cwksbDefaultFileConnector" />
for some reason, mule creates #[xpath: as a directory, Header as another directory and then the filename as UniqueID].xml
Im using mule 2.2.1
Thanks for your help.
This should work.
Is cwksbDefaultFileConnector configured in any specific manner?
Also, I think in Mule 2 it was possible to configure other placeholders than #[ ] for expressions. Are expressions working with this syntax elsewhere in your application? If yes, then the problem is different.
Do you run standalone or embedded? If embedded, make sure you have the mule-module-xml dependency in your project's POM.
Finally, what is the payload type of the message that hits the file:outbound-endpoint? Maybe some manual transformation is needed in Mule 2 before using XPath.

How to set http headers in dotCMS

I'm trying to create a XML data feed with dotCMS. I can easily output the correct XML document structure in a .dot "page", but the http headers sent to the client are still saying that my page contains "text/html". How can I change them to "text/xml" or "application/xml"?
Apparently there's no way to do it using the administration console. The only way I found is to add this line of (velocity) code
$response.setHeader("Content-Type", "application/xml")
to the top of the page template.
Your solution is the easiest. However there are other options that are a bit more work, but that would prevent you from having to use velocity to do the XML generation, which is more robust most of the time.
DotCMS uses xstream to generate XML files (and vise versa). You could write a generic plugin to use this as well.
An JSONContentServlet exists in dotCMS that takes a query and generates json or xml (depending on your parameters). It is not mapped on a servlet by default, but that is easy to add.