Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my WCF method requiring parameters that aren't defined? [duplicate]

Tags:

wcf

In my WCF Service I have a function, for example:

bool ValidateLogin(string user, string password)

after I hosted it in windows azure and add references into my web app, that function became:

bool ValidateLogin(string user, string password, out int ValidateLoginResult, out bool ValidateLoginResultSpecified)

Does anyone know what these two parameters are? And how can I prevent it being added after hosting?

like image 934
Kent Avatar asked Dec 06 '25 07:12

Kent


1 Answers

Setting the XmlSerializerFormat Style to RPC did the trick for me. I.e.

[OperationContract, XmlSerializerFormat(Style = OperationFormatStyle.Rpc)]
bool ValidateLogin(string user, string password)

It changes the way the wsdl is generated, from:

<wsdl:message name="IService_ValidateLogin_InputMessage">
    <wsdl:part name="parameters" element="tns:ValidateLogin" />
</wsdl:message>
<wsdl:message name="IService_ValidateLogin_OutputMessage">
    <wsdl:part name="parameters" element="tns:ValidateLoginResponse" />
</wsdl:message>

To:

<wsdl:message name="IService_ValidateLogin_InputMessage">
    <wsdl:part name="user" type="xsd:string" />
    <wsdl:part name="password" type="xsd:string" />
</wsdl:message>
<wsdl:message name="IService_ValidateLogin_OutputMessage">
    <wsdl:part name="ValidateLoginResult" type="xsd:boolean" />
</wsdl:message>

This article propose a different solution, but also contains some extra explanations: http://www.codeproject.com/Articles/323097/WCF-ASMX-Interoperability-Removing-the-Annoying-xx

like image 151
Sébastien Duval Avatar answered Dec 09 '25 03:12

Sébastien Duval



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!