我正在尝试使用JavaScript使用ClientService.asmx检索TFS工作项,并且我能够访问web服务,但是当使用SOAP时,它会给出以下错误“TF51612:查询不包含任何组或表达式。 参数名称:queryXml“
以下是我用来访问工作项的代码:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<RequestHeader xmlns="http://schemas.microsoft.com/TeamFoundation/2005/06/WorkItemTracking/ClientServices/03">
<Id></Id>
</RequestHeader>
</soap:Header>
<soap:Body>
<QueryWorkitems xmlns="http://schemas.microsoft.com/TeamFoundation/2005/06/WorkItemTracking/ClientServices/03">
<psQuery>
<queryXml>
<Wiql>SELECT [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State] FROM WorkItems WHERE [System.TeamProject] = @project AND [System.WorkItemType] <> '' AND [System.State] <> '' ORDER BY [System.Id] </Wiql>
</queryXml>
</psQuery>
</QueryWorkitems>
</soap:Body>
</soap:Envelope>
请让我知道我做错了什么。 感谢
答案 0 :(得分:0)
您的标头SOAP必须包含有关您的凭据的信息,因为您的查询标头为空,因此您未经过身份验证
在Web服务中使用Soap Extension添加此项,在配置文件中注册
答案 1 :(得分:0)
经过多次痛苦,我想出了如何对此服务做出正确的请求。这是我的完整要求。请原谅我的形成。我显然太傻了,无法弄清楚如何做一个合适的清单。
几个笔记......
* RequestHeader Id字段必须采用uuid格式:GUID
* psQuery元素实际上并不在Wiql中,因为其他网络资源已暗示。 (你收到错误的是哪一个)
*数字字段的字段类型为288
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://schemas.microsoft.com/TeamFoundation/2005/06/WorkItemTracking/ClientServices/03">
<soapenv:Header>
<ns:RequestHeader>
<!--Optional:-->
<ns:Id>uuid:262c6910-8394-11e3-baa7-0800200c9a67</ns:Id>
</ns:RequestHeader>
</soapenv:Header>
<soapenv:Body>
<ns:QueryWorkitems>
<!--Optional:-->
<ns:psQuery>
<Group GroupOperator="And">
<Expression Column="System.TeamProject" FieldType="16" Operator="equals"><String>ProjectName</String></Expression>
<Expression Column="System.AssignedTo" FieldType="16" Operator="equals"><String>Daniel West</String></Expression>
<Expression Column="System.WorkItemType" FieldType="16" Operator="equals"><String>Anomaly</String></Expression>
<Expression Column="System.State" FieldType="16" Operator="equals"><String>Validate</String></Expression>
</Group>
</ns:psQuery>
<ns:sort>
<!--Zero or more repetitions:-->
<ns:QuerySortOrderEntry>
<!--Optional:-->
<ns:ColumnName>System.AssignedTo</ns:ColumnName>
<ns:Ascending>1</ns:Ascending>
</ns:QuerySortOrderEntry>
</ns:sort>
<ns:useMaster>1</ns:useMaster>
</ns:QueryWorkitems>
</soapenv:Body>
</soapenv:Envelope>