使用ssrs xml查询设计器自定义从Web服务返回的字段

时间:2015-11-30 17:20:39

标签: web-services visual-studio-2010 reporting-services xml-parsing query-designer

我有一个返回数据的Web服务,但我找不到如何选择从Web服务返回的字段的方法。 我有param-in,我发送到Web服务,我得到字段参数作为参数。 这就是我解析它的方式:

<Query>
<Method Name="methodname" Namespace="namespacename">
<Paramenters>
<Parameter Name="param-in-name-1">
<DefaultValue>0</DefaultValue>
</Parameter>
<Parameter Name="param-in-name-2">
<DefaultValue>0</DefaultValue>
</Parameter>
</Parameters>
</Method>
<ElementPath IgnoreNamespace="true">
*
</ElementPath>
</Query>

上面的解析带来了所有字段,但我需要采取特定的字段。 我试着将下面的内容添加到elementpath中,但它没有用: / elementname1 {} / {elementname2} / fieldname1

1 个答案:

答案 0 :(得分:0)

我意识到它确实依赖于Web服务架构 例如, 通过添加嵌套参数使我更复杂的这个模式:

{%extends home.html%}
{%block banner%}
<h1>Game data for {{user.username}}</h1>

<div>
    {% for game in games_list %}
        <a href="#">
            {{game}}:
            {% if game.status == 'A' %}
                {%if game.next_to_move == user%}Your Turn{%else%}Waiting for opponents move{%endif%}
            {%elif game.status == 'D'%}
                Draw
            {%elif game.status == 'F' and user = game.first_player%}
                You Won !
            {%elif game.status == 'S' and user - game.second_player%}
                You Won !
            {%else%}
                You lost !
            {%endif%}
            <span>{{game.move_set.count}}</span></a>
    {%empty%}
        <span>No games available</span>
    {%endfor%}
</div>
{% endblock banner%}

我通过从第二层发送参数(类/元素中的参数)使其变得更加复杂:

<wsdl:types>
<s:schema targetNamespace="VS13" elementFormDefault="qualified">
<s:element name="datatable">
<s:complexType>
<s:sequence>
<s:element name="prmin" type="tns:paramin" maxOccurs="1" minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="paramin">
<s:sequence>
<s:element name="name" type="s:string" maxOccurs="1" minOccurs="0"/>
<s:element name="age" type="s:int" maxOccurs="1" minOccurs="1"/>
<s:element name="height" type="s:int" maxOccurs="1" minOccurs="1"/>
</s:sequence>
</s:complexType>
<s:element name="datatableResponse">
<s:complexType>
<s:sequence>
<s:element name="datatableResult" type="tns:data" maxOccurs="1" minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="data">
<s:sequence>
<s:element name="name" type="s:string" maxOccurs="1" minOccurs="0"/>
<s:element name="age" type="s:int" maxOccurs="1" minOccurs="1"/>
<s:element name="ltr" type="tns:ArrayOfLetters" maxOccurs="1" minOccurs="0"/>
<s:element name="height" type="s:int" maxOccurs="1" minOccurs="1"/>
</s:sequence>
</s:complexType>
<s:complexType name="ArrayOfLetters">
<s:sequence>
<s:element name="letters" type="tns:letters" maxOccurs="unbounded" minOccurs="0"/>
</s:sequence>
</s:complexType>
<s:complexType name="letters">
<s:sequence>
<s:element name="letter" type="s:string" maxOccurs="1" minOccurs="0"/>
<s:element name="count" type="s:int" maxOccurs="1" minOccurs="1"/>
</s:sequence>
</s:complexType>
</s:schema>
</wsdl:types>

我有两种方法可以实现从xmldp查询中检索的数据

1.没有数组数据字段的第二层:

<Query>
<Method Name="datatable" Namespace="VS13" >
<Parameters>
<Parameter Name="prmin" Type="xml">
<DefaultValue>
<name>stiv</name>
<age>30</age>
<height>180</height>
</DefaultValue>
</Parameter>
</Parameters>
</Method>

2.第二层只有数组数据字段:

<ElementPath IgnoreNamespaces="True">
datatableResponse/datatableResult
</ElementPath>