0

みんな私はデータをWebサービスに投稿する方法を知っていますが、xmlデータをvb.netのsoapベースのWebサービスに投稿する方法を知りません。また、Webサービスからのxmlベースの応答を受け入れる方法を教えていただければ幸いです。 . 前もって感謝します

4

1 に答える 1

1

XMLHttpRequest を使用できます-以下のサンプルのように

Dim strEnvelope As String
    Dim request As New MSXML.XMLHTTPRequest
    Dim strReturn As String
    Dim objReturn As New MSXML.DOMDocument
    Dim strQuery As String



    Private Sub btnAcct_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnResidentAcct.Click

        strEnvelope = "POST /Account/Account.asmx HTTP/1.1 " & _
        "Host: 1.1.1.1" & _
        "Content-Type: text/xml; charset=utf-8" & _
        "Content(655) : length()" & _
        "SOAPAction: ""http://www.account.net/Account/Account""" & _
              "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & _
          " <soap:Body>" & _
            "<Account xmlns=""http:// www.account.net/Account "">" & _

              "</Account>" & _
           "</soap:Body>" & _
         "</soap:Envelope>"


        'Set up to post to our localhost server
        request.open("post", "http:// www.account.net/Account ")
        request.setRequestHeader("Content-Type", "text/xml")
        request.setRequestHeader("Account", "http://www.account.net/Account/Account")
        request.send(strEnvelope)
strReturn = request.responsetext
  objReturn.loadXML(strReturn)

        strQuery = "SOAP:Envelope/SOAP:Body/m:AccountResponse/Account"
于 2013-01-11T12:25:04.650 に答える