Soapui-request-and-response
提供:Dev Guides
SoapUI-リクエストとレスポンス
リクエストのセットアップ
ここでは、通貨をINRからUSDに変換します。
- FromCurrency – INR
- ToCurrency – USD
次に、要求XMLとして送信される疑問符の場所にこれらの入力を入力します。 これらの値を対応するXMLタグに配置した後、「要求を送信」ボタンをクリックして応答を確認します。
応答
要求を送信すると、Webサービス要求はWebサーバーによって処理され、次のスクリーンショットに示すように応答を送り返します。
応答を読むことにより、1単位のINR = 0.0147単位のUSDと結論付けることができます。
HTTPリクエスト
SOAPメッセージはHTTPプロトコルによって転送されます。 HTTPリクエストを表示するには、SoapUIリクエストウィンドウ(左側)でRAWをクリックします。
リクエストはウェブサーバーに投稿されます。 したがって、HttpのPOSTメソッドが使用されます。
SOAPリクエストは、httpメッセージの本文で転送されます。これは次のように表示されます。
POST http://www.webservicex.com/currencyconvertor.asmx HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset = UTF-8
SOAPAction: "http://www.webserviceX.NET/ConversionRate"
Content-Length: 353
Host: www.webservicex.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
HTTP応答
SOAP-UI応答ウィンドウの「RAW」タブをクリックして、HTTPを介した応答の送信方法を理解します。
要求の処理後、http応答コード(200)が表示されます。これは、成功したことを意味します。 Webサーバーはそれを正常に処理しました。
SOAP応答は、HTTPメッセージの本文の一部としてクライアントに送り返されます。
HTTP/1.1 200 OK
Cache-Control: private, max-age = 0
Content-Type: text/xml; charset = utf-8
Content-Encoding: gzip
Vary: Accept-Encoding
Server: Microsoft-IIS/7.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Sun, 22 Jan 2017 19:39:31 GMT
Content-Length: 316
次のHTTPコードは、Webサーバーによる応答の送信に使用され、デバッグに非常に役立ちます。
HTTP Code | Description |
---|---|
1xx: | Informational − This means a request was received and there is a continuing process. |
2xx: | Success − The action was successfully received, understood, and accepted. |
3xx: | Redirection − This means further action must be taken in order to complete the request. |
4xx: | Client Error − This means the request contains a bad syntax or cannot be fulfilled. |
5xx: | Server Error − The server failed to fulfil an apparently valid request. |