plq
asked on
Calling Web service from vb.NET 2005 Mobile app raises error "In order to evaluate an indexed property..."
Calling a web service on the host machine from a vb.net 2005 mobile application - using the emulator.
The web service has a simple method which returns a string. I can call the web service ok from the dev machine browser. The mobile emulator is setup through activesync and it can view web pages etc. However when I try to call a web service method from the emulator I get the following inner exception message:
"In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user."
Any ideas ?
thanks
mxa = New mypc.Service
mxa.Url = http://mypc/x/services/Service.asmx
Return mxa.WebDatabaseList()
The web service has a simple method which returns a string. I can call the web service ok from the dev machine browser. The mobile emulator is setup through activesync and it can view web pages etc. However when I try to call a web service method from the emulator I get the following inner exception message:
"In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user."
Any ideas ?
thanks
mxa = New mypc.Service
mxa.Url = http://mypc/x/services/Service.asmx
Return mxa.WebDatabaseList()
btw i used string in this example because you may find it better to serialise and deserialise the result as appropriate...
ASKER
Here's the method in the web service
<WebMethod()> _
Public Function WebDatabaseList() As String
Return "Hello"
End Function
I added the sRet line as you suggested.
In .net 2005 you right click the webservice and click "Update Reference". I actually removed the reference and re-added it as well. As well as rebooting etc etc
When it runs though the following gets dumped in the debug window
A first chance exception of type 'System.IO.FileNotFoundExc eption' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileNotFoundExc eption' occurred in mscorlib.dll
A first chance exception of type 'System.UriFormatException ' occurred in System.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Web.Services.dll
But the actual exception raised is not giving me anything now
- ex {"WebException"} System.Exception
- System.Net.WebException {"WebException"} System.Net.WebException
InnerException Nothing System.Exception
Message "WebException" String
- Response {System.Net.HttpWebRespons e} System.Net.WebResponse
+ System.Net.HttpWebResponse {System.Net.HttpWebRespons e} System.Net.HttpWebResponse
ContentLength 4431 Long
ContentType "text/html" String
+ Headers {System.Net.WebHeaderColle ction} System.Net.WebHeaderCollec tion
- ResponseUri {System.Uri} System.Uri
AbsolutePath "/x/WidgetServices/Service .asmx" String
AbsoluteUri "http://mypc/x/WidgetServices/Service.asmx" String
Authority "mypc" String
DnsSafeHost "mypc" String
Fragment "" String
Host "mypc" String
HostNameType Dns {2} System.UriHostNameType
IsAbsoluteUri True Boolean
IsDefaultPort True Boolean
IsFile False Boolean
IsLoopback False Boolean
IsUnc False Boolean
LocalPath "/x/WidgetServices/Service .asmx" String
OriginalString "http://mypc/x/WidgetServices/Service.asmx" String
PathAndQuery "/x/WidgetServices/Service .asmx" String
Port 80 Integer
Query "" String
Scheme "http" String
SchemeDelimiter "://" String
+ Segments {Length=4} String()
UriSchemeFile "file" String
UriSchemeFtp "ftp" String
UriSchemeGopher "gopher" String
UriSchemeHttp "http" String
UriSchemeHttps "https" String
UriSchemeMailto "mailto" String
UriSchemeNetPipe "net.pipe" String
UriSchemeNetTcp "net.tcp" String
UriSchemeNews "news" String
UriSchemeNntp "nntp" String
UserEscaped False Boolean
UserInfo "" String
StackTrace "at System.Web.Services.Protoc ols.SoapHt tpClientPr otocol.doI nvoke()
at System.Web.Services.Protoc ols.SoapHt tpClientPr otocol.Inv oke()
at mycoMobile.mypc.Service.We bDatabaseL ist()
at mycoMobile.clsDatabase.Dat abaseList( )
at mycoMobile.frmMain.Connect ToServer()
at mycoMobile.frmMain.Process ServerActi on()
at mycoMobile.frmMain.cmdServ erAction_C lick()
at System.Windows.Forms.Contr ol.OnClick ()
at System.Windows.Forms.Butto n.OnClick( )
at System.Windows.Forms.Butto nBase.WnPr oc()
at System.Windows.Forms.Contr ol._Intern alWnProc()
at Microsoft.AGL.Forms.EVL.En terMainLoo p()
at System.Windows.Forms.Appli cation.Run ()
at mycoMobile.frmMain.Main()
" String
Status ProtocolError {7} System.Net.WebExceptionSta tus
InnerException Nothing System.Exception
Message "WebException" String
StackTrace "at System.Web.Services.Protoc ols.SoapHt tpClientPr otocol.doI nvoke()
at System.Web.Services.Protoc ols.SoapHt tpClientPr otocol.Inv oke()
at mycoMobile.mypc.Service.We bDatabaseL ist()
at mycoMobile.clsDatabase.Dat abaseList( )
at mycoMobile.frmMain.Connect ToServer()
at mycoMobile.frmMain.Process ServerActi on()
at mycoMobile.frmMain.cmdServ erAction_C lick()
at System.Windows.Forms.Contr ol.OnClick ()
at System.Windows.Forms.Butto n.OnClick( )
at System.Windows.Forms.Butto nBase.WnPr oc()
at System.Windows.Forms.Contr ol._Intern alWnProc()
at Microsoft.AGL.Forms.EVL.En terMainLoo p()
at System.Windows.Forms.Appli cation.Run ()
at mycoMobile.frmMain.Main()
" String
<WebMethod()> _
Public Function WebDatabaseList() As String
Return "Hello"
End Function
I added the sRet line as you suggested.
In .net 2005 you right click the webservice and click "Update Reference". I actually removed the reference and re-added it as well. As well as rebooting etc etc
When it runs though the following gets dumped in the debug window
A first chance exception of type 'System.IO.FileNotFoundExc
A first chance exception of type 'System.IO.FileNotFoundExc
A first chance exception of type 'System.UriFormatException
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Web.Services.dll
But the actual exception raised is not giving me anything now
- ex {"WebException"} System.Exception
- System.Net.WebException {"WebException"} System.Net.WebException
InnerException Nothing System.Exception
Message "WebException" String
- Response {System.Net.HttpWebRespons
+ System.Net.HttpWebResponse
ContentLength 4431 Long
ContentType "text/html" String
+ Headers {System.Net.WebHeaderColle
- ResponseUri {System.Uri} System.Uri
AbsolutePath "/x/WidgetServices/Service
AbsoluteUri "http://mypc/x/WidgetServices/Service.asmx" String
Authority "mypc" String
DnsSafeHost "mypc" String
Fragment "" String
Host "mypc" String
HostNameType Dns {2} System.UriHostNameType
IsAbsoluteUri True Boolean
IsDefaultPort True Boolean
IsFile False Boolean
IsLoopback False Boolean
IsUnc False Boolean
LocalPath "/x/WidgetServices/Service
OriginalString "http://mypc/x/WidgetServices/Service.asmx" String
PathAndQuery "/x/WidgetServices/Service
Port 80 Integer
Query "" String
Scheme "http" String
SchemeDelimiter "://" String
+ Segments {Length=4} String()
UriSchemeFile "file" String
UriSchemeFtp "ftp" String
UriSchemeGopher "gopher" String
UriSchemeHttp "http" String
UriSchemeHttps "https" String
UriSchemeMailto "mailto" String
UriSchemeNetPipe "net.pipe" String
UriSchemeNetTcp "net.tcp" String
UriSchemeNews "news" String
UriSchemeNntp "nntp" String
UserEscaped False Boolean
UserInfo "" String
StackTrace "at System.Web.Services.Protoc
at System.Web.Services.Protoc
at mycoMobile.mypc.Service.We
at mycoMobile.clsDatabase.Dat
at mycoMobile.frmMain.Connect
at mycoMobile.frmMain.Process
at mycoMobile.frmMain.cmdServ
at System.Windows.Forms.Contr
at System.Windows.Forms.Butto
at System.Windows.Forms.Butto
at System.Windows.Forms.Contr
at Microsoft.AGL.Forms.EVL.En
at System.Windows.Forms.Appli
at mycoMobile.frmMain.Main()
" String
Status ProtocolError {7} System.Net.WebExceptionSta
InnerException Nothing System.Exception
Message "WebException" String
StackTrace "at System.Web.Services.Protoc
at System.Web.Services.Protoc
at mycoMobile.mypc.Service.We
at mycoMobile.clsDatabase.Dat
at mycoMobile.frmMain.Connect
at mycoMobile.frmMain.Process
at mycoMobile.frmMain.cmdServ
at System.Windows.Forms.Contr
at System.Windows.Forms.Butto
at System.Windows.Forms.Butto
at System.Windows.Forms.Contr
at Microsoft.AGL.Forms.EVL.En
at System.Windows.Forms.Appli
at mycoMobile.frmMain.Main()
" String
Ok firstly i presume we are not using....
mxa = New mypc.Service
mxa.Url = http://mypc/x/services/Service.asmx
Return mxa.WebDatabaseList()
instead
mxa = New mypc.Service
mxa.Url = "http://mypc/x/services/Service.asmx"''<<ie your speech marks were missing
dim tRet as string = mxa.WebDatabaseList()'' and this is where the exception happens (i.e. on the mobile device)
Return tRet
You say that from the browser on the Pc you can access the service, how about from the browser on the mobile device. If not from the latter then it is almost certainly a connectiviity (doubtful but are you sure windows firewall is configured to allow the port for your local machine?! It wont be by default i wouldnt think...) or DNS issue. Try uploading a copy of 'PocketPing' to the Mobile Emulator... Can you Ping 'MyPC'? If you can try changing the http://mypc... to http://WhateverIPNumberYouThinkItShouldBe...
The FileNotFoundException does say to me that it cant find the service URI, either issues mentioned above or even an incorrect File.asmx could be to blame (especially the 'A first chance exception of type 'System.UriFormatException ' occurred in System.dll' comment)..
Double check that all is configured as should be...
I am actually working on some webservice stuff today (in vs2005) , ill do a quick project test with a mobile emulator and let you know...
mxa = New mypc.Service
mxa.Url = http://mypc/x/services/Service.asmx
Return mxa.WebDatabaseList()
instead
mxa = New mypc.Service
mxa.Url = "http://mypc/x/services/Service.asmx"''<<ie your speech marks were missing
dim tRet as string = mxa.WebDatabaseList()'' and this is where the exception happens (i.e. on the mobile device)
Return tRet
You say that from the browser on the Pc you can access the service, how about from the browser on the mobile device. If not from the latter then it is almost certainly a connectiviity (doubtful but are you sure windows firewall is configured to allow the port for your local machine?! It wont be by default i wouldnt think...) or DNS issue. Try uploading a copy of 'PocketPing' to the Mobile Emulator... Can you Ping 'MyPC'? If you can try changing the http://mypc... to http://WhateverIPNumberYouThinkItShouldBe...
The FileNotFoundException does say to me that it cant find the service URI, either issues mentioned above or even an incorrect File.asmx could be to blame (especially the 'A first chance exception of type 'System.UriFormatException
Double check that all is configured as should be...
I am actually working on some webservice stuff today (in vs2005) , ill do a quick project test with a mobile emulator and let you know...
ASKER
Sorry about the quotes, of course it wouldn't have compiled otherwise.
The web service was working fine and then just stopped. Its not emulator connectivity, it can reference web urls on the host system no problem. You can invoke the web service url from the pda but of course you cant test from anywhere except the web service host machine through the .net browser test interface.
The web service was working fine and then just stopped. Its not emulator connectivity, it can reference web urls on the host system no problem. You can invoke the web service url from the pda but of course you cant test from anywhere except the web service host machine through the .net browser test interface.
Running out of suggestions...
Have you confirmed that you have the .Net2.0 as the net engine in IIS virtual Directory and that the Virtual Directory is granting enough permissions to the relevant accessing process? Has there been any security patches applied to the machine?
Have you just tried doing a windows update on the machine(s).
If you access http://mypc/x/services/Service.asmx via a browser does it return the correct XML reply upon invoking?
Have you just tried creating a regular .net app to consume the service in an equivalent way.. does that work (if you run it from another machine)?
Have you confirmed that you have the .Net2.0 as the net engine in IIS virtual Directory and that the Virtual Directory is granting enough permissions to the relevant accessing process? Has there been any security patches applied to the machine?
Have you just tried doing a windows update on the machine(s).
If you access http://mypc/x/services/Service.asmx via a browser does it return the correct XML reply upon invoking?
Have you just tried creating a regular .net app to consume the service in an equivalent way.. does that work (if you run it from another machine)?
ASKER
I am able to invoke a new web service from this client. But not my existing one.. so I am investigating some more now..
ASKER
Let me rephrase that..
I am able to invoke a different web service hosted on the same dev machine from the mobile app
And yes I can access http://mypc/x/services/Service.asmx but in vb.net2005 you can't invoke web services except from the hosting machine in this way
I am able to invoke a different web service hosted on the same dev machine from the mobile app
And yes I can access http://mypc/x/services/Service.asmx but in vb.net2005 you can't invoke web services except from the hosting machine in this way
ASKER
I've found out what the problem is
The web virtual directory for the service was secured with Windows Authentication. Accidentally of course ! So the problem was caused by moving the service from standalone to a project subdirectory.
I can't believe the amount of time I've wasted on this !
thanks for helping
The web virtual directory for the service was secured with Windows Authentication. Accidentally of course ! So the problem was caused by moving the service from standalone to a project subdirectory.
I can't believe the amount of time I've wasted on this !
thanks for helping
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry !
Hey, thats cool, not being funny at all, i promise... Just that we're not all hard-core points addicts on EE unlike *some* i could mention (they know who they are! ;-)). I get as much satisfaction from answering a few questions well and personally than just posting links and moving on.
Dont know about you but sometimes just bouncing ideas off someone else on a simliar wavelength helps a lot, its breaks that 'Brain Deadlock' when you get so frustated you can't see the next logical logical path to follow.
thx for the points, glad to have been whatever help i was...
Dont know about you but sometimes just bouncing ideas off someone else on a simliar wavelength helps a lot, its breaks that 'Brain Deadlock' when you get so frustated you can't see the next logical logical path to follow.
thx for the points, glad to have been whatever help i was...
ASKER
No probs. I used to answer questions and have got about 300k points over a 5 year period, so I;ve been on both sides of the fence. Nowadays I don't have time to answer so pay the dosh instead !
I made a genuine mistake in thinking that you had not answered the question - and did endeavour to read through your comments before requesting an accept. But when working fast under pressure mistakes happen and thats what happened here so I can only apologise ! I try to act in the interests of the PAQ by asking for my q's to become the accepted answer where appropriate, that was my thinking here.
If only points could buy beer !
thanks for your help
I made a genuine mistake in thinking that you had not answered the question - and did endeavour to read through your comments before requesting an accept. But when working fast under pressure mistakes happen and thats what happened here so I can only apologise ! I try to act in the interests of the PAQ by asking for my q's to become the accepted answer where appropriate, that was my thinking here.
If only points could buy beer !
thanks for your help
No probs... Nobody's perfect... Apprently not *even* me! :-)
looks like the return type above is not the same as the originating call or the webservice requires a parameter that you have not specified...
try setting the value using an intermediate variable, this might at least highlight a casting error
dim tRet as string = mxa.WebDatabaseList()
Return tRet
also remember if you have changed webservice parameters you may need to rt-clk 'reload/refresh' that webservice reference within the solution explorer..