help convert this SOAP request to Report Builder 2.0 query for XML data source

倖福魔咒の 提交于 2019-12-08 07:39:33

问题


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>

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?

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>

回答1:


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.

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.



来源:https://stackoverflow.com/questions/3321002/help-convert-this-soap-request-to-report-builder-2-0-query-for-xml-data-source

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!