How to post SOAP Request from .NET?

前端 未结 7 2020
暖寄归人
暖寄归人 2020-12-08 02:28

I have the SOAP request in an XML file. I want to post the request to the web service in .net How to implement?

7条回答
  •  心在旅途
    2020-12-08 03:09

    Here's another example--this one in VB:

        Dim manualWebClient As New System.Net.WebClient()
    
        manualWebClient.Headers.Add("Content-Type", "application/soap+xml;  charset=utf-8")
    
        ' Note: don't put the " & System.Environment.NewLine & _
            "  " & System.Environment.NewLine & _
            "    " & System.Environment.NewLine & _
            "      5" & System.Environment.NewLine & _
            "      4" & System.Environment.NewLine & _
            "    " & System.Environment.NewLine & _
            "  " & System.Environment.NewLine & _
            "")
        Dim bytRetData As Byte() = manualWebClient.UploadData("http://localhost/CPTR446.asmx", "POST", bytArguments)
    
        MessageBox.Show(System.Text.Encoding.ASCII.GetString(bytRetData))
    

提交回复
热议问题