App.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="WindowsApplication1.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<applicationSettings>
<WindowsApplication1.My.MySettings>
<setting name="WindowsApplication1_LPWebService_Service" serializeAs="String">
<value>
</setting>
</WindowsApplication1.My.MySettings>
</applicationSettings>
</configuration>
Reference.vb:
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.1433
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
Imports System
Imports System.ComponentModel
Imports System.Data
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization
'
'This source code was auto-generated by Microsoft.VSDesigner, Version 2.0.50727.1433.
'
Namespace LPWebService
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433"), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Web.Services.WebServiceBindingAttribute(Name:="ServiceSoap", [Namespace]:="
_
Partial Public Class Service
Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
Private GetItemsToPullOperationCompleted As System.Threading.SendOrPostCallback
Private GetNoItemsToPullOperationCompleted As System.Threading.SendOrPostCallback
Private useDefaultCredentialsSetExplicitly As Boolean
'''<remarks/>
Public Sub New()
MyBase.New
Me.Url = Global.WindowsApplication1.My.MySettings.Default.WindowsApplication1_LPWebService_Service
If (Me.IsLocalFileSystemWebService(Me.Url) = true) Then
Me.UseDefaultCredentials = true
Me.useDefaultCredentialsSetExplicitly = false
Else
Me.useDefaultCredentialsSetExplicitly = true
End If
End Sub
Public Shadows Property Url() As String
Get
Return MyBase.Url
End Get
Set
If (((Me.IsLocalFileSystemWebService(MyBase.Url) = true) _
AndAlso (Me.useDefaultCredentialsSetExplicitly = false)) _
AndAlso (Me.IsLocalFileSystemWebService(value) = false)) Then
MyBase.UseDefaultCredentials = false
End If
MyBase.Url = value
End Set
End Property
Public Shadows Property UseDefaultCredentials() As Boolean
Get
Return MyBase.UseDefaultCredentials
End Get
Set
MyBase.UseDefaultCredentials = value
Me.useDefaultCredentialsSetExplicitly = true
End Set
End Property
'''<remarks/>
Public Event GetItemsToPullCompleted As GetItemsToPullCompletedEventHandler
'''<remarks/>
Public Event GetNoItemsToPullCompleted As GetNoItemsToPullCompletedEventHandler
'''<remarks/>
<System.Web.Services.Protocols.SoapDocumentMethodAttribute("
RequestNamespace:="
ResponseNamespace:="
Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _
Public Function GetItemsToPull(ByVal strJobNo As String) As System.Data.DataSet
Dim results() As Object = Me.Invoke("GetItemsToPull", New Object() {strJobNo})
Return CType(results(0),System.Data.DataSet)
End Function
'''<remarks/>
Public Overloads Sub GetItemsToPullAsync(ByVal strJobNo As String)
Me.GetItemsToPullAsync(strJobNo, Nothing)
End Sub
'''<remarks/>
Public Overloads Sub GetItemsToPullAsync(ByVal strJobNo As String, ByVal userState As Object)
If (Me.GetItemsToPullOperationCompleted Is Nothing) Then
Me.GetItemsToPullOperationCompleted = AddressOf Me.OnGetItemsToPullOperationCompleted
End If
Me.InvokeAsync("GetItemsToPull", New Object() {strJobNo}, Me.GetItemsToPullOperationCompleted, userState)
End Sub
Private Sub OnGetItemsToPullOperationCompleted(ByVal arg As Object)
If (Not (Me.GetItemsToPullCompletedEvent) Is Nothing) Then
Dim invokeArgs As System.Web.Services.Protocols.InvokeCompletedEventArgs = CType(arg,System.Web.Services.Protocols.InvokeCompletedEventArgs)
RaiseEvent GetItemsToPullCompleted(Me, New GetItemsToPullCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState))
End If
End Sub
'''<remarks/>
<System.Web.Services.Protocols.SoapDocumentMethodAttribute("
RequestNamespace:="
ResponseNamespace:="
Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _
Public Function GetNoItemsToPull(ByVal strJobNo As String) As Integer
Dim results() As Object = Me.Invoke("GetNoItemsToPull", New Object() {strJobNo})
Return CType(results(0),Integer)
End Function
'''<remarks/>
Public Overloads Sub GetNoItemsToPullAsync(ByVal strJobNo As String)
Me.GetNoItemsToPullAsync(strJobNo, Nothing)
End Sub
'''<remarks/>
Public Overloads Sub GetNoItemsToPullAsync(ByVal strJobNo As String, ByVal userState As Object)
If (Me.GetNoItemsToPullOperationCompleted Is Nothing) Then
Me.GetNoItemsToPullOperationCompleted = AddressOf Me.OnGetNoItemsToPullOperationCompleted
End If
Me.InvokeAsync("GetNoItemsToPull", New Object() {strJobNo}, Me.GetNoItemsToPullOperationCompleted, userState)
End Sub
Private Sub OnGetNoItemsToPullOperationCompleted(ByVal arg As Object)
If (Not (Me.GetNoItemsToPullCompletedEvent) Is Nothing) Then
Dim invokeArgs As System.Web.Services.Protocols.InvokeCompletedEventArgs = CType(arg,System.Web.Services.Protocols.InvokeCompletedEventArgs)
RaiseEvent GetNoItemsToPullCompleted(Me, New GetNoItemsToPullCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState))
End If
End Sub
'''<remarks/>
Public Shadows Sub CancelAsync(ByVal userState As Object)
MyBase.CancelAsync(userState)
End Sub
Private Function IsLocalFileSystemWebService(ByVal url As String) As Boolean
If ((url Is Nothing) _
OrElse (url Is String.Empty)) Then
Return false
End If
Dim wsUri As System.Uri = New System.Uri(url)
If ((wsUri.Port >= 1024) _
AndAlso (String.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) = 0)) Then
Return true
End If
Return false
End Function
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")> _
Public Delegate Sub GetItemsToPullCompletedEventHandler(ByVal sender As Object, ByVal e As GetItemsToPullCompletedEventArgs)
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433"), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code")> _
Partial Public Class GetItemsToPullCompletedEventArgs
Inherits System.ComponentModel.AsyncCompletedEventArgs
Private results() As Object
Friend Sub New(ByVal results() As Object, ByVal exception As System.Exception, ByVal cancelled As Boolean, ByVal userState As Object)
MyBase.New(exception, cancelled, userState)
Me.results = results
End Sub
'''<remarks/>
Public ReadOnly Property Result() As System.Data.DataSet
Get
Me.RaiseExceptionIfNecessary
Return CType(Me.results(0),System.Data.DataSet)
End Get
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")> _
Public Delegate Sub GetNoItemsToPullCompletedEventHandler(ByVal sender As Object, ByVal e As GetNoItemsToPullCompletedEventArgs)
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433"), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code")> _
Partial Public Class GetNoItemsToPullCompletedEventArgs
Inherits System.ComponentModel.AsyncCompletedEventArgs
Private results() As Object
Friend Sub New(ByVal results() As Object, ByVal exception As System.Exception, ByVal cancelled As Boolean, ByVal userState As Object)
MyBase.New(exception, cancelled, userState)
Me.results = results
End Sub
'''<remarks/>
Public ReadOnly Property Result() As Integer
Get
Me.RaiseExceptionIfNecessary
Return CType(Me.results(0),Integer)
End Get
End Property
End Class
End Namespace