1

I am trying to consume a remote ASP.NET WebMethod using the Windows Phone SDK 7.1 I have the following C# Code:

public static PublicServices.RegisteredServicesSoapClient taarafClient;

App.taarafClient.FetchStreamCompleted +=
  new EventHandler<PublicServices.FetchStreamCompletedEventArgs>(
  taarafClient_FetchStreamCompleted);

When running this code I am getting the exception in the title.

I am using a Service Reference: The exception is here:

public Taaraf.PublicServices.FetchStreamResponse EndFetchStream(
  System.IAsyncResult result)
{
    object[] _args = new object[0];
    Taaraf.PublicServices.FetchStreamResponse _result =
      (Taaraf.PublicServices.FetchStreamResponse)
      base.EndInvoke("FetchStream", _args, result);
    return _result;
}
Owen Blacker
  • 4,117
  • 2
  • 33
  • 70
Boudi Maatouk
  • 19
  • 1
  • 1
  • 2
  • 1
    What's the `InnerException` on the `FaultException`? – MrMDavidson Apr 29 '12 at 10:26
  • 1
    An unhandled exception of type 'System.ServiceModel.FaultException' occurred in System.ServiceModel.dll Additional information: Server was unable to process request. ---> Object reference not set to an instance of an object. – Boudi Maatouk Apr 30 '12 at 20:31
  • What is the `FetchStream` method expecting for the args parameter? (I was not aware you could actually serialize a zero length array, does passing *null* instead of *_args* work?). – iCollect.it Ltd May 01 '12 at 16:06

1 Answers1

4

Based on the InnerException details you've provided the server is throwing an NullReferenceException. Is this a service you control? To confirm that it's the service - and not WP7's service client - try creating a simple console application, passing in the same values, and seeing if it generates the same error.

But to me it definitely looks like the error is on the server side. By creating a simple console application you'll hopefully eliminate it being a WP7 specific issue and a more general issue to be fixed in the service.

MrMDavidson
  • 2,705
  • 21
  • 20
  • Yes I do control the service. However, calling it with jQuery and WindowsRT seems to work fine. It's just Windows Phone 7 that's having this issue... – user1027620 May 01 '12 at 02:46
  • Can you post the service interface you're calling? Also, what's the actual service call you're making? You've not actually included where you're calling the service or what the parameters are. – MrMDavidson May 01 '12 at 03:49
  • Can you post the arguments you're using ? I've just added a reference to it and called `FetchStreamAsync("Client", 100, "Foo", "Bar")` and it's working. I'm getting back a `null` result, but there's no exceptions. Same behaviour for those arguments from a .Net 4.0 desktop client and a WP7.1 client. – MrMDavidson May 01 '12 at 11:20
  • hmm, I am sending ("boudinitest", 1, "Standard", "User") third argument must be "Standard" – user1027620 May 01 '12 at 11:23
  • Yeah - that's throwing in your server when called from a .Net 4.0 desktop application called with those exact same arguments; client.FetchStream("boudinitest", 1, "Standard", "User"); – MrMDavidson May 01 '12 at 11:32
  • Do you know how I can debug this? I have administrator access on the server where the app is deployed. – user1027620 May 01 '12 at 11:33
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/10739/discussion-between-mrmdavidson-and-user1027620) – MrMDavidson May 01 '12 at 11:37