Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Implementing web service issue

Implementing web service issue

Scheduled Pinned Locked Moved Web Development
csharpwcfhelpquestion
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rock Star
    wrote on last edited by
    #1

    Hi, I build a web service in .Net. After adding this web service as a web reference in my website and when I am trying to use the methods in a web services by creating the object of it, I am getting only two methods which are equals and reference equals anyone knows why I am facing this issue?

    Rock Star

    D 1 Reply Last reply
    0
    • R Rock Star

      Hi, I build a web service in .Net. After adding this web service as a web reference in my website and when I am trying to use the methods in a web services by creating the object of it, I am getting only two methods which are equals and reference equals anyone knows why I am facing this issue?

      Rock Star

      D Offline
      D Offline
      DJ Matthews
      wrote on last edited by
      #2

      Well, some code snippets would be nice. It would help us help you :) One possibility without seeing your code is that your web service methods are missing the "WebMethod" attribute: VB.NET

      <WebMethod()> \_
      Public Function HelloWorld() As String
          Return "Hello World"
      End Function
      

      C#

      \[WebMethod()\]
      public string HelloWorld()
      {  
          return "Hello World";
      }
      
      R 1 Reply Last reply
      0
      • D DJ Matthews

        Well, some code snippets would be nice. It would help us help you :) One possibility without seeing your code is that your web service methods are missing the "WebMethod" attribute: VB.NET

        <WebMethod()> \_
        Public Function HelloWorld() As String
            Return "Hello World"
        End Function
        

        C#

        \[WebMethod()\]
        public string HelloWorld()
        {  
            return "Hello World";
        }
        
        R Offline
        R Offline
        Rock Star
        wrote on last edited by
        #3

        public class Service1 : System.Web.Services.WebService
        {
        public DataSet UserDataset = new DataSet();
        public SqlDataAdapter UserAdapter = new SqlDataAdapter("Select Query",new SqlConnection("connection string"));

            \[WebMethod\]
            public string HelloWorld()
            {
                return "Hello World";
            }
        
            \[WebMethod\]
            public DataSet GetUserData()
            {
                UserAdapter.Fill(UserDataset);
                return UserDataset;
            }
        
            \[WebMethod\]
            public DataSet UpdateUserData(DataSet ds)
            {
                if(ds != null)
                {
                    UserAdapter.Update(ds);
                    return ds;
                }
                else
                {
                    return null;
                }
            }
        
            private void InitializeComponent()
            {
                this.UserDataset = new System.Data.DataSet();
                ((System.ComponentModel.ISupportInitialize)(this.UserDataset)).BeginInit();
                // 
                // UserDataset
                // 
                this.UserDataset.DataSetName = "NewDataSet";
                ((System.ComponentModel.ISupportInitialize)(this.UserDataset)).EndInit();
        
            }
        }
        

        This is the source code but when I am trying to access any of this method by making an object of Service1 class I am getting only two function in intellisense that are Equals() and ReferenceEquals(). any idea why am I getting this issue?

        Rock Star

        D 1 Reply Last reply
        0
        • R Rock Star

          public class Service1 : System.Web.Services.WebService
          {
          public DataSet UserDataset = new DataSet();
          public SqlDataAdapter UserAdapter = new SqlDataAdapter("Select Query",new SqlConnection("connection string"));

              \[WebMethod\]
              public string HelloWorld()
              {
                  return "Hello World";
              }
          
              \[WebMethod\]
              public DataSet GetUserData()
              {
                  UserAdapter.Fill(UserDataset);
                  return UserDataset;
              }
          
              \[WebMethod\]
              public DataSet UpdateUserData(DataSet ds)
              {
                  if(ds != null)
                  {
                      UserAdapter.Update(ds);
                      return ds;
                  }
                  else
                  {
                      return null;
                  }
              }
          
              private void InitializeComponent()
              {
                  this.UserDataset = new System.Data.DataSet();
                  ((System.ComponentModel.ISupportInitialize)(this.UserDataset)).BeginInit();
                  // 
                  // UserDataset
                  // 
                  this.UserDataset.DataSetName = "NewDataSet";
                  ((System.ComponentModel.ISupportInitialize)(this.UserDataset)).EndInit();
          
              }
          }
          

          This is the source code but when I am trying to access any of this method by making an object of Service1 class I am getting only two function in intellisense that are Equals() and ReferenceEquals(). any idea why am I getting this issue?

          Rock Star

          D Offline
          D Offline
          DJ Matthews
          wrote on last edited by
          #4

          Can I see the code you are using to call this web service?

          R 1 Reply Last reply
          0
          • D DJ Matthews

            Can I see the code you are using to call this web service?

            R Offline
            R Offline
            Rock Star
            wrote on last edited by
            #5

            Hi, I am trying to call this web service in window application I am assigning generated dataset in web service to one of my dataset in windows application. The code is as follows

            using System;
            using System.Collections.Generic;
            using System.ComponentModel;
            using System.Data;
            using System.Drawing;
            using System.Linq;
            using System.Text;
            using System.Windows.Forms;
            using System.Web.Services;
            using System.Configuration.Assemblies;
            using System.Xml;

            namespace UserWindow
            {
            public partial class UserWindow : Form
            {
            public UserWindow()
            {
            InitializeComponent();
            }

                private void LoadData\_Click(object sender, EventArgs e)
                {
                    DataSet ds = new DataSet();
                    ds = UserWebService1.Service1.(Here I am getting Reference, GenerateXMLMappings and EqualReference methods)
                }
            }
            

            }

            Rock Star

            D 1 Reply Last reply
            0
            • R Rock Star

              Hi, I am trying to call this web service in window application I am assigning generated dataset in web service to one of my dataset in windows application. The code is as follows

              using System;
              using System.Collections.Generic;
              using System.ComponentModel;
              using System.Data;
              using System.Drawing;
              using System.Linq;
              using System.Text;
              using System.Windows.Forms;
              using System.Web.Services;
              using System.Configuration.Assemblies;
              using System.Xml;

              namespace UserWindow
              {
              public partial class UserWindow : Form
              {
              public UserWindow()
              {
              InitializeComponent();
              }

                  private void LoadData\_Click(object sender, EventArgs e)
                  {
                      DataSet ds = new DataSet();
                      ds = UserWebService1.Service1.(Here I am getting Reference, GenerateXMLMappings and EqualReference methods)
                  }
              }
              

              }

              Rock Star

              D Offline
              D Offline
              DJ Matthews
              wrote on last edited by
              #6

              Try this:

              private void LoadData\_Click(object sender, EventArgs e)
              {
                  DataSet ds = new DataSet();
                  UserWebService1.Service1 WebSrvc = new UserWebService1.Service1();
                  ds = WebSrvc.YouFunctionHere;
              }
              
              R 1 Reply Last reply
              0
              • D DJ Matthews

                Try this:

                private void LoadData\_Click(object sender, EventArgs e)
                {
                    DataSet ds = new DataSet();
                    UserWebService1.Service1 WebSrvc = new UserWebService1.Service1();
                    ds = WebSrvc.YouFunctionHere;
                }
                
                R Offline
                R Offline
                Rock Star
                wrote on last edited by
                #7

                Thanx Its working now but what was the fault in previous code when I am trying to call methods directly.

                Rock Star

                M 1 Reply Last reply
                0
                • R Rock Star

                  Thanx Its working now but what was the fault in previous code when I am trying to call methods directly.

                  Rock Star

                  M Offline
                  M Offline
                  marita72
                  wrote on last edited by
                  #8

                  You must always unless create an instance of the class before you can use it. UNLESS it's a static object.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups