I have the following requirement :
“Copy a Zip file from a sftp server to a directory on a local server, then unzip the file and extract 2 Xml files from inside it to process in our message service we have setup within our ESB.”
I have done some several searches over the past week on the internet, as well as read several topics in the Wso2 documentation but I cannot find a clean way to implement this requirement. I found this question asked on stackoverflow already - https://stackoverflow.com/questions/27806557/wso2-esb-extracting-and-processing-zip-files
However, I did not see where there were any suggestions/solutions provided. My first thought is to build a sequence with a class mediator to handle the extraction of the 2 xml files I need from the zip file, but maybe there is a better approach?
Is there any recommendations, links, or other references that folks could provide or suggest that would help me move forward with implementing this requirement? Or is this something I will need to handle outside of ESB via script with cron control?
Please kindly note that I'm assuming that you are using ESB 4.8.1
Since this is a specific requirement we don't have an out of the box solution for your scenario. However, you can easily do this using WSO2's VFS transport and a custom class mediator. The procedure would be:
Read your zip file using VFS Transport and save it in your local server.
Next, create a class mediator which unzip your zip file and then read your XML files. For more details about how to write a class mediator please refer Class Mediator.
If you need more help regarding this issue please let me know.
Thanks,
Upul
In the newer version of the ESB, the File Connector supports zip/unzip operations: https://docs.wso2.com/display/ESBCONNECTORS/Working+with+the+File+Connector+Version+2
Related
I need your help.
How can I get logs in WSO2 EI while WAR is deploying?
I want to see the process and get the errors like in standalone Tomcat instance.
Is it possible?
I've tried to change log level at log4j.properties, catalina-server.xml and many others. But there is still no result.
Kind Regards,
Kirill
I found the next solution:
In file /opt/ame-a/repository/conf/log4j.properties
set
log4j.logger.org.apache.catalina=DEBUG
This way you will be able to implement logging realization inside your application and put application logs wherever you need, for example, I put it to
/opt/ame-a/lib/tomcat/logs/monitor.log
You need to setthe log level in the logging-bridge.properties file.
Open wso2as/repository/conf/etc/logging-bridge.properties file and put org.apache.catalina.level=FINEST
I need to create a service that will receive an XML feed at any given time that will have data related to a content-type.
Could someone please advise me what modules i should use to develop a solution.
So
Another server will post a xml feed with instruction add/delete/update content in the xml
I will require to update the content type from the XML feed post
I have previously used the migrate module but this is run on my side through cron or manual. The main difference here is that i could receive the post from the other server at any given time or possibly multiple concurrent posts.
This sounds like a job for the Services 3 module. You can make a resources module to that which parses your xml file an does the work for you. The services module is handling rest/rpc connections for you.
I create input and output streams in my WSO2 CEP (v3.1.0) with event formatter and event builder as well. I need to find out where this streams are created in WSO2 CEP catalog structure, becasue I can't find it beyond event builder and formatter (wso2cep-3.1.0\repository\deployment\server).
Has anyone know where I can find this streams files?
Kacu
I managed to load streams via xml (only during startup), by modifying the stream-definitions.xml file in this folder wso2cep-3.1.0/repository/conf/data-bridge.
You can take a look at this page in the documentation for more details, just keep in mind that the location written in the documentation doesn't match what I found in the server.
In CEP 3.1.0, event streams are stored in the registry (which comes with CEP), it is not stored in filesystem. Streams can be located under governance section of the registry (See streamdefinitions sub directory)..
Regards,
Mohan
I am working with WSO2 Data Service version 2.6. In this version the tool for contract firts service generation has been removed due to a bug, and it will be realease again in the next version.
We need to change the way the results are returned. We would like to define our own wsdl and generate an empty data service from it, where we finally set up each operation, data source and configure how the results are mapped to the wsdl schema types.
Is there any way of do this without data service contract first tool?
I'm afraid, there's no straightforward way to do this. You would have to carefully start from creating the data service yourself to make it generate a WSDL that will resemble the WSDL that you would need.
Cheers,
Anjana.
Are there any web services which will allow me to provide a file extension and it would return a list of possible MIME types?
For example:
http://mimetype.com/getMime/doc
Which could return:
application/msword,application/docappl/text,application/vnd.msword,application/vnd.ms-word,application/winword,application/word,application/x-msw6,application/x-msword
I don't want to use Urlmon.dll and I would prefer not having to keep my own list up-to-date.
Thanks
I just created this as part of my mimetype <-> icon service
http://stdicon.com/
For example :
http://stdicon.com/ext/html
It runs on appengine so it should have high availability.
The only thing I could imagine would be parsing the list which comes with the apache server
mime.types. The list is maintained by The Apache Software Foundation and depends on www.iana.org
Though its not exactly what you are asking for, this information is available via search by format in the PRONOM registry. The result is more fine-grained than MIME types, but you can get MIME info if available for the results (e.g. here, in the 'identifiers' section). There is also the DROID tool available to access this information via GUI, Java API or command line interface.
Sorry that I don't have a webservice for the task on hand, but you could use the fileext page and maybe parse the response if you can query the extension programmatically. Maybe a first step in the right direction.
This webservice could be very simple, a small DB / in memory store which could be as simple as a Dictionary<String, String> and just do a key lookup and return the result.
The first dataset could be (for example) based on http://www.webmaster-toolkit.com/mime-types.shtml.
The problem would probably be the hosting of such a webservice.
I don't know if there is a web service that would do this, but the libmagic library (http://en.wikipedia.org/wiki/Libmagic) is used for identifying filetypes and might be helpful for you.
The only thing that comes to mind is to parse output from http://www.file-extensions.org/
It won't give you the MIME type, but the good olde' Microsoft File Association Web Service could still help you. You access it this way:
http://shell.windows.com/fileassoc/0409/xml/redir.asp?Ext=xls
where 0409 means English (US) and xls is the file extension. On the plus side, it will be there and constantly updated... well, until Microsoft decides to pull the plug. Which can happen any time.