我需要一些使用 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 中的参数以获得所需的响应?
请帮我解决这个问题
-基兰
最佳答案
- 运行 BillingReports 的 getReports(或 getReportingGroups)。假设它返回一个名为 55555 的contractCode。
- 运行 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/