DragnetWebService Missing items?

If you are having a problem using Dragnet, post a message here.

Moderator: SourceGear

Locked
95se5m
Posts: 4
Joined: Thu Nov 30, 2006 2:46 pm

DragnetWebService Missing items?

Post by 95se5m » Thu Nov 30, 2006 2:56 pm

Hello all, I am trying to have my application post external items if there is an error, my problem is that the DragnetWebService item seems to be missing at least 2 important items that the examples on this site include. Namely the dws.URL and the dws.CookieContainer, and obviously without these I cannot use the dws.AddItemExternal. I have version 1.0.7.1379. Am I being an idiot or am I missing something really important here?

I am using VB.NET 2005 and have Dragnet.dll and Dragnetlib.dll referenced.

Here's an example of what I am trying to do.

Code: Select all

        Dim retValue As Int32 = -1
        Dim cc As New Net.CookieContainer
        Dim mItem As New MantisItem
        Dim dws As New DragnetWebService

        With mItem
            .ProjectID = 103
            .Version = My.Application.Info.Version.ToString
            .TypeID = 2
            .PlatformID = 101
            .CategoryID = 0
            .Description = "This is a bug test"
            .Details = "This is a detail test"
            .Custom1 = "Site Name"
            .Custom2 = "QuickBooks Version 2005"
        End With

           'This block is what's missing, I wrote it here but these properties are not actually avaliable.
           '***************************
        With dws
              .CookieContainer = cc
              .url = "http://localhost/dragnet/dragnetwebservice.asmx"
        End With
           '***************************

        retValue = dws.AddItemExternal(mItem)
        MessageBox.Show(retValue)
Any help to prevent further loss of hair over this would be greatly appreciated.

mskrobul
Posts: 490
Joined: Wed Jan 14, 2004 10:22 am
Location: SourceGear
Contact:

Post by mskrobul » Thu Nov 30, 2006 5:22 pm

I am not sure why you aren't seeing those properties. I know they can be seen because Vault uses the Dragnet web service to update Dragnet (and Vault can see and set those properties).

In your code "Dim dws As New DragnetWebService"
DragnetWebService is the name of the web reference to the Dragnet Web Service, right?

You shouldn't need to reference the Dranget .dlls in your project when using the web service. You should use the WebService classes and types when going through the webservice or you will have problems (use DragnetWebService.MantisItem, not DragnetLib.MantisItem because DragnetWebService.MantisItem is what the web service wants).
Mary Jo Skrobul
SourceGear

95se5m
Posts: 4
Joined: Thu Nov 30, 2006 2:46 pm

Post by 95se5m » Fri Dec 01, 2006 10:41 am

mskrobul wrote:I am not sure why you aren't seeing those properties. I know they can be seen because Vault uses the Dragnet web service to update Dragnet (and Vault can see and set those properties).

In your code "Dim dws As New DragnetWebService"
DragnetWebService is the name of the web reference to the Dragnet Web Service, right?

You shouldn't need to reference the Dranget .dlls in your project when using the web service. You should use the WebService classes and types when going through the webservice or you will have problems (use DragnetWebService.MantisItem, not DragnetLib.MantisItem because DragnetWebService.MantisItem is what the web service wants).
Well thanks to Mary in the quoted post I got it to work, here is example code for those others who wish to do this as well.

First create a web reference to http://localhost/dragnet/dragnetwebservice.asmx asuming you have a copy locally as I do.

Then, create the code block:

Code: Select all

    Public Function PostIssue() As Int32
        Dim retValue As Int32 = -1
        Dim cc As New Net.CookieContainer
        Dim mItem As New localhost.MantisItem
        Dim dws As New localhost.DragnetWebService

        With dws
            .CookieContainer = cc
            .Url = "http://localhost/dragnet/dragnetwebservice.asmx"
        End With

        With mItem
            .ItemAccessType = localhost.AccessType.Public
            .ProjectID = 101
            .Version = "1.0.0.0"
            .TypeID = 2 'For Bug
            .PlatformID = 101
            .CategoryID = 0
            .Description = "Some description"
            .Details = "The details"
            .Custom1 = "Custom Info 1"
            .Custom2 = "Custom Info 2"
        End With

        retValue = dws.AddItemExternal(mItem)
        Return retValue
    End Function
And assuming dragnet is running locally on the PC, you're done. Obviously for remote posting, change localhost to the domain the site is being hosted on.

Hope this helps others out there trying to do the same... Good luck.

Locked