NicholaiRen
NicholaiRen

Reputation: 377

WCF Web service is converting return value to output parameters

I have a method in a C# WCF Web service like so:

[OperationContract]
bool GetEnvironment()

However, when I add it as a web reference, the method becomes

void GetEnvironment(out bool GetEnvironmentResult, out bool GetEnvironmentResultSpecified);

I've attempted to publish and republish the web service. I've removed all the other methods from the service except this one, and then republished the web service to verify that it's not breaking from one of the other methods. I typically use DTO's, however I really cannot believe that WCF does not support a boolean as a return type.

Update 1: I've recognized that adding the service reference is the best way to do this, as creating a new C# Project allows me to use these methods perfectly fine. The issue is that I'm using Xamarin, and as a result that doesn't allow me to add Service References(It should though), it only allows me to add Web References.

Upvotes: 0

Views: 394

Answers (1)

Selim Yildiz
Selim Yildiz

Reputation: 5370

First you can return boolean type from WCF. However according to using-message-contracts if you are using a MessageContract parameter, then you can not return boolean.

About to extra parameters that you see in Client, wcf-will-not-return-an-int you can find answer. It says:

You should import it as a Service Reference (with name space MData) instead Web Reference.

Upvotes: 1

Related Questions