为什么SSRS忽略Web方法返回的某些列中的数据?

Ale*_*gas 3 sql-server soap web-services reporting-services

我在Reporting Services 2005中使用XML数据源功能,但在丢失数据方面存在一些问题.当一行中第一列没有值时,SSRS会忽略整个列!

Web方法请求非常简单:

<Query>
   <Method Name="GetIssues" 
Namespace="http://www.mycompany.com/App/">
   </Method>
   <SoapAction>http://www.mycompany.com/App/GetIssues</SoapAction>
   <ElementPath IgnoreNamespaces="true">*</ElementPath>
</Query>
Run Code Online (Sandbox Code Playgroud)

同样,响应非常简单:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <GetIssuesResponse xmlns="http://www.mycompany.com/App/">
      <GetIssuesResult>
        <Issue>
          <Title>ABC</Title>
          <RaisedBy />
          <Action>Do something</Action>
        </Issue>
        <Issue>
          <Title>ABC</Title>
          <RaisedBy>Jeff Smith</RaisedBy>
          <Action>Do something</Action>
        </Issue>
      </GetIssuesResult>
    </GetIssuesResponse>
  </soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)

在此示例中,RaisedBy列将完全为空.如果'问题'被反转,所以RaisedBy首先有一个值,没有问题.有任何想法吗?

小智 7

在Query本身中,尝试显式定义列,而不是让SSRS为您确定它们.

换句话说,你有:

<ElementPath IgnoreNamespaces="true">*</ElementPath>
Run Code Online (Sandbox Code Playgroud)

用以下代码替换*:

<ElementPath IgnoreNamespaces="true">GetIssues/GetIssuesItemsResult/listitems/data/row{@Title,@RaisedBy,@Action}</ElementPath>
Run Code Online (Sandbox Code Playgroud)

当然,对于您的示例,确切的XPath可能不正确.