Hi need help urgently,
can anyone check my code and find what is wrong in there.
i have add referance the web services and this web services has server authentication that i need to pass when i send the data (request header value with request message).
even i have add the credential code, i dont see the code is working.
i have been configuring this to get the response code from server for pass 2 weeks.
hope someone can help me to identify my problem.
thank you.
Public Function SendDataToServer(ByVal resp1 As String, ByVal resp2 As String, ByVal resp3 As String, ByVal resp4 As String)
Try
Dim WSreqHeader As New wsAlertSvc.reqHeader
Dim WSrespHeader As New wsAlertSvc.respHeader
Dim WSrequesAlertReqType As New wsAlertSvc.requestAlertReqType
'Dim WsAlertSvc As New wsAlertSvc.wsAlertSvc
Dim WSrequestAlertRespType As New wsAlertSvc.requestAlertRespType
Dim WSrespInfo As New wsAlertSvc.respInfo
'Dim WS As New wsAlertSvc.wsAlertSvc
'Dim URL As String = "http://ambg2k207dev.ambg.com.my:3333/"
Dim URL As String = "http://developementServer.wer.com:1234/ws/CHANNEL.WEAlert.webservices.provider:wsAlertSvc?wsdl"
Dim WsAlertSvc As New wsAlertSvc.wsAlertSvc
WsAlertSvc.Url = URL
Dim Cred As New System.Net.NetworkCredential("sgsdg", "efo123")
Dim CredCache As New System.Net.CredentialCache
CredCache.Add(New Uri(WsAlertSvc.Url), "Basic", Cred)
'WsAlertSvc.Credentials = CredCache
WsAlertSvc.Credentials = New System.Net.NetworkCredential("sgsdg", "efo123")
'Dim response = WsAlertSvc.UseDefaultCredentials
Dim response1 = WsAlertSvc.PreAuthenticate
'WsAlertSvc.Credentials = New NetworkCredential(CredCache)
Dim a As String = response1
MsgBox("response > " & a)
''//--------------------------------------------------------------
''request Header
''//--------------------------------------------------------------
With WSreqHeader
.srcRefNo = "eesd08012015000001"
.srcId = " eesd"
.entity = "001"
.reqDateTime = "09012015020502"
End With
' ''//--------------------------------------------------------------
''request msg
''//--------------------------------------------------------------
With WSrequesAlertReqType
.ctt = "003"
.dept = "Investment"
.product = "TR"
.ref = "dassd"
.rsv = ""
.sevc = "CADESP"
.msg = "testing"
.to = "60173073720"
.type = "5"
End With
SendDataToServer = WsAlertSvc.respHeaderValue
Return SendDataToServer
Catch ex As Exception
clsLog.sWriteErrorLog("SendDataToServer | " & ex.Message)
End Try
'Return SendDataToServer
End Function