Reputation: 109
I'm new to Visual Studio and ASP, I need to call a SOAP service that requires passing in a username and password and responds with a Token. I know how to do this in Javascript, but am clueless in C# / ASP.NET.
I have added the Service reference, and it seems to see that there is an issueToken call. But I can't figure out how to use it and pass in the username and password.
I have tried searching google and on here, but everything I have found is basically "add it as a service reference and use it", but I can't figure out the use it part. All I want is to click a button, send the call, and get a token.
This is what I have... not that it'll help.
protected void Button1_Click(object sender, EventArgs e)
{
string userName = "Name";
string password = "Password";
TokenService.issueToken callToken = new TokenService.issueToken();
}
Upvotes: 2
Views: 599
Reputation: 773
Maybe you need to instantiate the Service before.
TokenService myService = new TokenService();
myService.YourDesiredMethod(userName, password);
Seems like you tried to call a static Method on the Service.
Upvotes: 1
Reputation: 56586
It'll look something like this:
string userName = "Name";
string password = "Password";
var proxy = new TokenServiceClient();
var token = proxy.issueToken(userName, password);
proxy.Close();
Upvotes: 2