user10035655
user10035655

Reputation:

how to make web request and get the response using c#

i am trying to make a web service from WSDL so i have added the service reference , the aacheck takes 3 parameters username,password and the result i cant handle the third parameter it keep display

argument 3 must be passed with ref keyword

how to fix this ? the code:

ServiceReference1.nwebserviceClient req = new ServiceReference1.nwebserviceClient();           
 req.aaCheck(username.Text, password.Text,third parameter);

I have tried to replace the third parameter with lable.Text did not work also .tostring(); and still not work what should i replace with the third parameter

Error message

Upvotes: 0

Views: 101

Answers (2)

Tim
Tim

Reputation: 28530

You need to do as the error message says - pass the value in with the 'ref' keyword in front of it.

var someResult = String.Empty;

ServiceReference1.nwebserviceClient req = new ServiceReference1.nwebserviceClient(); 
req.aaCheck(username.Text, password.Text, ref someReult);

Then you can do what you want with someResult.

Upvotes: 0

Klaus Gütter
Klaus Gütter

Reputation: 12007

So your web service seems to expect a ref string as third parameter. Guessing from the parameter name probably to return some result. The following will work:

string resultDesc = "";
req.aaCheck(username.Text, password.Text, ref resultDesc);
label.Text = resultDesc;

Upvotes: 1

Related Questions