帮助将此 SOAP 请求转换为 XML 数据源的 Report Builder 2.0 查询 [英] help convert this SOAP request to Report Builder 2.0 query for XML data source

查看:54
本文介绍了帮助将此 SOAP 请求转换为 XML 数据源的 Report Builder 2.0 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 .NET Web 服务中有一个 Web 方法的复杂参数,我想使用 使用 SOAP 的报表生成器 2.0.使用 soapUI,我收到了该 Web 方法的以下 SOAP 请求:

I have a complex parameter to a web method in my .NET web service, and I want to query that web method with Report Builder 2.0 using SOAP. With soapUI, I get the following SOAP request for that web method:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:qcr="MyNamespace">
   <soapenv:Header/>
   <soapenv:Body>
      <qcr:MyWebMethod>
         <qcr:MyComplexParameter><!--Represents a serializable class-->
            <qcr:Action>?</qcr:Action><!--string-->
            <qcr:ActionSortAscending>?</qcr:ActionSortAscending><!--Boolean-->
            <qcr:ActionSortOrder>?</qcr:ActionSortOrder><!--int-->
         </qcr:MyComplexParameter>
      </qcr:MyWebMethod>
   </soapenv:Body>
</soapenv:Envelope>

我之前使用过的唯一一种 Report Builder 2 查询是针对将字符串、整数或其他简单类型作为参数的 Web 方法.我将如何编写 Report Builder 2 查询 对于这个 SOAP 请求?

The only kind of Report Builder 2 queries I've worked with before were for web methods that took strings, integers, or other simple types as parameters. How would I go about writing a Report Builder 2 query for this SOAP request?

具有简单参数的 Web 方法的示例 Report Builder 2 查询:

Sample Report Builder 2 query for web method with simple parameters:

<Query>
   <Method Name="MyWebMethod" Namespace="MyNamespace">
   <Parameters>
       <Parameter Name="MyStringParameter"><DefaultValue>foo</DefaultValue></Parameter>
       <Parameter Name="MyNumericParameter"><DefaultValue>3</DefaultValue></Parameter>
   </Parameters>
   </Method>
   <ElementPath IgnoreNamespaces="true">MyWebMethodResponse {}/MyWebMethodResult {}/Result</ElementPath>
</Query>

推荐答案

我想到的最好的办法是改变 web 服务的 web 方法,让它只需要简单的参数,然后找到某种方式来表示复杂对象的字符串并在 web 方法中解析它.键值对和正则表达式、JSON 字符串等.如果我无法控制 Web 服务的代码,这将不起作用,而且似乎真的应该有一种方法可以从 Report 传递任何类型的可序列化参数XML Web 服务的构建器.如果我可以在普通 SOAP 请求中传递参数,我应该能够通过 Report Builder 愚蠢的 Query 语法传递参数.

The best I came up with was to change the web service's web method so it only takes simple parameters, then find some way of representing the complex object in a string and parsing that in the web method. Key-value pairs and regex, JSON strings, etc. This wouldn't work if I didn't have control over the web service's code, and it really seems like there ought to be a way of passing any kind of serializable parameter from Report Builder to an XML web service. If I can pass a parameter in a normal SOAP request, I should be able to pass the parameter via Report Builder's stupid Query syntax.

如果它对其他人有帮助,为了解析 key1=value1,key2=value2 格式的逗号分隔键值对,我使用了 new Regex(@"([^=,]*)=(""[^""]*""|[^,""]*)")paramStr.Split(',').Select(pair =>pair.Split('=')).ToDictionary(pair => pair[0], pair => pair[1]) 得到一个 IDictionary我的 C# 网络服务中的参数.

If it helps anyone else, for parsing comma-separated key-value pairs of the format key1=value1,key2=value2, I used new Regex(@"([^=,]*)=(""[^""]*""|[^,""]*)") and paramStr.Split(',').Select(pair => pair.Split('=')).ToDictionary(pair => pair[0], pair => pair[1]) to get an IDictionary<string, string> of parameters in my C# web service.

这篇关于帮助将此 SOAP 请求转换为 XML 数据源的 Report Builder 2.0 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆