Hi,
I am writing a java webservices client to interact with the work item database.
I have written some test code to try to create a new work item in the database. I used a packet sniffer to figure out exactly what parameters need to be set in the soap calls.
Anyhow I am getting the following error from the server. Can anybody help me figure out what is causing the error thanks..
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
faultSubcode:
faultString: System.Web.Services.Protocols.SoapException: Forcing rollback ---> Microsoft.TeamFoundation.WorkItemTracking.Server.ValidationException: Forcing rollback ---> System.Data.SqlClient.SqlException: Forcing rollback
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.HasMoreRows()
at System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout)
at System.Data.SqlClient.SqlDataReader.NextResult()
at Microsoft.TeamFoundation.WorkItemTracking.Server.PayloadTableCollection.Populate(SqlDataReader reader)
at Microsoft.TeamFoundation.WorkItemTracking.Server.SqlAccess.ExecuteBatchPayloadImpl(IRequestContext context, String sqlBatch, ArrayList parameterList, Boolean& errorOnBulkUpdate, String connectionString)
--- End of inner exception stack trace ---
at Microsoft.TeamFoundation.WorkItemTracking.Server.SqlAccess.HandleDalError(Exception e)
at Microsoft.TeamFoundation.WorkItemTracking.Server.SqlAccess.ExecuteBatchPayloadImpl(IRequestContext context, String sqlBatch, ArrayList parameterList, Boolean& errorOnBulkUpdate, String connectionString)
at Microsoft.TeamFoundation.WorkItemTracking.Server.SqlBatchBuilder.ExecuteBatchInternal(IRequestContext context, Boolean passInConnectionInfo, String server, String database)
at Microsoft.TeamFoundation.WorkItemTracking.Server.DataAccessLayerImpl.UpdateImpl(String serverName, String databaseName, String attachmentServer, String attachmentDatabase, String clientUserName, XmlElement updateElement, MetadataTable[] tablesRequested, Int64[] rowVersions, Payload metadataPayload, Boolean bisNotification, String& dbStamp, Boolean bulkUpdate, Boolean& bulkUpdateSuccess)
at Microsoft.TeamFoundation.WorkItemTracking.Server.DataAccessLayerImpl.Update(String serverName, String databaseName, String attachmentServer, String attachmentDatabase, String clientUserName, XmlElement updateElement, MetadataTable[] tablesRequested, Int64[] rowVersions, Payload metadataPayload, Boolean bisNotification, String& dbStamp)
at Microsoft.TeamFoundation.WorkItemTracking.Server.ClientService.Update(XmlElement package, XmlElement& result, MetadataTableHaveEntry[] metadataHave, String& dbStamp, Payload& metadata)
--- End of inner exception stack trace ---
at Microsoft.TeamFoundation.WorkItemTracking.Server.ExceptionManager.ThrowProperSoapException(Exception e)
at Microsoft.TeamFoundation.WorkItemTracking.Server.ClientService.Update(XmlElement package, XmlElement& result, MetadataTableHaveEntry[] metadataHave, String& dbStamp, Payload& metadata)
faultActor: /WorkItemTracking/v1.0/ClientService.asmx
faultNode:
faultDetail:
{http://schemas.microsoft.com/TeamFoundation/2005/06/WorkItemTracking/faultdetail/02}details:null

Error in creating a work item via the webservice
Anji Reddy
It looks like your fields are not containing the values defined by the field constraints of the workitem type. You are recieving a workitem validation error. This normaly has to do with fields having values not allowed by the type definition.
Can you provide more data on the message you send for what workitem.
Todd Scott
I have tried it using the WI OM using the same values and it works fine. I am using the Microsoft Agile template that is shipped with the beta 3 version of VSTS.
The spaces and new lines are actually put in by me while formatting the xml before posting it here...when it is sent over the wire it has no spaces between the tags.
Cyrus1985
One more thing I've noticed, is that you do not send types of fields. The package should contain types of fields as intergers from internally defined enum.
You need to load "fields" metadata table to know these values. The type value allows middle-tier to build correct sql batch. Without type, it assumes that type is a string, which can make a conflict, causing roolback.
You can use http protocol sniffer to catch package from OM and see the difference.
Maria Tzanou
Another possibility is to catch HTTP request sent by VS client, but it requires using some additional instruments.
Also it was a bug in one of versions, which does not allow any formatting spaces in the XML package. I would advise to try it without spaces or new lines between tags.
LawC
Hi,
Here is the 'Package' element from the soap request that is sent over.
Thanks
<package>
<Package
Product="http://teamfoundation:8080/WorkItemTracking/v1.0/ClientService.asmx"
xmlns="">
<InsertWorkItem
ObjectType="WorkItem">
<ComputedColumns>
<ComputedColumn
Column="System.RevisedDate"/>
<ComputedColumn
Column="System.ChangedDate"/>
<ComputedColumn
Column="System.PersonId"/>
<ComputedColumn
Column="System.CreatedDate"/>
<ComputedColumn
Column="Microsoft.VSTS.Common.StateChangeDate"/>
<ComputedColumn
Column="Microsoft.VSTS.Common.ActivatedDate"/>
</ComputedColumns>
<Columns>
<Column
Column="System.AreaID">
<Value>
13
</Value>
</Column>
<Column
Column="System.IterationId">
<Value>
13
</Value>
</Column>
<Column
Column="System.AssignedTo">
<Value>
ewren
</Value>
</Column>
<Column
Column="System.CreatedDate"
Type="ServerDateTime">
<Value/>
</Column>
<Column
Column="System.CreatedBy">
<Value>
ewren
</Value>
</Column>
<Column
Column="System.ChangedBy">
<Value>
ewren
</Value>
</Column>
<Column
Column="System.Title">
<Value>
java test
</Value>
</Column>
<Column
Column="System.State">
<Value>
Active
</Value>
</Column>
<Column
Column="System.Reason">
<Value>
New
</Value>
</Column>
<Column
Column="System.WorkItemType">
<Value>
Bug
</Value>
</Column>
<Column
Column="Microsoft.VSTS.Common.Issue">
<Value>
No
</Value>
</Column>
<Column
Column="Microsoft.VSTS.Common.StateChangeDate"
Type="ServerDateTime">
<Value/>
</Column>
<Column
Column="Microsoft.VSTS.Common.ActivatedDate"
Type="ServerDateTime">
<Value/>
</Column>
<Column
Column="Microsoft.VSTS.Common.ActivatedBy">
<Value>
ewren
</Value>
</Column>
<Column
Column="Microsoft.VSTS.Common.Priority">
<Value>
2
</Value>
</Column>
</Columns>
</InsertWorkItem>
</Package>
</package>