Anji Chelloju

Anji Chelloju

  • NA
  • 35
  • 12k

Basic Authentication In windows Store app using webservice

Jul 4 2014 2:40 AM
hi,
I am New to window Store app,
I have web service like below
public AuthHeader AuthHeaderValue;
[SoapHeader("AuthHeaderValue", Required = true)]
[WebMethod]
public bool Authentiction()
{
if (AuthHeaderValue.Username == "anji" && AuthHeaderValue.Password == "anji")
{
return true;
}
return false;
}
public class AuthHeader: SoapHeader
{
public string Username;
public string Password;

}
 ---------------------------------------------------------------------
 and My web service method soap requset like below ,
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header> <AuthHeader xmlns="http://tempuri.org/"> <Username>string</Username> <Password>string</Password>
</AuthHeader> </soap:Header>
<soap:Body> <Authentiction xmlns="http://tempuri.org/" />
</soap:Body>
</soap:Envelope> 

And I wanna pass values to Authheader
when add reference to my app,
It is not allowing me to pass values through webservice reference object.......................
ServiceReference1.AuthenticationSoapClient service = new ServiceReference1.AuthenticationSoapClient();
ServiceReference1.AuthHeader authentication = new ServiceReference1.AuthHeader();
authentication.Username = "anji";
authentication.Password = "anji";
service.AuthHeaderValue= authentication;
 
Is there any other way to pass values through metro app..... 
please provide the solution struggling with 3 days...Please Help.........................
Thanks,
Anji