web service consumer

Posted on 2011-10-25
Last Modified: 2012-06-21
hi experts, i have this method of a web service
public DataSet GetSPData(int contactID)
            SqlConnection con;
            SqlCommand cmd;
            SqlDataAdapter adpt;
            DataSet ds = new DataSet();
            string SP = "dbo.ObtenerContacto";
            string connectionStrings = ConfigurationManager.ConnectionStrings["connectStringADW"].ConnectionString;
            con = new SqlConnection(connectionStrings);
            cmd = new SqlCommand(SP, con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@contactID ", SqlDbType.Int, 10).Value = contactID;
            adpt = new SqlDataAdapter(cmd);
            return ds;

this is the result
-<NewDataSet xmlns=""> -<Table diffgr:id="Table1" msdata:rowOrder="0"> <ContactID>995</ContactID> <Title>Ms.</Title> <FirstName>Cathan</FirstName> <LastName>Cook</LastName> <EmailAddress></EmailAddress> </Table> </NewDataSet>

or view attached

can help me create a web application to consume?
Question by:enrique_aeo
    LVL 35

    Accepted Solution

    Check "Creating a Client to Consume Service " section:

    In your case your code behind will look like:
    ServiceReference2.StockClient sc = new ServiceReference2.StockClient();
    Dataset result = sc.GetSPData("Your contact Id goes here");

    Author Comment

    i have this error
    The request channel timed out while waiting for a reply after 00:00:58.9599405. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.

    this is the code
    ServiceReference1.ReviewsSoapClient sc = new ServiceReference1.ReviewsSoapClient();
    DataSet result = sc.GetSPData(1);

    GridView1.DataSource = result;
    LVL 35

    Assisted Solution

    by:Miguel Oz
    Please answer:
    Can you post your web service code?
    What VS/SQL server version are you using?
    Note: I do not expect a timeout for such a tiny amount of data. How long does the query execute/ web service method?


    Author Comment

    I attached the code of a web service
    SQL server version is R2
    the method returns a single record

    Author Closing Comment

    I returned to the test and it worked, it is likely that the sql server service has been stopped. thanks

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    In previous Articles, we have discussed how we can upload a file using .asmx web service and isolated storage space. Here, in continuation to the topic, I am going to discuss how we can use WCF for the same purpose. Steps: 1.Create the silverli…
    Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now