java - 如何在 SoapUI 工具的 SOAP 请求中指定复杂数据类型输入

标签 java xml web-services xml-serialization soapui

我需要一些使用 SoapUI 工具的帮助。

我正在使用此工具测试 webServices API。

有一个名为“getUsageReport()”的 API,它需要 2 个输入参数

  • <datasources>类型 <akaaurdt:ArrayOfString>
  • <start date>类型 <xsd:string>

<强> <akaaurdt:ArrayOfString> 定义如下。

<complexType name="ArrayOfString">
  <complexContent>
  <restriction base="soapenc:Array">
  <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]" /> 
  </restriction>
  </complexContent>
</complexType>

soap UI 中的请求 xml 如下

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bil="https://control.akamai.com/BillingReports.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
   <soapenv:Header/>
   <soapenv:Body>
      <bil:getUsageReport soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <datasources xsi:type="bil:ArrayOfString" soapenc:arrayType="xsd:string[]"/>
         <startDate xsi:type="xsd:string">?</startDate>
      </bil:getUsageReport>
   </soapenv:Body>
</soapenv:Envelope>

当我通过在请求中给出日期来单击“运行”时,这就是响应

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Server.generalException</faultcode>
         <faultstring>akaaurdt:ApplicationError:ApplicationError:(?? No Data for Given Start Date.  Please resubmit with a more recent date)</faultstring>
         <detail>
            <ns1:exceptionName xmlns:ns1="http://xml.apache.org/axis/">com.akamai.aws.util.AWSFault</ns1:exceptionName>
            <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">qa-portal-ws01.qaextranet.akamai.com</ns2:hostname>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

如何指定<datasources>此请求 xml 中的参数以获得所需的响应?

请帮我解决这个问题

-基兰

最佳答案

  1. 运行 BillingReports 的 getReports(或 getReportingGroups)。假设它返回一个名为 55555 的contractCode。
  2. 运行 getUsageReport 方法,它应如下所示:

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bil="https://control.akamai.com/BillingReports.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
   <soapenv:Header/>
   <soapenv:Body>
      <bil:getUsageReport soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <datasources xsi:type="bil:ArrayOfString" soapenc:arrayType="xsd:string[]">
        <datasource xsi:type="xsd:string">55555</datasource>
    </datasources>
         <startDate xsi:type="xsd:string">20120620</startDate>
      </bil:getUsageReport>
   </soapenv:Body>
</soapenv:Envelope>

关于java - 如何在 SoapUI 工具的 SOAP 请求中指定复杂数据类型输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8166185/

相关文章:

java - 如何从 Kafka 访问记录中的文件路径并从中创建数据集?

java - liferay 门户内部有哪些技术

c# - 如何在 C# 中更改 XML 文件的属性值?

xml - XSLT 中的除法和乘法选择值

Java简单备份与恢复类

java - Hibernate获取列的数据缺失

c# - 从 xslt 中,您可以输出整个 XML 吗?

C# 和 PHP : Simple example of PHP Web Service used by C#

c# - 将 SOAP 作为文本转储到文件

web-services - 在 Alfresco 4.0.d 中生成缩略图