How to post SOAP Request from .NET?

前端 未结 7 2010
暖寄归人
暖寄归人 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:16

    Sorry for bumping an old thread here's my solution to this

    ''' 
    ''' Sends SOAP to a web service and sends back the XML it got back.
    ''' 
    Public Class SoapDispenser
        Public Shared Function CallWebService(ByVal WebserviceURL As String, ByVal SOAP As String) As XmlDocument
            Using wc As New WebClient()
                Dim retXMLDoc As New XmlDocument()
    
                wc.Headers.Add("Content-Type", "application/soap+xml; charset=utf-8")
                retXMLDoc.LoadXml(wc.UploadString(WebserviceURL, SOAP))
    
                Return retXMLDoc
            End Using
        End Function
    End Class
    

提交回复
热议问题