Skip to main content

Microsoft Silverlight

Answered Question Web Services Error on List<string> after upgrading from Silverlight 2 Beta 2 to Silverlight 3RSS Feed

(0)

salosa
salosa

Member

Member

3 points

24 Posts

Web Services Error on List<string> after upgrading from Silverlight 2 Beta 2 to Silverlight 3

Hi there,

Currently I'm having this crazy web services error. I have zero background on the web services and the web services that I'm using right now was created by someone else.

The web services is working when my project was in Silverlight 2 Beta 2. But once I've upgrade my silverlight to Silverlight 3, then it has this error occurred. The error happened when trying to pass a List<string> from Web Services to my Overview.xaml. The error message that I found in Fiddler is: Object reference not set to an instance of an object.

In my overview.xaml, I have code as below to call the web services.
WCFListofValues.WCFListofValuesClient ddlListClient = new Depot.WCFListofValues.WCFListofValuesClient();

ddlListClient.GetStateListCompleted += new EventHandler<Depot.WCFListofValues.GetStateListCompletedEventArgs>(ddlListClient_GetStateListCompleted);

ddlListClient.GetStateListAsync();

void ddlListClient_GetStateListCompleted(object sender, Depot.WCFListofValues.GetStateListCompletedEventArgs e)
{
            var asmxStateList = e.Result;
            for (int i = 1; i < asmxStateList.Count; i++)
            {
                ddlOverviewState.Items.Add(asmxStateListIdea.ToString());
            }

            ddlOverviewState.UpdateLayout();
            ddlOverviewState.SelectedIndex = 0;
}

Below are my project print screens. Hope they are clear enough. Please do help me as I've spent a week to solve this out. I really don't know anything on web services. I don't get it why it cannot pass the List<string> from web services right after I upgrade my project to Silverlight 3. Thanks a lot!

 Depot Solution List
Depot Solutions

WcflisttoValues.svc.cs WCFListofValues.svc.cs
IWcflistofValues

IWCFListofValues.cs

 

MarkMonster
MarkMonster

Contributor

Contributor

5220 points

1,046 Posts

Re: Web Services Error on List<string> after upgrading from Silverlight 2 Beta 2 to Silverlight 3

Hmm, very strange. Did you try updating the web/service reference in the Silverlight project?

Also can you show a little bit more on the error, like the stacktrace? That will probably help very much.

Mark Monster - MCPD Enterprise
http://mark.mymonster.nl
Silverlight and Expression Insiders UG

Dont forget to click "Mark as Answer" on the post that helped you.

salosa
salosa

Member

Member

3 points

24 Posts

Re: Re: Web Services Error on List<string> after upgrading from Silverlight 2 Beta 2 to Silverlight 3

Hi Mark,

Thanks for the quick reply. Yes, I've updated my web service reference in the Silverlight project. I've even deleted and re-added it again. But still the same problem. :(

Below is the stacktrace of the error message. Please let me know if you need further detail on the error. I really have no idea on the web services. Once again, thanks!

System.ServiceModel.CommunicationException was unhandled by user code
  Message="The remote server returned an error: NotFound."
  StackTrace:
       at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
       at Depot.WCFListofValues.WCFListofValuesClient.WCFListofValuesClientChannel.EndGetStateList(IAsyncResult result)
       at Depot.WCFListofValues.WCFListofValuesClient.Depot.WCFListofValues.IWCFListofValues.EndGetStateList(IAsyncResult result)
       at Depot.WCFListofValues.WCFListofValuesClient.OnEndGetStateList(IAsyncResult result)
       at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
  InnerException: System.Net.WebException
       Message="The remote server returned an error: NotFound."
       StackTrace:
            at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
            at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
            at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
       InnerException: System.Net.WebException
            Message="The remote server returned an error: NotFound."
            StackTrace:
                 at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
                 at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
                 at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
            InnerException:

Stacktrace

MarkMonster
MarkMonster

Contributor

Contributor

5220 points

1,046 Posts

Re: Re: Re: Web Services Error on List<string> after upgrading from Silverlight 2 Beta 2 to Silverlight 3

Looks like the url that's configured to access the WebService isn't working anymore. Did you try accessing the url that you use to access the WebService through your web browser?

Mark Monster - MCPD Enterprise
http://mark.mymonster.nl
Silverlight and Expression Insiders UG

Dont forget to click "Mark as Answer" on the post that helped you.

salosa
salosa

Member

Member

3 points

24 Posts

Re: Re: Re: Web Services Error on List<string> after upgrading from Silverlight 2 Beta 2 to Silverlight 3

 Hi Mark,

You mean like using this url: http://localhost:51904/WCFListofValues.svc
Sorry, I'm not so sure how to test the web services.

http://localhost:51904/WCFListofValues.svc

 

xml 

MarkMonster
MarkMonster

Contributor

Contributor

5220 points

1,046 Posts

Re: Re: Re: Re: Web Services Error on List<string> after upgrading from Silverlight 2 Beta 2 to Silverlight 3

Do you have a ServiceReferences.ClientConfig file? And what are the contents?

Mark Monster - MCPD Enterprise
http://mark.mymonster.nl
Silverlight and Expression Insiders UG

Dont forget to click "Mark as Answer" on the post that helped you.

salosa
salosa

Member

Member

3 points

24 Posts

Re: Re: Re: Re: Web Services Error on List<string> after upgrading from Silverlight 2 Beta 2 to Silverlight 3

 Here is my ServiceReferences.ClientConfig

http://lh6.ggpht.com/_hCR3ma25LDY/StxurXH0aZI/AAAAAAAAAGQ/uL4xzPEJp90/s800/serviceRefence.clientCofig.jpg 

MarkMonster
MarkMonster

Contributor

Contributor

5220 points

1,046 Posts

Re: Re: Re: Re: Re: Web Services Error on List<string> after upgrading from Silverlight 2 Beta 2 to Silverlight 3

Can you remove the "." after localhost? I'm not sure if it helps, but please try it.

Mark Monster - MCPD Enterprise
http://mark.mymonster.nl
Silverlight and Expression Insiders UG

Dont forget to click "Mark as Answer" on the post that helped you.

salosa
salosa

Member

Member

3 points

24 Posts

Re: Re: Re: Re: Re: Re: Web Services Error on List<string> after upgrading from Silverlight 2 Beta 2 to Silverlight 3

 Hi Mark,

The error still there after removing the "." Sad

MarkMonster
MarkMonster

Contributor

Contributor

5220 points

1,046 Posts

Re: Re: Re: Re: Re: Re: Re: Web Services Error on List<string> after upgrading from Silverlight 2 Beta 2 to Silverlight 3

Hmm, strange, I'm out of ideas, maybe someone else knows what the problem could be.

Mark Monster - MCPD Enterprise
http://mark.mymonster.nl
Silverlight and Expression Insiders UG

Dont forget to click "Mark as Answer" on the post that helped you.

ashurocks
ashurocks

Member

Member

50 points

27 Posts

Re: Web Services Error on List<string> after upgrading from Silverlight 2 Beta 2 to Silverlight 3

Hi Sal ,

Before suggesting u anything just i would like to make sure some thing

Just after right click on service reference go to configure service refernece and then set collection type to generics.List

I Can suggest u two solutions

The code i have reviewed  u r using List<string>.

1.  Try Using List<String> as string is C# datatype and String is dotnetFramwork Datatype. Hope this can rectify ur problem .

2. Otherwise the Way Around solution to this problem is create a class having property List<string>  in WCF service and the specifying the return type as that Class object.

Make Sure when tring to pass object between WCF and silverlight, the object class should be of WCF service  only otherwise u will get exception.

Hope This work Out for U

  

salosa
salosa

Member

Member

3 points

24 Posts

Re: Re: Web Services Error on List<string> after upgrading from Silverlight 2 Beta 2 to Silverlight 3

 ashurocks,

sorry for late replying.

thanks for the solutions. I've tried them. but bad news...still the same error.. Crying

salosa
salosa

Member

Member

3 points

24 Posts

Answered Question

Re: Re: Re: Web Services Error on List<string> after upgrading from Silverlight 2 Beta 2 to Silverlight 3

Finally, I got it solved.
I have to remove all the related web services files in my silverlight project, this included the ServiceReferences.ClientConfig. Then I re-added everything again and it works!

 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities