locked
Page Login in Windows Store App RRS feed

  • Question

  • Hi all, I create a Login Page for windows store app using visual studio 2012 ultimate. How I can connect web service? My app is framework 4.0. I already add service reference in my app. Have anyone can help me solve this problem? Thanks. : )

    There have 2 method that I use for connect web service but can't work:

    ServiceReference1. Service1SoapClient myClient = new ServiceReference1.Service1SoapClient();
    myClient.loginwebCompleted += new EventHandler<ServiceReference2.loginwebCompletedEventArgs (myClient_loginCompleted);
    myClient.loginwebAsync(logintxt_UserName.Text, logintxt_Password.Text);

    and 

    private async void loginAsync(string username, string password)
    {
    ServiceReference1.Service1SoapClient service = new ServiceReference1.Service1SoapClient();
    var response = service.loginwebAsync(username, password);
    }
    
    private void btnLogin_Click(object sender, RoutedEventArgs e)
    {
    string user = txtUsername.Text;
    string pass = txtPassword.Text;
    System.Threading.Tasks.Task.Run(() =>
    {
    loginAsync(user, pass);
    });
    }

    After run my program, it come out this error! 

    ----> mscorlib.pdf not loaded




    Tuesday, August 27, 2013 3:52 PM

Answers

  • can you share a demo project with us? the first manenr you describe isnt working in windows store apps. The second should only you should add the await keyword

    private async void loginAsync(string username, string password)
    {
    ServiceReference1.Service1SoapClient service = new ServiceReference1.Service1SoapClient();
    var response = await service.loginwebAsync(username, password);
    }


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Wednesday, August 28, 2013 2:39 PM
  • The language the web service and client are implemented in do not matter to each other. They use a standard interface so they can communicate even if written in different languages and on different platforms.

    --Rob

    Wednesday, August 28, 2013 6:31 PM
    Moderator
  • Hello mikoyu,

    You can see this link:

    consume-web-service-in-metro-style-app

    May be helpful for you.

    Saturday, August 31, 2013 4:10 AM

All replies

  • Take a look at Matt's blog entry Help me! How do I connect to an ASMX web service?

    If you still need help after that please provide more details on where exactly you are having problems.

    --Rob

    Wednesday, August 28, 2013 12:47 AM
    Moderator
  • Hi, Rob. Can I ask If my web service is use vb code to create database and my project is use C# to create windows store app? is it my project can connect to web service? hope you can understand my language. sorry for I not good at explanation. 
    Wednesday, August 28, 2013 1:06 PM
  • can you share a demo project with us? the first manenr you describe isnt working in windows store apps. The second should only you should add the await keyword

    private async void loginAsync(string username, string password)
    {
    ServiceReference1.Service1SoapClient service = new ServiceReference1.Service1SoapClient();
    var response = await service.loginwebAsync(username, password);
    }


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Wednesday, August 28, 2013 2:39 PM
  • The language the web service and client are implemented in do not matter to each other. They use a standard interface so they can communicate even if written in different languages and on different platforms.

    --Rob

    Wednesday, August 28, 2013 6:31 PM
    Moderator
  • ok, thank you Dave.. :) Can I ask how to share a demo project at here?  
    Friday, August 30, 2013 12:18 PM
  • ok, Rob...I understand what you said and thank you for provide me that information... :) 
    Friday, August 30, 2013 12:25 PM
  • Hello mikoyu,

    You can see this link:

    consume-web-service-in-metro-style-app

    May be helpful for you.

    Saturday, August 31, 2013 4:10 AM