Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to generate a xml file on webwork action?

Deleted user August 7, 2015

Hi everyone,

I created a webwork1 plugin an need somebody to tell me how can I marshall an action class in a way when I submit a form on a submit button, so it generates an xml file. At moment I tried with JAXB but no luck.

I put the marshal logic in doExecute() method, nothing happened. After that try to put logic implementation in execute() method of the action class but still nothing...Where do I need to put the marhsalling implementation so when I click the submit button it executes my block of code?

 

Best Regards,

Ivan

10 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Deleted user August 12, 2015

I managed to set tomcat in debug mode. Just type: 'catalina.sh jpda start'. The doExecute method is not even called, so I added a new method 'createXML' which has the logic. The method is called in vm. The exception I get is "java.io.FileNotFoundException: C:\\Users\\user\\Desktop\\XMLtest.xml (No such file or directory) ". JIRA is on linux machine, but I access it via browser in windows OS. I will google it for a answers.

0 votes
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2015

sure, atlas-debug is part of the SDK and it will not work for your installed JIRA. So you need to find how to run your Tomcat in debug mode. I remember I used to add jpda args in catalina.sh.

0 votes
Deleted user August 12, 2015

That is the problem. The development instance that is instantied via atlas SDK (e.g. localhost:2990/jira), doesn't have the jira configuration and all custom field that we have on our JIRA (e.g. hostName:8080/jira). I think that the 'atlas-debug' is going to work only on atlassian SDK app instance? This is way i tried to run tomcat of our instance via "jpda start" parameter.

0 votes
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 11, 2015
0 votes
Deleted user August 11, 2015

I would try to debug, but I can't get JIRA running in debug mode. Tried with ./bin/startup.sh jpda start. And by default if nothing is specifyed in JVM arguments, the remote port should be 5005. I don't even see if that port is listening????

0 votes
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 7, 2015

Ok. So you are not returning the XML but rather storing it on file system. Can you debug doExecute method? It' supposed to be triggered by YourWebWorkClass.jspa URL.

0 votes
Deleted user August 7, 2015

I found something similar, but it is not webwork1 plugin: https://developer.atlassian.com/jiradev/jira-architecture/building-jira-add-ons/jira-plugins2-overview/jira-plugin-module-types/search-request-view-plugin-module# -------- but the vm is hardcoded for xml tags, which I don't want.

0 votes
Deleted user August 7, 2015

doExecute() looks like this: ======= public String doExecute()throws Exception{ try{ JAXBContext context = JAXBContext.newInstance(xmlMarshaling.getClass()); Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); marshaller.marshal(xmlMarshaling, new File("C:\\Users\\user\\Desktop\\testXML.xml")); marshaller.marshal(xmlMarshaling, new File("/home/jira/jira-home/testXML.xml")); }catch(JAXBException e){ e.printStackTrace(); } return SUCCESS; } ======

0 votes
Deleted user August 7, 2015

Hi Volodymyr, yes, I want the XML file as response. I have a velocity template page with a form where I have 2 input fields and 2 textarea and 1 submit button. I have an action class named 'XMLMarshaling' that is mapped to that velocity template. When i fill this four fields on the .vm I managed to store the user input (FormData) into variables of a java class. What I want is, when I click the 'Submit' button, the variables of a java class that are initialized from user input, schould be exportet to XML file. After I got that XML file I would put that XML file somewhere in database (would add some column to store the file). Do you have any suggestions? Best Regards, Ivan

0 votes
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 7, 2015

Do you want to return XML as response to your web page?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events