Сервисный стек как источник данных SSRS - PullRequest
0 голосов
/ 25 апреля 2018

Я пытаюсь использовать 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 как источник данных.

Когда набор данных запрашивает запрос, я понятия не имею, что ввести в виде текста, и примеры Я могу найти всегда вызывает зависание интерфейса при нажатии кнопки «Далее» (поэтому я должен предположим, что я ввел что-то неправильно).

Вот что я пытался ввести в качестве запроса:

<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 голосов
/ 27 апреля 2018

Похоже, что проблема заключалась в том, что длительный ответ веб-службы вызывал тайм-аут соединения в мастере и приводил к зависанию всей среды VS2017 (неоптимальное поведение). После того, как я создал фиктивную версию веб-сервиса, которая отвечает тем же DTO и парой фиктивных строк, но которая вернулась менее чем за секунду, все работало. Отчет был сгенерирован, и я мог затем перейти к набору данных, изменить время ожидания на 2 минуты, а затем изменить запрос так, чтобы он указывал на настоящий веб-метод, и он работал как ожидалось.

В качестве дополнительной информации, если вы передаете дату в ServiceStack, используйте тип данных 'String' (не XML) и убедитесь, что формат даты - гггг-мм-дд (месяцы и дни должны быть дополнены нулями) если они представляют собой однозначные значения).

...