WCF Service out Parameter remains null

I am using a WCF client in my app and the return value of it is correct. The only thing that doesn't work as expected is the proper filling of my out parameter. Its an array of a Service-Reference-Class and remains null. Testing the same call with the WCF Test-Client fills the out parameter correctly. So there is something wrong with the App. But what? Serialization? Please help!

... client.GetMitarbeiterListCompleted += client_GetMitarbeiterListCompleted; client.GetMitarbeiterListAsync(new MSOFTAuth() { Benutzer = Benutzername, Passwort = Passwort, InstanceID = new Guid("xxxxxxx") }, 1, 0, 20); } void client_GetMitarbeiterListCompleted(object sender, GetMitarbeiterListCompletedEventArgs e) { if (e.Error != null) { App.ShowAlert(e.Error.Message); } else { if (e.mitarbeiterList == null) { App.ShowAlert("List is null"); } } }

Posts

  • davidm.123davidm.123 ✭✭ USUniversity ✭✭

    I'm having the exact same issue.

    Here's a bit more about the scenario as I've experienced it:

    • I have a service reference to my WCF service in a Portable Class Library.
    • The code calling the web service method is contained in a public "testing" class in the PCL.
    • A Xamarin.iOS application, which references the PCL, calls the "testing" class. The property on the resulting *CompletedEventArgs class representing the out parameter contains a null.
    • A Windows console application, which references the PCL, calls the "testing" class. The property on the resulting *CompletedEventArgs class representing the out parameter contains an expected, non-null value.
    • The Xamarin.iOS and Windows console applications have the same binding and endpoint configuration.

    Anyone know what's up?

  • davidm.123davidm.123 ✭✭ USUniversity ✭✭

    I've found a couple of bug reports on this issue:

    The issue has been around for quite a while but there seems to be no apparent movement on the issue since it was lasted reported in July 2014 (via Bug #21312).

    Does anyone have additional info on this?

  • SaschaHSaschaH ✭✭ DEMember ✭✭

    Well, not especially info but i worked around this.
    I just wrote the whole WCF thing with WebRequests on my own and did the serialization on my own.
    It works for now and i am getting everything from it what i want, but i stumbled over another error on the serialization site.
    The XML response contained some values that were null. When i wanted to deserialize them using the generated wcf classes (which works like a charm!) i always got an error saying that some formatting issues occured.
    {System.FormatException: Invalid format string at System.DateTime.ParseExact (System.String s, System.String[] formats, IFormatProvider provider, DateTimeStyles style) [0x00000] in <filename unknown>:0
    So looking at the XML Response i found this:
    <a:Name2 i:nil="true">
    among other values saying i:nil=true
    I deleted those lines and voila - it works.
    So maybe that is also the issue in the normal call of the WCF services in the PCL?
    So that the Serialization doesn't work and the out param remains null.
    Maybe the devs could take a look at this and resolve this error?!

  • davidm.123davidm.123 ✭✭ USUniversity ✭✭

    I've been investigating alternatives to Visual Studio Service References and I was hoping I'd not have to roll my own proxy using WebRequests (as you have), but it looks like that option is becoming more of a reality. :(

  • SaschaHSaschaH ✭✭ DEMember ✭✭

    Yeah, but now it works quite good, its async as well and complete with events just like the generated proxies.
    If you need some help and/or advice feel free to ask :)

  • I know this is really late but if anybody has the same problem, check it

    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]

    IsWrapped = false, in the reference.cs

Sign In or Register to comment.