5
5

More than 5 years have passed since last update.

Webserviceメソッドのリクエスト生データを見る

Posted at

概要

Webserviceが受け付けたxmlデータを見たい場合、
以下の処理ができれば良かったが、結構な時間をかけてしまったので、
同じ事で戸惑わないように、
ここに自分が対処した方法を載せときます。

コード

service.asmx
<WebMethod> _
Public Function myFunc( ByVal myArg As String) As myResponse()

    Try
        Dim req As HttpRequest = Context.Request
        Dim sr As System.IO.Stream

        sr = Context.Request.InputStream
        Dim strLen As Integer = CInt(sr.Length)
        Dim strArr(strLen) As Byte
        '受け取ったStreamの読取位置が最後尾にきているらしく、
        '↓が抜けるとデータが取得できない
        sr.Position = 0                 

        Dim strRead As Integer = sr.Read(strArr, 0, strLen)
        Debug.Print("リクエスト内容 : " & System.Text.Encoding.UTF8.GetString(strArr))

}}}

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5