Click here to Skip to main content
15,891,905 members

Web Services in Windows 8 XAML Apps

Jashobanta asked:

Open original thread
Hi All,

I am creating 2 apps, one is a WPF App and other one is a XAML Windows 8 app that uses some web services.The services are working fine in WPF but when I am using them in Windows 8 xaml app, it is appending the word Async at the end of the methods. What is the change that I need to do for the same?

C#
WPF Code (Working Fine)
//provide the input in the request
            DepositService.PT2761PortClient portClient2 = new DepositService.PT2761PortClient();
            DepositService.ProgramInterface requestInterface = new DepositService.ProgramInterface();
            DepositService.ProgramInterfaceCb_req_deposit input = new DepositService.ProgramInterfaceCb_req_deposit();

            //set the input parameters
            input.cb_req_accountno = (ulong)accountNumber;
            input.cb_req_cust_id =customerId;
            input.cb_req_update_status = "FETCH";
            requestInterface.cb_req_deposit = input;
            //crea  te the response object


            //create the output from response
            //fetch the output
            try
            {
                DepositService.ProgramInterface1 responseFetch = new DepositService.ProgramInterface1();
                responseFetch = portClient2.PT2761Operation(requestInterface);
                DepositService.ProgramInterfaceCb_res_deposit output = new DepositService.ProgramInterfaceCb_res_deposit();
                output = responseFetch.cb_res_deposit;



WIndows 8 XAML Code :-

C#
LoginService.PT2711PortClient loginPortClient = new LoginService.PT2711PortClient();
           LoginService.ProgramInterface requestInterface = new LoginService.ProgramInterface();
           LoginService.ProgramInterfaceCb_req_login input = new LoginService.ProgramInterfaceCb_req_login();

           //set the input parameteres
               input.cb_req_cust_id = userId;
               input.cb_req_password = password;
               input.cb_req_passwordl = (ushort)password.Length;
               input.cb_req_update_status = "LOGIN";

               requestInterface.cb_req_login=input;

               try
               {
                   LoginService.ProgramInterface1 responseLogin = new LoginService.ProgramInterface1();
                   //LoginService.PT2711OperationResponse x = await loginPortClient.PT2711OperationAsync(responseLogin);
                   responseLogin = await loginPortClient.PT2711OperationAsync(requestInterface);


When I write the same code in Windows 8 app, then the below error is thrown :-

Error 1 Cannot implicitly convert type 'System.Threading.Tasks.Task<metromainframespoc.loginservice.pt2711operationresponse>' to 'MetroMainframesPOC.LoginService.ProgramInterface1'



Can anyone please let me know what changes I need to make to run this code? I am new to Windows 8 App development.

Thanks in Advance.
Regards
Jashobanta
Tags: C#, Windows, XAML

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900