Hi
I have created a web service with a simple method that returns "Hello World". The web service works when tested. However, when it is consumed by my smart device application, I get the error "WebException was unhandled, Could not establish connection to network". What is the cause and how do i resolve?
Here's my code
**************************************************************************************************************************************
Form calling web service method "localhost.Service.HelloWorld()"
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.ClickDim MyService As localhost.Service = New localhost.Service()
Dim MyService As localhost.Service = New localhost.Service()
End Sub
**********************************************************************************************************************************************
Error occus at line underlined and italicised
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.42
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
Option Strict OffOption Explicit OnImports System
Option Explicit OnImports System
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.CompactFramework.Design.Data, Version 2.0.50727.42.
Namespace localhost '''<remarks/>
'''<remarks/>
<System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _System.Web.Services.WebServiceBindingAttribute(Name:="ServiceSoap", [Namespace]:="http://tempuri.org/")> _Partial Public Class ServiceInherits System.Web.Services.Protocols.SoapHttpClientProtocol '''<remarks/>
System.Web.Services.WebServiceBindingAttribute(Name:="ServiceSoap", [Namespace]:="http://tempuri.org/")> _Partial Public Class ServiceInherits System.Web.Services.Protocols.SoapHttpClientProtocol '''<remarks/>
Partial Public Class ServiceInherits System.Web.Services.Protocols.SoapHttpClientProtocol '''<remarks/>
Inherits System.Web.Services.Protocols.SoapHttpClientProtocol '''<remarks/>
Public Sub New()MyBase.NewMe.Url = "http://localhost/WSUpdateData/Service.asmx"
MyBase.NewMe.Url = "http://localhost/WSUpdateData/Service.asmx"
Me.Url = "http://localhost/WSUpdateData/Service.asmx"
<System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/HelloWorld", RequestNamespace:="http://tempuri.org/", ResponseNamespace:="http://tempuri.org/", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _Public Function HelloWorld() As String
Public Function HelloWorld() As String
Dim results() As Object = Me.Invoke("HelloWorld", New Object(-1) {}) <<<<< ERROR OCCUR AT THIS LINEReturn CType(results(0),String)End Function
Return CType(results(0),String)End Function
End Function
Public Function BeginHelloWorld(ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResultReturn Me.BeginInvoke("HelloWorld", New Object(-1) {}, callback, asyncState)End Function
Return Me.BeginInvoke("HelloWorld", New Object(-1) {}, callback, asyncState)End Function
Public Function EndHelloWorld(ByVal asyncResult As System.IAsyncResult) As String
Dim results() As Object = Me.EndInvoke(asyncResult)Return CType(results(0),String)End Function
End Namespace
The melody of logic will always play out the truth. ~ Narumi Ayumu, Spiral