Mantis/DragnetService Call for Item/Category Details?

Post your questions regarding using the Vault and Fortress API in your programs.

Moderator: SourceGear

Post Reply
tom.mcmanus
Posts: 7
Joined: Mon Oct 20, 2008 11:58 am

Mantis/DragnetService Call for Item/Category Details?

Post by tom.mcmanus » Wed Jun 02, 2010 11:28 am

Hi Sourcegear -

Can you point me in the right direction to get a list of Category names and a list of Item type names to populate a listbox/dropdown?

I'm trying to recreate the External Add page, but heavily modified for our production department.

Thanks!

Tom McManus
thomas.mcmanus@cobham.com

jclausius
Posts: 3702
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Re: Mantis/DragnetService Call for Item/Category Details?

Post by jclausius » Wed Jun 02, 2010 12:45 pm

Do you see an API for ListCategories() and ListItemTypes() ? I cannot remember where the namespace where they are implemented, but I believe it should give you what you want.
Jeff Clausius
SourceGear

tom.mcmanus
Posts: 7
Joined: Mon Oct 20, 2008 11:58 am

Re: Mantis/DragnetService Call for Item/Category Details?

Post by tom.mcmanus » Wed Jun 02, 2010 1:10 pm

jclausius wrote:Do you see an API for ListCategories() and ListItemTypes() ? I cannot remember where the namespace where they are implemented, but I believe it should give you what you want.
Hi Jeff -

I do see ListCategories, but when I invoke the webservice, I get

"Server was unable to process request. ---> Object reference not set to an instance of an object."

I'm trying to just create an ASP.NET page that will do most of the external add stuff. That said, I'm no where near conversant with C#/ASP.NET.

I've added web references to my Fortress server, and added the VaultLib & DragnetLib DLLs as references.

My codebehind looks like this :

Code: Select all

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net;
using MantisLib;


namespace External_Add_Replacement
{
    
    public partial class _Default : System.Web.UI.Page
    {
        Dragnet.DragnetWebService dragnetService;
        CookieContainer cc;
        Dragnet.MantisItem mi;
        Dragnet.MantisCategory[] catColl;

        protected void Page_Load(object sender, EventArgs e)
        {
            
            cc = new CookieContainer();
            dragnetService = new Dragnet.DragnetWebService();
            dragnetService.CookieContainer = cc;
            
            mi = new Dragnet.MantisItem();
            mi.ProjectID = 140;
            
            string strAuthTicket = null;
            
            dragnetService.LoginPlainText(--REDACTED--);

            dragnetService.ListCategories(140, out catColl); // Blows up here
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            
            int ret = -1;
            
            mi.CategoryID = 0;
            mi.Description = DescriptionText.Text;
            mi.Details = "External Add sample details";
            mi.PlatformID = 1;
            mi.TypeID = 2;
            mi.Version = "1.0";
            mi.Custom1 = "test";
            mi.Custom2 = "test2";
            mi.ItemAccessType = Dragnet.AccessType.Private;
            
            ret = dragnetService.AddItemExternal(mi);
            
        }
    }

}
And when it hits the ListCategories call it blows up with the above.

This may be C# user error on my part - any thoughts?

Oh, also - do ListCategories/ListItems require a login? I get a sesion invalid error if I don't put in the Login call with my credentials before the ListCategories call.

Thanks!

Tom McManus
thomas.mcmanus@cobham.com

jclausius
Posts: 3702
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Re: Mantis/DragnetService Call for Item/Category Details?

Post by jclausius » Wed Jun 02, 2010 1:39 pm

Tom,

There might be an easier way to do this. Are you wanting to extend for Fortress or for Dragnet?

If this is for Fortress, take a look at using VaultClientIntegrationLib. There are ItemTrackingOperations.xyz() which might be the better route at getting the information.
Jeff Clausius
SourceGear

tom.mcmanus
Posts: 7
Joined: Mon Oct 20, 2008 11:58 am

Re: Mantis/DragnetService Call for Item/Category Details?

Post by tom.mcmanus » Wed Jun 02, 2010 1:47 pm

Jeff -

We are using Fortress, and easier is better! I'll start poking at it.

Basically, I need to create a replacement for the External Add page. Ideally, it'd be a webpage that I can point all of our technicians to and say "Go here to enter bugs."

The External Add page, as is, is a little too unfriendly for our production folks. So I want to create an interface that I can tailor to them.

Will VaultClientIntegrationLib let me do an AddExternalItem, and give me the appropriate datasets for item type, category (per project), etc.?

Thanks again (again)

jclausius
Posts: 3702
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Re: Mantis/DragnetService Call for Item/Category Details?

Post by jclausius » Wed Jun 02, 2010 4:10 pm

I think there are some samples here which you might be able to use or interpret for your project - http://support.sourcegear.com/viewtopic ... 20&start=0

See the example for ProcessCommandAddFortressItem().

HTH
Jeff Clausius
SourceGear

tom.mcmanus
Posts: 7
Joined: Mon Oct 20, 2008 11:58 am

Re: Mantis/DragnetService Call for Item/Category Details?

Post by tom.mcmanus » Thu Jun 03, 2010 8:29 am

Jeff -

OK, things are going pretty well so far, as long as I'm logged into the server as a full-user. I've got the Categories for the project, and the Item types in my dropdowns.

Can you tell me how to hit the server in the same fashion as the External Add page - it seems like I should be able pull the same information that's presented in the External Add page without needing a user to log in as.

Again, ideally I'd like to have more or less the same information as the External Add page.

Thanks again for your time and your help.

jclausius
Posts: 3702
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Re: Mantis/DragnetService Call for Item/Category Details?

Post by jclausius » Thu Jun 03, 2010 9:18 am

Tom,

There isn't anything we've done to support this, and all the API is wrapped around VaultClientIntegrationLib.

With that said, you *might* be able to do this by adding a reference to DragnetServiceLib.dll (and any dependencies) and using Helpers.ListTypes(), Helpers.ListCategories(), and Helpers.AddItemExternal().

This is uncharted waters as I don't know how this will behave outside the entire Fortress Web Site project. It might work, but then again, it may not be possible. Sorry I cannot offer more help/advice than that.
Jeff Clausius
SourceGear

Post Reply