Servicestack作为SSRS数据源

时间:2018-04-24 23:54:12

标签: reporting-services servicestack

我正在尝试使用servicestack作为我的SSRS报告的数据源。这可能吗?现在我有一个简单的操作,它以日期作为参数,在C#

中看起来像这样
[DataContract]
[Route("/Reports/SummaryBySymbol/{SummaryDate}", Summary = "Summarizes trades by symbol for a specific date.")]
public class GetTradesGroupedBySymbol : IReturn<TradesGroupedBySymbolResponse>
{
    [DataMember]
    [ApiMember(Name = "Summary Date",
        Description = "The date for which the trades will be summarized..",
        DataType = "DateTime",
        IsRequired = true)]
    public DateTime SummaryDate { get; set; }
}

[DataContract]
public class TradesGroupedBySymbolResponse
{
    [DataMember] public IList<SymbolSummary> Result { get; set; }
}

我正在尝试使用以下内容在SSRS中创建数据集:http://machineName:port/soap11 作为数据源。

当数据集请求查询时,我不知道输入什么作为文本,示例I can find总是导致界面在我点击“下一步”按钮时冻结(所以我必须假设我输入了一些内容不正确地)。

以下是我尝试输入的查询内容:

<Query>
  <Method Namespace="http://www.company.com/types" Name="GetTradesGroupedBySymbol" />
  <SoapAction>
      http://www.company.com/types/GetTradesGroupedBySymbol
  </SoapAction>
  <Parameters>
    <Parameter Name="SummaryDate" Type="XML"/>
  </Parameters>
  <ElementPath IgnoreNamespaces="True"> 
    GetTradesGroupedBySymbolResponse{}/Result{}/SymbolSummary
  </ElementPath> 
</Query>

以下是该服务的wsdl:

    <wsdl:definitions xmlns:svc="http://www.company.com/types" xmlns:tns="http://www.company.com/types" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" name="Soap11" targetNamespace="http://www.company.com/types">
  <wsdl:types>
    <xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/">
      <xs:element name="anyType" nillable="true" type="xs:anyType"/>
      <xs:element name="anyURI" nillable="true" type="xs:anyURI"/>
      <xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/>
      <xs:element name="boolean" nillable="true" type="xs:boolean"/>
      <xs:element name="byte" nillable="true" type="xs:byte"/>
      <xs:element name="dateTime" nillable="true" type="xs:dateTime"/>
      <xs:element name="decimal" nillable="true" type="xs:decimal"/>
      <xs:element name="double" nillable="true" type="xs:double"/>
      <xs:element name="float" nillable="true" type="xs:float"/>
      <xs:element name="int" nillable="true" type="xs:int"/>
      <xs:element name="long" nillable="true" type="xs:long"/>
      <xs:element name="QName" nillable="true" type="xs:QName"/>
      <xs:element name="short" nillable="true" type="xs:short"/>
      <xs:element name="string" nillable="true" type="xs:string"/>
      <xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/>
      <xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/>
      <xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/>
      <xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/>
      <xs:element name="char" nillable="true" type="tns:char"/>
      <xs:simpleType name="char">
        <xs:restriction base="xs:int"/>
      </xs:simpleType>
      <xs:element name="duration" nillable="true" type="tns:duration"/>
      <xs:simpleType name="duration">
        <xs:restriction base="xs:duration">
          <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/>
          <xs:minInclusive value="-P10675199DT2H48M5.4775808S"/>
          <xs:maxInclusive value="P10675199DT2H48M5.4775807S"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:element name="guid" nillable="true" type="tns:guid"/>
      <xs:simpleType name="guid">
        <xs:restriction base="xs:string">
          <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:attribute name="FactoryType" type="xs:QName"/>
      <xs:attribute name="Id" type="xs:ID"/>
      <xs:attribute name="Ref" type="xs:IDREF"/>
    </xs:schema>
    <xs:schema xmlns:tns="http://www.company.com/types" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.company.com/types">
      <xs:complexType name="GetTradesGroupedBySymbol">
        <xs:sequence>
          <xs:element minOccurs="0" name="SummaryDate" type="xs:dateTime"/>
        </xs:sequence>
      </xs:complexType>
      <xs:element name="GetTradesGroupedBySymbol" nillable="true" type="tns:GetTradesGroupedBySymbol"/>
      <xs:complexType name="GetTradesGroupedBySymbolResponse">
        <xs:sequence>
          <xs:element minOccurs="0" name="Result" nillable="true" type="tns:ArrayOfSymbolSummary"/>
        </xs:sequence>
      </xs:complexType>
      <xs:element name="GetTradesGroupedBySymbolResponse" nillable="true" type="tns:GetTradesGroupedBySymbolResponse"/>
      <xs:complexType name="ArrayOfSymbolSummary">
        <xs:sequence>
          <xs:element minOccurs="0" maxOccurs="unbounded" name="SymbolSummary" nillable="true" type="tns:SymbolSummary"/>
        </xs:sequence>
      </xs:complexType>
      <xs:element name="ArrayOfSymbolSummary" nillable="true" type="tns:ArrayOfSymbolSummary"/>
      <xs:complexType name="SymbolSummary">
        <xs:sequence>
          <xs:element minOccurs="0" name="BuyQuantityFilled" type="xs:int"/>
          <xs:element minOccurs="0" name="BuyTotalValue" type="xs:double"/>
          <xs:element minOccurs="0" name="BuyWeightedAveragePrice" type="xs:double"/>
          <xs:element minOccurs="0" name="CompanyName" nillable="true" type="xs:string"/>
          <xs:element minOccurs="0" name="SellQuantityFilled" type="xs:int"/>
          <xs:element minOccurs="0" name="SellTotalValue" type="xs:double"/>
          <xs:element minOccurs="0" name="SellWeightedAveragePrice" type="xs:double"/>
          <xs:element minOccurs="0" name="Ticker" nillable="true" type="xs:string"/>
        </xs:sequence>
      </xs:complexType>
      <xs:element name="SymbolSummary" nillable="true" type="tns:SymbolSummary"/>
    </xs:schema>
  </wsdl:types>
  <wsdl:message name="GetTradesGroupedBySymbolIn">
    <wsdl:part name="par" element="tns:GetTradesGroupedBySymbol"/>
  </wsdl:message>
  <wsdl:message name="GetTradesGroupedBySymbolOut">
    <wsdl:part name="par" element="tns:GetTradesGroupedBySymbolResponse"/>
  </wsdl:message>
  <wsdl:portType name="ISyncReply">
    <wsdl:operation name="GetTradesGroupedBySymbol">
      <wsdl:input message="svc:GetTradesGroupedBySymbolIn"/>
      <wsdl:output message="svc:GetTradesGroupedBySymbolOut"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="BasicHttpBinding_ISyncReply" type="svc:ISyncReply">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="GetTradesGroupedBySymbol">
      <soap:operation soapAction="http://www.company.com/types/GetTradesGroupedBySymbol" style="document"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="SyncReply">
    <wsdl:port name="BasicHttpBinding_ISyncReply" binding="svc:BasicHttpBinding_ISyncReply">
      <soap:address location="http://serverName:port/soap11"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

我希望查询在尝试运行soapAction之前询问我一个参数(或者至少是错误输出),但是界面只是锁定而且我必须杀死Visual Studio。关于我做错了什么的任何想法?

编辑1

修改了上述查询和wsdl以显示最新尝试以使其生效。 VS仍然冻结。

1 个答案:

答案 0 :(得分:1)

问题似乎是长时间运行的Web服务响应导致向导中的连接超时并导致整个VS2017环境冻结(不是最佳行为)。一旦我创建了一个虚拟版本的webservice,它响应了相同的DTO和几行虚拟行但在不到一秒的时间内返回,一切正常。生成了报告,然后我可以进入数据集,将超时更改为2分钟,然后将查询更改为指向真实的Web方法,并按预期工作。

作为后续详细信息,如果要将日期传递给ServiceStack,请使用“字符串”数据类型(而不是XML)并确保日期格式为yyyy-mm-dd(必须用零填充月和日)如果它们是单位数值。)