How to use ScrumWorks API with .NET?
I want to use the ScrumWorks API with .NET. Is there any examples that I can have a look at?
-
-
here you go guys... finally managed to get this going
First in Visual Studio, create a Service Reference to your scrumworks webservice. The URL should be, http://yourserver:8080/scrumworks-api...
Make sure that you click on the Advanced button on the Add Service Reference dialog and then further select "Add Web reference" to make a service reference.
Following is the code for further use,
Dim cred = New System.Net.NetworkCredential("administrator", "password")
Dim service As New bkgsdind.ScrumWorksService
service.Credentials = cred
service.PreAuthenticate = True
Try
Dim t As New bkgsdind.getTest
service.getTest(t)
Catch ex As Exception
End Try
Dim prod() As bkgsdind.ProductWSO
Dim bcp As bkgsdind.ProductWSO = Nothing
Dim p As New bkgsdind.getProducts
Dim str As String
prod = service.getProducts(p)
For Each prd As bkgsdind.ProductWSO In prod
Console.WriteLine(prd.name)
If prd.name = "My Prod Name" Then
bcp = prd
End If
Next
Console.WriteLine("************************************************************")
Dim spr() As bkgsdind.SprintWSO
Dim sp As New bkgsdind.getSprints
sp.ProductWSO_1 = bcp
spr = service.getSprints(sp)
For Each s As bkgsdind.SprintWSO In spr
Console.WriteLine("Sprint Name: " & s.name)
Console.WriteLine("Start Date: " & s.startDate)
Console.WriteLine("End date: " & s.endDate)
Console.WriteLine("Goals: " & s.goals)
Console.WriteLine("************************************")
Dim bitem() As bkgsdind.BacklogItemWSO
Dim bit As New bkgsdind.getActiveBacklogItemsForSprint
bit.SprintWSO_1 = s
bitem = service.getActiveBacklogItemsForSprint(bit)
For Each bt As bkgsdind.BacklogItemWSO In bitem
Console.WriteLine("Title: " & bt.title)
Console.WriteLine("Description: " & bt.description)
Console.WriteLine("Completed Date: " & bt.completedDate)
Next
Next
I hope all of you can take it forward...- view 1 more comment
-
-
I hope you can mark this as an answer! :)
-
-
Sort of, unfortunately it doesn't look like I can mark a non-employee answer as the company answer. I have removed my post however to make your answer the first one on the list.
-
-
-
-
Here is a solution for all of you which use C#:
Set Up
=====================
Add a web reference to your project. When asked for a Url, enter http://yourserver:8080/scrumworks-api... to find the service. By default it doesn't create the correct properties in you solution, so please check the following settings:
(I can not provide the correct xml, because it wouldn't show in the reply. So please look for similar expressions in those files.)
-> in *Service.wsdl:
"soap:address location="http://yourserver:8080/scrumworks-api..."
-> in web.config:
add key="ScrumWorksWebReference.ScrumWorksService" value="http://yourserver:8080/scrumworks-api..."
Now the service is set up and ready to use. If you find yourself having problems to establish a connection like described in the next steps, it will most likely be because of a HTTP error 505 (HTTP version not supported). There is a workaround for this. You can find it on http://geekswithblogs.net/scarpenter/...
Establish connection
=====================
private ScrumWorksService connectToService(string user, string password)
{
NetworkCredential credentials = new NetworkCredential(user, password);
ScrumWorksService service = new ScrumWorksService();
service.Credentials = credentials;
service.PreAuthenticate = true;
// Test connection with web service
try
{
getTest getTestMethod = new getTest();
service.getTest(getTestMethod);
}
catch (Exception ex)
{
Label1.Text = string.Format("Error: Connection failed ({0})", ex.Message);
}
return service;
}
Get data
=====================
To get all products use this code:
private ProductWSO[] getProductsArray(ScrumWorksService service)
{
getProducts getProductsMethod = new getProducts();
return service.getProducts(getProductsMethod);
}
To get all sprints of a product, use this code:
private SprintWSO[] getSprintArray(ScrumWorksService service, ProductWSO product)
{
getSprints getSprintsMethod = new getSprints();
getSprintsMethod.ProductWSO_1 = product;
return service.getSprints(getSprintsMethod);
}
It is similar for all data.
Update data
=====================
If you want to change data, e.g. the title of a story (backlog item), you have to submit your changes:
private void setStoryTitle(ScrumWorksService service, BacklogItemWSO backlogItem, string title)
{
backlogItem.title = title;
updateBacklogItem updateBacklogItem = new updateBacklogItem();
updateBacklogItem.BacklogItemWSO_1 = backlogItem;
service.updateBacklogItem(updateBacklogItem);
} -
-
Sorry to bring this back from the dead but I'm having problems with adding the API to C#.NET 2010.
I followed the post above, but noticed that the items that were told to change, were already as they should be.
Steps:
Added service reference.
Clicked "Advanced"
Entered the URL (http://yourserver:8080/scrumworks-api...)
Clicked "Add Reference"
When I compile the solution I get the following error:
Error 1 Could not load file or assembly 'file:///h:\business documents\visual studio 2010\Projects\Application Manager\scumworks\obj\Release\scumworks.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) h:\business documents\visual studio 2010\Projects\Application Manager\scumworks\SGEN SWservice
Any thoughts?-
I just want to chime in real quick and say that I hope someone in our community will be able to help you on this question, I don't believe we have any .net devs that will be able to answer this one for you.
-
-
A note on this. It seems that this is a project issue. I created a new class library and was able to successfully consume the web service. I don't know what the problem is with my existing solution.
Update:
I consumed the webservice in VS 2010 perfectly. Then after a few minutes I went to rebuild the solution and was getting the same error. I'm quite confused.
Thank you. -
-
-
-
-
I know that this could be more efficient, but it works for now. I wanted to show how I was able to get data from the WSO objects. I hope this will help people using this API.
(Note: This is in a .DLL file)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ScrumWorks.scrumpro;
using System.Net;
using System.Collections;
namespace AM_APP
{
public class ScrumWorks
{
ScrumWorksService service = new ScrumWorksService();
ProductWSO product = new ProductWSO();
SprintWSO sprint = new SprintWSO();
BacklogItemWSO backlog = new BacklogItemWSO();
public Boolean SWauthorization(string userName, string password)
{
NetworkCredential credentials = new NetworkCredential(userName, password);
service.Credentials = credentials;
service.PreAuthenticate = true;
getAuthenticatedTest testAuth = new getAuthenticatedTest();
try
{
service.getAuthenticatedTest(testAuth);
return true;
}
catch
{
return false;
}
}
///
/// Gets array of products
///
/// Array of products
public ArrayList SWproducts()
{
getProducts getProductsMethod = new getProducts();
ProductWSO[] productArray = new ProductWSO[1];
ArrayList returnList = new ArrayList();
productArray = (ProductWSO[])service.getProducts(getProductsMethod);
for (int x = 0; x < productArray.Length; x++)
{
product = productArray[x];
returnList.Add(product.name);
}
return returnList;
}
///
/// Sets product
///
/// Selected product name
public void SWselectedProduct(string productName)
{
getProducts getProductsMethod = new getProducts();
ProductWSO[] productArray = new ProductWSO[0];
ArrayList returnList = new ArrayList();
productArray = (ProductWSO[])service.getProducts(getProductsMethod);
for (int x = 0; x < productArray.Length; x++)
{
product = productArray[x];
if (product.name == productName)
{
break;
}
}
}
public ArrayList SWreleases()
{
return null;
}
///
/// Gets array of sprints
///
/// Array of sprints
public ArrayList SWsprints()
{
getSprints getSprintsMethod = new getSprints();
SprintWSO[] sprintArray = new SprintWSO[0];
ArrayList returnList = new ArrayList();
getSprintsMethod.ProductWSO_1 = product;
sprintArray = (SprintWSO[])service.getSprints(getSprintsMethod);
for (int x = 0; x < sprintArray.Length; x++)
{
sprint = sprintArray[x];
returnList.Add(sprint.name);
}
return returnList;
}
///
/// Sets sprint
///
/// Selected sprint name
public void SWselectedSprint(string sprintName)
{
getSprints getSprintsMethod = new getSprints();
SprintWSO[] sprintArray = new SprintWSO[0];
ArrayList returnList = new ArrayList();
getSprintsMethod.ProductWSO_1 = product;
sprintArray = (SprintWSO[])service.getSprints(getSprintsMethod);
for (int x = 0; x < sprintArray.Length; x++)
{
sprint = sprintArray[x];
if (sprint.name == sprintName)
{
break;
}
}
}
///
/// Gets array of backlogs in sprint
///
/// Array of backlogs in sprint
public ArrayList SWbacklog()
{
getActiveBacklogItemsForSprint getBacklogItemMethod = new getActiveBacklogItemsForSprint();
BacklogItemWSO[] backlogArray = new BacklogItemWSO[0];
ArrayList returnList = new ArrayList();
getBacklogItemMethod.SprintWSO_1 = sprint;
backlogArray = (BacklogItemWSO[])service.getActiveBacklogItemsForSprint(getBacklogItemMethod);
for (int x = 0; x < backlogArray.Length; x++)
{
backlog = backlogArray[x];
returnList.Add(backlog.title);
}
return returnList;
}
///
/// Sets backlog
///
/// Selected backlog
public void SWselectedBacklog(string backlogName)
{
getActiveBacklogItemsForSprint getBacklogItemMethod = new getActiveBacklogItemsForSprint();
BacklogItemWSO[] backlogArray = new BacklogItemWSO[0];
ArrayList returnList = new ArrayList();
getBacklogItemMethod.SprintWSO_1 = sprint;
backlogArray = (BacklogItemWSO[])service.getActiveBacklogItemsForSprint(getBacklogItemMethod);
for (int x = 0; x < backlogArray.Length; x++)
{
backlog = backlogArray[x];
if(backlogName == backlog.title)
{
break;
}
}
}
///
/// Returns description of selected backlog item
///
/// Backlog description as string
public string SWbacklogDescription()
{
return backlog.description;
}
}
} -
Loading Profile...



Twitter,
Facebook, or email.


