Как указать сложный ввод данных в SOAP-запросе в инструменте SoapUI - PullRequest
0 голосов
/ 17 ноября 2011

Мне нужна помощь с использованием инструмента SoapUI.

Я тестирую API веб-сервисов с помощью этого инструмента.

Существует API под названием "getUsageReport ()" , который принимает 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>

запрос 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>

когда я нажимаю на RUN, указывая дату в запросе, это ответ

<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-запросе для получения желаемого ответа?

Пожалуйста, помогите мне с этим

-Kiran

Ответы [ 3 ]

2 голосов
/ 21 июня 2012
  1. Запустите getReports (или getReportingGroups) из BillingReports. Допустим, он возвращает код контракта с именем 55555.
  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>
1 голос
/ 17 ноября 2011

Вы должны указать дату

<startDate xsi:type="xsd:string">?</startDate>

требуется в запросе, формат даты, я не знаю, как он определен, потому что это строковый тип, а не тип даты.

Попробуйте с yyyy/MM/dd, это тип формата даты.

0 голосов
/ 18 ноября 2011

Вы никогда не хотите отправить запрос с? заполнители. Отредактируйте запрос, чтобы были актуальные данные.

...