I am trying to write an application (simple form) that will consume(invoke) the web service (Service1.asmx) and display the results. Now, the web service has a method. Here is the code:
public class Service1 : System.Web.Services.WebService { [WebMethod] public Customer getCustomer(String id) { Customer customer = new Customer(); customer.CustomerId = id; customer.CustomerName = "ABC Warehouse"; customer.CustomerAddress = "123 Anywhere"; customer.CustomerCity = "Pittsburgh"; customer.CustomerState = "PA"; customer.CustomerZip = 10379; customer.CustomerContact = "Dan Smith"; customer.CustomerPhone = "2484567890"; customer.CustomerCredit = "True"; return customer; } } When I run the web service from its original project I am able to type text in the text box Example and click invoke to view the xml resultsExample. Now, the simple form I have in another project has a textbox (txt1), button (btn1), and label (lbl1). I successfully add the web service and all the functions and classes transfer. Now, what I want to happen is when you type something in the text box, click submit, and view the xml results in the label which will include the typed text from the text box, exactly like if I would of run the service on its own. Here is the code where I am having trouble:
public partial class _Default : System.Web.UI.Page { protected void btn1_Click(object sender, EventArgs e) { MyService.Service1 service = new MyService.Service1(); string message = service.getCustomer(string id); ID = txt1.Text; lbl1.Text = message; } } Where am I going wrong? I am a beginner obviously, so all help would be appreciated. p.s.: MyService is what I named the namespace when I added the web service