我必须使用GET方法发出请求以获取登录令牌。
我收到此信息: 完整文档:https://doc.dpd.be/node/34
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://dpd.com/common/service/types/LoginService/2.0">
<soapenv:Header/>
<soapenv:Body>
<ns:getAuth>
<delisId>KD*****</delisId>
<password>*******</password>
<messageLanguage>en_EN</messageLanguage>
</ns:getAuth>
</soapenv:Body>
</soapenv:Envelope>
样品响应
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<getAuthResponse xmlns="http://dpd.com/common/service/types/LoginService/2.1">
<return>
<delisId>SWSTEST</delisId>
<customerUid>SWSTEST</customerUid>
<authToken>GFadfGob14GWWgQcIldI6zYtuR7cyEHe2z6eWzb7BpFmcFvrzclRljlcV1OF</authToken>
<depot>0530</depot>
<authTokenExpires>2020-05-08T13:02:56.06</authTokenExpires>
</return>
</getAuthResponse>
</soap:Body>
</soap:Envelope>
这是我到目前为止的代码,但是如何发送信封响应呢?
Dim Request As WebRequest
Dim Response As WebResponse
Dim DataStream As Stream
Dim Reader As StreamReader
Dim SoapByte() As Byte
Dim SoapStr As String
Dim pSuccess As Boolean = True
SoapStr = "<?xml version=""1.0"" encoding=""utf-8""?>"
SoapStr = SoapStr & "<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"">"
SoapStr = SoapStr & "<soapenv:Header/>"
SoapStr = SoapStr & "<soapenv:Body>"
SoapStr = SoapStr & "<ns:getAuth> <delisId>KD3379602W</delisId> <password>207Yc*-K</password> <messageLanguage>de_DE</messageLanguage> </ns:getAuth>"
SoapStr = SoapStr & "</soapenv:Body>"
SoapStr = SoapStr & "</soapenv:Envelope>"
Try
SoapByte = System.Text.Encoding.UTF8.GetBytes(SoapStr)
Request = WebRequest.Create("https://wsshipper.dpd.be/soap/WSDL/LoginServiceV21.wsdl")
Request.Headers.Add("SOAPAction", "http://dpd.com/common/service/types/LoginService/2.1")
Request.ContentType = "text/xml; charset=utf-8"
Request.ContentLength = SoapByte.Length
Request.Method = "get"
????
捕获为WebException MsgBox(例如ToString()) 结束尝试
End Sub