Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web Service Help

Status
Not open for further replies.

zarkon4

MIS
Dec 16, 2003
641
US
I have developed my first web service and have it deployed on a server running IIS. It works great on my developement machine and does what I want it to do. It times out and doesn't run on the server. If I try to consume it in a vb.net app if times out as well. I have tried this with impersonate on and off and this is where I am stuck. Would someone be able to assist or guide me to getting it to work. I am a newbie to ASP.net and IIS so some of this is above my head.
 
Check your proxy... It may be pointing to localhost instead of the correct location... did you set it up as dynamic?

 
k... open the proxy (reference.cs) and make sure that it is retrieving the dynamic URL from the config file. Also, make sure the value (url) in the config file is correct and does in fact point to your deployed instance.

If all else fails, delete the web reference and create a new one, this time pointing to your deployed web-service instead of your local one.

Hope this helps.

 
There is no reference.cs file. there is an app.config and my references all point to the web service on my server.
 
There is a reference.cs file... Either click the "Show All" button in your solution explorer or navigate to it on your file system.... it will be in your web-reference folder.

 
No reference.cs file at all. Would that be a c-sharp file?
I'm not using c# I am using vb.
 
How did you create the web-reference in your project? Did you add it through visual studio or did you use wsdl.exe?


 
I had added it through vb. I am new at this and have been following tutorials to create the web service. What does wsdl.exe do for me, I have not seen it mentioned in the tutorials. Is this the problem?
 
wsdl.exe is used to generate a proxy for the web service outside of Visual Studio... I was just curious if you used it or just added the web-reference in the VS IDE. It's been a while since I've written a web-service in VB, I thought there was still a reference.vb file but maybe its named something else... I will build a quick WS and try myself and will post the results.

 
Ok... I just double-checked... You should have a Reference.vb file... this is your proxy... you can either view this file in Windows explorer or you can use the show all files option in solution explorer.

To view through Windows Explorer:

Navigate to your website folder & open the Web References folder; there should be a file named reference.vb

To view through Solution Explorer:

Highlight your web-service node under the Web References folder in your web-site. There are a series of buttons at the top of the Solution Explorer. The second one is used to "Show All Files." Click that button (with the web-service highlighted). You should now see a plus sign to the left of the web service. Expand that... Under there you will see Reference.map with a plus sign next to it, expand that and you will see Reference.vb. This is your web proxy.

 
Look at the constructor in the proxy... Make sure it is retrieving the correct key from the config file.

 
Am I comparing to the app.config file in my project?

In it, it the value is the server and name of my service.

In the proxy it is pointing to the namespace I gave it (instead of the defaulted tempuri.org)
 
Can you post the contents of your app config and the constructor from reference.vb?

 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top