WebServices help

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

Moderator: SourceGear

Locked
bobby_avram
Posts: 5
Joined: Fri Nov 10, 2006 8:34 am

WebServices help

Post by bobby_avram » Fri Nov 10, 2006 8:43 am

I have the same problem like this guy here: http://support.sourcegear.com/viewtopic.php?t=5641
I want to use web services to build a client that will allow me to integrate dragnet with another application. When I try to get project from db I get the following error:
{System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: 1004: Session Timed Out
at Mantis.DragnetWebService.ThrowSoapException(Exception e, Int32 nStatusCode, XmlQualifiedName code)
at Mantis.DragnetWebService.CheckAuthValidity(HttpSessionState hss, DragnetAuth ma)
at Mantis.DragnetWebService.ListProjects(MantisProject[]& mProjects)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at TSF.Bugtracker.Dragnet.DragnetWebService.ListProjects(MantisProject[]& mProjects) in C:\Documents and Settings\Admin\My Documents\Visual Studio 2005\Projects\TSF.Bugtracker\TSF.Bugtracker\Web References\Dragnet\Reference.cs:line 456
at TSF.Bugtracker.Bugtracker.Bugtracker_Load(Object sender, EventArgs e) in C:\Documents and Settings\Admin\My Documents\Visual Studio 2005\Projects\TSF.Bugtracker\TSF.Bugtracker\Bugtracker.cs:line 91}

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

Post by jclausius » Fri Nov 10, 2006 11:50 am

From the looks of the stack trace, you don't have a cookie set for authentication.

Does your web request contain a valid cookie container? Before your first request make sure you have a created cookie container, and then check after the call, the authentication ticket is set before making any other web service calls.
Jeff Clausius
SourceGear

bobby_avram
Posts: 5
Joined: Fri Nov 10, 2006 8:34 am

RE: WebServices help

Post by bobby_avram » Mon Nov 13, 2006 3:26 am

This is the code that I am using:

int ret = -1;
string authTicket;
Dragnet.MantisProject[] Projects;

Dragnet.DragnetWebService dws = new Dragnet.DragnetWebService();
ret = dws.LoginPlainText("admin", "bobby", out authTicket);
if (0 == ret)
{
dws.DragnetAuthValue = new Dragnet.DragnetAuth();
dws.DragnetAuthValue.Token = authTicket;

CookieContainer cc = new CookieContainer();
dws.CookieContainer = cc;

// get a list of projects
ret = dws.ListProjects(out Projects);
foreach (Dragnet.MantisProject current in Projects)
{
if (current.Active)
{
// get all the incidents in this project
Dragnet.MantisItemQueryFilter qf = new Dragnet.MantisItemQueryFilter();
Dragnet.MantisItemExpanded[] items;
qf.Projects[0] = current.ID;
ret = dws.QueryItems(qf, true, out items);
}
}
}


Maybe now it's more clear. I will appreciate any suggestions.

bobby_avram
Posts: 5
Joined: Fri Nov 10, 2006 8:34 am

RE: WebServices help

Post by bobby_avram » Mon Nov 13, 2006 3:40 am

I've created a cookie container before the call of LoginPlainText() like that
Dragnet.DragnetWebService dws = new Dragnet.DragnetWebService();
CookieContainer cc = new CookieContainer();
dws.CookieContainer = cc;

ret = dws.LoginPlainText("admin", "bobby", out authTicket);
and it worked.

Thank you Jeff.

Bobby.

Locked