call webService by vb .Net
PostPosted:Fri Jul 22, 2011 9:50 am
Hi to all and thank you
I have a web reference name OKMAuthService i
Mi code for login to openKm is
but the i have a this exception in line _stoken = openKMAuth.login("user", "pass")
I have a web reference name OKMAuthService i
Mi code for login to openKm is
but the i have a this exception in line _stoken = openKMAuth.login("user", "pass")
Code: Select all
this is my code its very simpleSystem.Net.WebException was unhandled
Message=The underlying connection was closed: An unexpected error occurred on a receive.
Source=System.Web.Services
StackTrace:
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Expe.OKMAuthService.OKMAuthService.login(String user, String password) in C:\PIG\Proyecto\Expe.NET\Web References\OKMAuthService\Reference.vb:line 413
at Expe.cl_OpenKm.Login(String user, String password) in C:\PIG\Proyecto\Expe.NET\Classes\openKm\cl_OpenKm.vb:line 22
at Expe.Database.FrmMDIExpedientacion.FrmMDIExpedientacion_Load(Object eventSender, EventArgs eventArgs) in C:\PIG\Proyecto\Expe.NET\Forms\FrmMDIExpedientacion.vb:line 524
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, Int32 wParam, Int32 lParam)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Expe.Database.FrmMDIExpedientacion.Main() in C:\PIG\Proyecto\Expe.NET\Forms\FrmMDIExpedientacion.vb:line 0
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.IO.IOException
Message=Unable to read data from the transport connection: Se ha forzado la interrupción de una conexión existente por el host remoto.
Source=System
StackTrace:
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
InnerException: System.Net.Sockets.SocketException
ErrorCode=10054
Message=Se ha forzado la interrupción de una conexión existente por el host remoto
NativeErrorCode=10054
Source=System
StackTrace:
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
InnerException:
Code: Select all
Public Class cl_OpenKm
Private _stoken As String
Public openKMAuth As OKMAuthService.OKMAuthService
Public Sub New()
openKMAuth = New OKMAuthService.OKMAuthService
End Sub
Public Sub Login(ByVal user As String, ByVal password As String)
_stoken = openKMAuth.login("user", "pass")
End Sub
Public Sub Logout(ByVal user As String, ByVal password As String)
openKMAuth.logout(_stoken)
End Sub
Public ReadOnly Property stoken As String
Get
Return _stoken
End Get
End Property
End Class