' VB.net code
VB.NET:
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports MSSOAPLib30
Public Class Notificationstatus_class
Private code_ As Integer
Private message_ As String
Public Property code()
Get
code = code_
End Get
Set(ByVal value)
code_ = value
End Set
End Property
Public Property message()
Get
message = message_
End Get
Set(ByVal value)
message_ = value
End Set
End Property
End Class
Public Structure Notificationstatus_stru
Dim code As Integer
Dim message As String
End Structure
Public Class w_soap
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Soap_Client As SoapClient30
Soap_Client = New SoapClient30
Soap_Client.MSSoapInit
"ede.wsdl", "EmfeszDataExchangeService", "ede")
Dim xmlData As String
Dim timestamp As Date = DateTime.Today
Dim entityclass As String = "contract"
Dim read_error As String = ""
xmlData = File_ToString("contract.xml", read_error)
'Dim x_ret
'x_ret = Soap_Client.notifyCreated(entityclass, timestamp, xmlData)
Dim nf_stru As New Notificationstatus_stru
nf_stru = Soap_Client.notifyCreated(entityclass, timestamp, xmlData)
' ?? PROBLEM ??
' error - text
'System.InvalidCastException was unhandled
' Message = "Specified cast is not valid."
' Source = "Soap_prg"
'StackTrace:
' at Soap_prg.w_soap.Button1_Click(Object sender, EventArgs e) in F:\D_DRIVE\SOAP\SOAP_PRG\Soap_prg\w_soap.vb:line 59
' at System.Windows.Forms.Control.OnClick(EventArgs e)
' at System.Windows.Forms.Button.OnClick(EventArgs e)
' at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
' at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
' at System.Windows.Forms.Control.WndProc(Message& m)
' at System.Windows.Forms.ButtonBase.WndProc(Message& m)
' at System.Windows.Forms.Button.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.DispatchMessageW(MSG& msg)
' at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.
IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
' 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.Form.ShowDialog(IWin32Window owner)
' at(System.Windows.Forms.Form.ShowDialog())
' at Soap_prg.Main_.Main() in F:\D_DRIVE\SOAP\SOAP_PRG\Soap_prg\Main_.vb:line 13
' at System.AppDomain.nExecuteAssembly(Assembly 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)
' at(System.Threading.ThreadHelper.ThreadStart())
Dim nf_class As New Notificationstatus_class
nf_class = Soap_Client.notifyCreated(entityclass, timestamp, xmlData)
' ?? PROBLEM ??
' error - text
'System.InvalidCastException was unhandled
' Message = "Unable to cast COM object of type 'System.__ComObject' to class type 'Soap_prg.Notificationstatus'.
nstances of types that represent COM components cannot be cast to types that do not represent COM components;
however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface."
' Source = "Soap_prg"
'StackTrace:
' at Soap_prg.w_soap.Button1_Click(Object sender, EventArgs e) in F:\D_DRIVE\SOAP\SOAP_PRG\Soap_prg\w_soap.vb:line 40
' at System.Windows.Forms.Control.OnClick(EventArgs e)
' at System.Windows.Forms.Button.OnClick(EventArgs e)
' at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
' at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
' at System.Windows.Forms.Control.WndProc(Message& m)
' at System.Windows.Forms.ButtonBase.WndProc(Message& m)
' at System.Windows.Forms.Button.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.DispatchMessageW(MSG& msg)
' at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.
IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
' 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.Form.ShowDialog(IWin32Window owner)
' at(System.Windows.Forms.Form.ShowDialog())
' at Soap_prg.Main_.Main() in F:\D_DRIVE\SOAP\SOAP_PRG\Soap_prg\Main_.vb:line 13
' at System.AppDomain.nExecuteAssembly(Assembly 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)
' at(System.Threading.ThreadHelper.ThreadStart())
End Sub
End Class
Attachments
Last edited by a moderator: