0

サンプル リクエストを生成する Web サービスがあり、すべての ? を置き換えます。最も単純な場合は 0 です。それは正常に動作します。次に、値の 1 つを次のように置き換えます。

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:int="http://interfaces.mypackage.foo.com">
       <soapenv:Header/>
       <soapenv:Body>
          <int:getCheckResults>
             <criteria>
               <startTm>
                 <time>${=0}</time>
               </startTm>
             </criteria>
          </int:getCheckResults>
       </soapenv:Body>
    </soapenv:Envelope>     

(私がこれを試みている理由は、最終的には、インターフェイスが長いミリ秒値を期待しているときに、このような読み取り可能な日付を渡したいからです):

    <startTm>
      <time>${= new java.util.SimpleDateFormat("MM/dd/yyyy hh:mm z").parse("01/01/2012 04:00 GMT"}</time>
    </startTm>

サービスを呼び出す代わりに、常に同じ答えが得られます - これは以前は機能していましたが、今は何が違うのかわかりません。古いバージョンの SoapUI で機能していたのかもしれません。

    <soapenv:Fault>
       <faultcode>soapenv:Server.generalException</faultcode>
       <faultstring>java.lang.NumberFormatException: For input string: "" Message being parsed:</faultstring>
    </soapenv:Fault>

ヘルプ!!

4

2 に答える 2

0

コンテキスト変数と Groovy スクリプトを使用することをお勧めします。

この SOAP リクエストの前に実行される Groovy スクリプトに、次のようなものを追加します (コードは入れていませんが、意味がわかると思います)。

import java.text.SimpleDateFormat
Date today
String formattedDate
SimpleDateFormat formatter
Locale currentLocale
currentLocale = new Locale("en", "US")  
formatter = new SimpleDateFormat("yyyy-MM-dd", currentLocale)
today = new Date()
formattedDate = formatter.format(today)
log.info(formattedDate)
context.setProperty("formattedDate", formattedDate)

次に、SOAP リクエストに次のように記述します。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:int="http://interfaces.mypackage.foo.com">
   <soapenv:Header/>
   <soapenv:Body>
      <int:getCheckResults>
         <criteria>
           <startTm>
             <time>${formattedDate}</time>
           </startTm>
         </criteria>
      </int:getCheckResults>
   </soapenv:Body>
</soapenv:Envelope>     
于 2012-06-13T14:13:35.160 に答える
0

さて、SOAPUI バージョン 2.0.2 を吹き飛ばして最新の 4.5.0 をインストールしたところ、通常どおり動作するようになりました。神は何が悪かったかを知っています。

これが他の誰かに役立つことを願っています。

于 2012-06-13T15:35:30.870 に答える