0

このリンクから TripPriceService.wsdl を取得します。ローカル フォルダーに保存されている前述の wsdl ファイルから wsdl を指定して、Windows アプリケーションにサービス参照 (ServiceReference1) を追加します。私の質問には2つの部分があります

1) 以下の障害メッセージは、wsdl(TripPriceServiceException) に従って有効な SOAP 障害ですか?

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:trip="http://trip.price.service">
   <soapenv:Header/>
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:client</faultcode>
         <faultstring>error</faultstring>
         <detail>
            <trip:TripPriceServiceException/>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

2)応答がsoap:faultの場合、詳細タグを処理してキャッチする方法は?

Imports windowsapp1.ServiceReference1
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim obj As New ServiceReference1.TripPriceServiceFacadeClient
        Dim abc As New ServiceReference1.trip
        Dim a As Single
        Dim d As ServiceReference1.TripPriceServiceException
        a = obj.getTripPrice(abc)
    End Sub
End Class

行 obj.getTripPrice がサービスを呼び出します。ただし、応答が SOAP エラー (タイプ TripPriceServiceException) の場合、例外がスローされますか? このような場合の処理​​方法は、ServiceReference1.TripPriceServiceException を使用する必要がありますか?この wsdl を使用して現在の状況を説明しました。Web サービス クライアントでこのような障害を処理する必要があります。

4

1 に答える 1

0

多分私はあなたの質問を理解していません。Try/Catch/End Try ブロックを使用して TripPriceServiceException をキャッチしないのはなぜですか?

于 2012-02-24T19:54:03.520 に答える