3

My customer give me a WebService url = https://public-ws-stage.dpd.com/services/LoginService/V2_0 , he told me that, if I send this xml text:

enter image description here

but, this is not right if I use this code :

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>id</delisId> <password>pass</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://public-ws-stage.dpd.com/services/LoginService/V2_0/?wsdl")
  Request.Headers.Add("SOAPAction", "https://public-ws-stage.dpd.com/services/LoginService/V2_0/getAuth")

  Request.ContentType = "text/xml; charset=utf-8"
  Request.ContentLength = SoapByte.Length
  Request.Method = "POST"

  DataStream = Request.GetRequestStream()
  DataStream.Write(SoapByte, 0, SoapByte.Length)
  DataStream.Close()

  Response = Request.GetResponse()
  DataStream = Response.GetResponseStream()
  Reader = New StreamReader(DataStream)
  Dim SD2Request As String = Reader.ReadToEnd()

  DataStream.Close()
  Reader.Close()
  Response.Close()

Catch ex As WebException
  MsgBox(ex.ToString())
End Try

don't return what my customer told, I don't understant the url is not true, oder I write a wrong code, Please help me.

2
  • Are you sure this is VBA code? it seems more like VB or VB.NET maybe? Commented Aug 21, 2015 at 9:29
  • right, this is visual basic code Commented Aug 21, 2015 at 9:33

1 Answer 1

3

Try to change the URL without "?wsdl" from this:

Request = WebRequest.Create("https://public-ws-stage.dpd.com/services/LoginService/V2_0/?wsdl")

to this:

Request = WebRequest.Create("https://public-ws-stage.dpd.com/services/LoginService/V2_0/")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.