From: Victor B. <vb...@gm...> - 2007-05-30 20:54:26
|
Hi Leonid, You need to check out MantisConnect. It provides a PHP web service and a .NET, Java and Cocoa client libraries. http://www.futureware.biz/mantisconnect/ On 5/30/07, Leonid Lastovkin <leo...@gm...> wrote: > Hi, do not have a lot of experience working with web programming/http > protocols. Hopefully this is an easy question for some of you. > > [By the way, the client that submits bugs will be running on a > windows-based platform.] > I am trying to implement a module in C#; I am considering using a > command-line script as well if one works. So far I was not able to get > it to work. From what I understood, the sequence of the steps is the > following: > > ========== > // Manual info gathering > A. Open link http://<server_addr>/mantis/login_page.php in web > browser, examine form details (there is an add-on for Mozilla that > makes it easy) > B. Log in with credentials, click "Report Issue" > C. Examine forms http://<server_addr>/mantis/bug_report_page.php > ========== > In code: > ========== > 1. Connect to http://<server_addr>/mantis/login_page.php > 2. Login using HTTP POST method > 3. Store all of the cookies > 4. Read the response - you should be getting contents of the "my view" page. > 4. Connect to http://<server_addr>/mantis/bug_report_page.php > 5. Submit a bug properly (some if not all selection boxes require > enums like 10, 20, ... as opposed to string values such as "minor", > "major", etc.) > 6. Read the response. No errors should occur. Figure out the bug > number from the generated html. > ========== > > * I've tried to base my C# code on: > http://geekswithblogs.net/rakker/archive/2006/04/21/76044.aspx > Unfortunatelly the author did not think of having to pass cookies back > and forth, hence I cannot use it. If you see an easy way to modify it > to get it to do what I want, please let me know. > > * The next best solution would be writing a Perl script that takes a > bug's summary and description on command line, and then submits it > keeping other parameters default: severity, priority, etc. Again, I > found some simple general examples of http post, but nothing involved. > > * I would also consider a Python or a Ruby solution > > * I would use some other command-line-based tool if I can get it to > work. I downloaded wget for windows and came pretty close to doing > what I want: I can login to initial page and store all cookies. I can > then use the same cookies to connect to a different page and try to > submit a bug. What I get in response is an HTML showing a form that is > filled in with the values I want, but I still need to press the submit > button. ... Perhaps this is because the "report an issue" has multiple > forms, or because the form is missing the "action" target, not unlike > this: <form action="jump_to_bug.php" ... > ... or could be something > else. > > Anyway, these are my two scripts that almost get the job done [you > need wget http://www.gnu.org/software/wget/index.html#downloading]: > > ========== > wget --keep-session-cookies --save-cookies cookies.txt --post-data > "username=<user>&password=<pass>" http://<server>/mantis/login.php > ========== > > And then: > > ========== > wget -A "bug_report_page.php" --load-cookies cookies.txt -np -r > --post-data "m_id=0&project_id=1&handler_id=0&category=10&reproducibility=10&severity=50&product_version=80&summary=this_is_a_test&description=A_test_indeed" > http://<server>/mantis/bug_report_page.php > ========== > > Questions regarding these scripts: > Q1: Can anyone get it to work? > Q2: If Q1 is Yes, then how do I submit a bug that has spaces in its > summary and description, and/or the description is multi-line? > > Kind regards, > > - Leonid > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > mantisbt-help mailing list > man...@li... > https://lists.sourceforge.net/lists/listinfo/mantisbt-help > |