Solved

Calling Web service from vb.NET 2005 Mobile app raises error "In order to evaluate an indexed property..."

Posted on 2006-06-12
15
1,085 Views
Last Modified: 2012-05-05
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
Comment
Question by:plq
  • 7
  • 7
15 Comments
 
LVL 9

Expert Comment

by:lojk
ID: 16890489
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
 
LVL 9

Expert Comment

by:lojk
ID: 16890509
btw i used string in this example because you may find it better to serialise and deserialise the result as appropriate...
0
 
LVL 8

Author Comment

by:plq
ID: 16892249
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
 
LVL 9

Expert Comment

by:lojk
ID: 16892827
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
 
LVL 8

Author Comment

by:plq
ID: 16893525
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
 
LVL 9

Expert Comment

by:lojk
ID: 16893869
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
 
LVL 8

Author Comment

by:plq
ID: 16894014
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 8

Author Comment

by:plq
ID: 16894033
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
 
LVL 8

Author Comment

by:plq
ID: 16894359
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
 
LVL 9

Accepted Solution

by:
lojk earned 500 total points
ID: 16919124
@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
 
LVL 8

Author Comment

by:plq
ID: 16919246
Sorry !
0
 
LVL 9

Expert Comment

by:lojk
ID: 16920534
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
 
LVL 8

Author Comment

by:plq
ID: 16920610
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
 
LVL 9

Expert Comment

by:lojk
ID: 16921680
No probs... Nobody's perfect... Apprently not *even* me!  :-)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now