web service consumer

Posted on 2011-10-25
Medium Priority
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>cathan0@adventure-works.com</EmailAddress> </Table> </NewDataSet>

or view attached

can help me create a web application to consume?
Question by:enrique_aeo
  • 3
  • 2
LVL 36

Accepted Solution

Miguel Oz earned 2000 total points
ID: 37029017
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

ID: 37035986
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 36

Assisted Solution

by:Miguel Oz
Miguel Oz earned 2000 total points
ID: 37036160
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

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

Author Closing Comment

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

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
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…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

862 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