behzad razzaqi
behzad razzaqi

Reputation: 275

Call ASMX web service with parameter and get value from that web service?

I'm a new in c# and very beginner,need to call this web service in c# windows application:

http://192.168.200.102:8086/ws_bills.asmx

for that purpose i right click on the solution explorer and add web service with behzadService name and try write code for call that:

behzadService.WS_Bills beh = new behzadService.WS_Bills();

But i want call this url with that code:

enter image description here

How can i write c# code for send UserName,Password,TelNo,Cycle? And my other question that web service return me this:

enter image description here

How can i parse TelNo,CurrBill,TotalBill with that call?

Please write code. that web service result is this:
enter image description here

Upvotes: 2

Views: 1951

Answers (3)

Huseyin Durmus
Huseyin Durmus

Reputation: 440

I wrote web service return table

behzadService.WS_Bills beh = new behzadService.WS_Bills();
DataSet dsResult = beh.GetBills("Username", "Password", "12565855555", "A");
DataTable dtResult = dsResult.Tables[0];

        foreach (DataRow row in dtResult.Rows)
        {
            long telNo = Convert.ToInt64(row["Telno"]);
            decimal curBill = Convert.ToDecimal(row["CurBill"]);
            decimal totalBill = Convert.ToDecimal(row["TotalBill"]);
        }

Upvotes: 1

Huseyin Durmus
Huseyin Durmus

Reputation: 440

I wrote parse result.

behzadService.WS_Bills beh = new behzadService.WS_Bills();
var result = beh.GetBills("Username","Password","0012565855555","A");
long telNo = Convert.ToInt64(result.Telno,0);
decimal curBill = Convert.ToDecimal(result.CurBill,0);
decimal totalBill= Convert.ToDecimal(result.TotalBill,0);

Upvotes: 0

Faraz Ahmed
Faraz Ahmed

Reputation: 1607

you can call webservice by calling GetBills function

behzadService.WS_Bills beh = new behzadService.WS_Bills();
var result = beh.GetBills("Shahzad","1233","021344444444","any value");

after that check what result will come in result. and let me know

Upvotes: 0

Related Questions