• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1117
  • Last Modified:

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()

 
0
plq
Asked:
plq
  • 7
  • 7
1 Solution
 
lojk.Net and Infrastructure ConsultantCommented:
can you post the parameters list from the  calling function and the webservice function(you sure its not set as a sub?)

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..
0
 
lojk.Net and Infrastructure ConsultantCommented:
btw i used string in this example because you may find it better to serialise and deserialise the result as appropriate...
0
 
plqAuthor Commented:
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.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileNotFoundException' 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.HttpWebResponse}      System.Net.WebResponse
+            System.Net.HttpWebResponse      {System.Net.HttpWebResponse}      System.Net.HttpWebResponse
            ContentLength      4431      Long
            ContentType      "text/html"      String
+            Headers      {System.Net.WebHeaderCollection}      System.Net.WebHeaderCollection
-            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.Protocols.SoapHttpClientProtocol.doInvoke()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke()
at mycoMobile.mypc.Service.WebDatabaseList()
at mycoMobile.clsDatabase.DatabaseList()
at mycoMobile.frmMain.ConnectToServer()
at mycoMobile.frmMain.ProcessServerAction()
at mycoMobile.frmMain.cmdServerAction_Click()
at System.Windows.Forms.Control.OnClick()
at System.Windows.Forms.Button.OnClick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at mycoMobile.frmMain.Main()
"      String
            Status      ProtocolError {7}      System.Net.WebExceptionStatus
            InnerException      Nothing      System.Exception
            Message      "WebException"      String
            StackTrace      "at System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke()
at mycoMobile.mypc.Service.WebDatabaseList()
at mycoMobile.clsDatabase.DatabaseList()
at mycoMobile.frmMain.ConnectToServer()
at mycoMobile.frmMain.ProcessServerAction()
at mycoMobile.frmMain.cmdServerAction_Click()
at System.Windows.Forms.Control.OnClick()
at System.Windows.Forms.Button.OnClick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at mycoMobile.frmMain.Main()
"      String
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
lojk.Net and Infrastructure ConsultantCommented:
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...
0
 
plqAuthor Commented:
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.
0
 
lojk.Net and Infrastructure ConsultantCommented:
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)?
0
 
plqAuthor Commented:
I am able to invoke a new web service from this client. But not my existing one.. so I am investigating some more now..
0
 
plqAuthor Commented:
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
0
 
plqAuthor Commented:
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
0
 
lojk.Net and Infrastructure ConsultantCommented:
@RomMod... I did actually answer the question with a question....

#######################################
Comment from lojk
Date: 06/13/2006 02:20PM BST
 Your Comment  

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?  
#######################################

#######################################
Comment from plq
Date: 06/13/2006 03:14PM BST
 Author Comment  

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 dont feel a total refund is entirely fair, i had spend time on helping plq, and offered a suggestion that was approximately correct...

Although, i understand that 'The Judges decision is Final' i feel i should at least be allocated at least some points for my efforts...
0
 
plqAuthor Commented:
Sorry !
0
 
lojk.Net and Infrastructure ConsultantCommented:
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...

0
 
plqAuthor Commented:
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
0
 
lojk.Net and Infrastructure ConsultantCommented:
No probs... Nobody's perfect... Apprently not *even* me!  :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now