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. ASP.NET
  4. web service query

web service query

Scheduled Pinned Locked Moved ASP.NET
databasetutorial
6 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.
  • M Offline
    M Offline
    mylogics
    wrote on last edited by
    #1

    hii am using web service in my application.i added web refrence.now i am trying to use it in my code.actually it is temperature conversion web service. the code is:

    Protected Sub ConvertButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ConvertButton1.Click
    Dim wsConvert As localhost.Convert()
    Dim temperature As Double = System.Convert.ToDouble(TemperatureTextBox.Text)
    FarenhiteLabel.Text = wsConvert.FahrenheitToCelsius(temperature).ToString()
    End Sub

    but i am not getting the function FahrenheitToCelsius() plz guide me where am i wrong...

    S B 2 Replies Last reply
    0
    • M mylogics

      hii am using web service in my application.i added web refrence.now i am trying to use it in my code.actually it is temperature conversion web service. the code is:

      Protected Sub ConvertButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ConvertButton1.Click
      Dim wsConvert As localhost.Convert()
      Dim temperature As Double = System.Convert.ToDouble(TemperatureTextBox.Text)
      FarenhiteLabel.Text = wsConvert.FahrenheitToCelsius(temperature).ToString()
      End Sub

      but i am not getting the function FahrenheitToCelsius() plz guide me where am i wrong...

      S Offline
      S Offline
      sashidhar
      wrote on last edited by
      #2

      did you declare webmethod in webservice on the top of method..! If yes Show your Webservice method full in code block..!

      LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

      1 Reply Last reply
      0
      • M mylogics

        hii am using web service in my application.i added web refrence.now i am trying to use it in my code.actually it is temperature conversion web service. the code is:

        Protected Sub ConvertButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ConvertButton1.Click
        Dim wsConvert As localhost.Convert()
        Dim temperature As Double = System.Convert.ToDouble(TemperatureTextBox.Text)
        FarenhiteLabel.Text = wsConvert.FahrenheitToCelsius(temperature).ToString()
        End Sub

        but i am not getting the function FahrenheitToCelsius() plz guide me where am i wrong...

        B Offline
        B Offline
        Brij
        wrote on last edited by
        #3

        It'll be better if you post webservice code.

        Cheers!! Brij

        M 1 Reply Last reply
        0
        • B Brij

          It'll be better if you post webservice code.

          Cheers!! Brij

          M Offline
          M Offline
          mylogics
          wrote on last edited by
          #4

          web service code:

          Imports System.Web
          Imports System.Web.Services
          Imports System.Web.Services.Protocols

          <WebService(Namespace:="http://tempuri.org/")> _
          <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
          <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
          Public Class Convert
          Inherits System.Web.Services.WebService

          <System.Web.Services.WebMethod()> \_
          

          Public Function FahrenheitToCelsius(ByVal Fahrenheit As Double) _
          As Double
          Return ((Fahrenheit - 32) * 5) / 9
          End Function

          <System.Web.Services.WebMethod()> \_
              Public Function CelsiusToFahrenheit(ByVal Celsius As Double) \_
                  As Double
              Return ((Celsius \* 9) / 5) + 32
          End Function
          

          End Class

          implementation code:

          Partial Class Default4
          Inherits System.Web.UI.Page

          Protected Sub ConvertButton1\_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ConvertButton1.Click
              Dim wsConvert As localhost.Convert()
              Dim temperature As Double = System.Convert.ToDouble(TemperatureTextBox.Text)
              FarenhiteLabel.Text = wsConvert.FahrenheitToCelsius(temperature).ToString()
          
              'wsConvert.FahrenheitToCelsius(temperature).ToString()
              '    CelciusLabel.Text = "Celsius To Fahrenheit = " & \_
              '        wsConvert.CelsiusToFahrenheit(temperature).ToString()
          
          End Sub
          

          End Class

          M 1 Reply Last reply
          0
          • M mylogics

            web service code:

            Imports System.Web
            Imports System.Web.Services
            Imports System.Web.Services.Protocols

            <WebService(Namespace:="http://tempuri.org/")> _
            <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
            <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
            Public Class Convert
            Inherits System.Web.Services.WebService

            <System.Web.Services.WebMethod()> \_
            

            Public Function FahrenheitToCelsius(ByVal Fahrenheit As Double) _
            As Double
            Return ((Fahrenheit - 32) * 5) / 9
            End Function

            <System.Web.Services.WebMethod()> \_
                Public Function CelsiusToFahrenheit(ByVal Celsius As Double) \_
                    As Double
                Return ((Celsius \* 9) / 5) + 32
            End Function
            

            End Class

            implementation code:

            Partial Class Default4
            Inherits System.Web.UI.Page

            Protected Sub ConvertButton1\_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ConvertButton1.Click
                Dim wsConvert As localhost.Convert()
                Dim temperature As Double = System.Convert.ToDouble(TemperatureTextBox.Text)
                FarenhiteLabel.Text = wsConvert.FahrenheitToCelsius(temperature).ToString()
            
                'wsConvert.FahrenheitToCelsius(temperature).ToString()
                '    CelciusLabel.Text = "Celsius To Fahrenheit = " & \_
                '        wsConvert.CelsiusToFahrenheit(temperature).ToString()
            
            End Sub
            

            End Class

            M Offline
            M Offline
            mylogics
            wrote on last edited by
            #5

            i got the solution... jst changed the code line as:

            Dim wsConvert As localhost.Convert()

            to

            Dim wsConvert As localhost.Convert = New localhost.Convert()

            nyway thanks.....

            B 1 Reply Last reply
            0
            • M mylogics

              i got the solution... jst changed the code line as:

              Dim wsConvert As localhost.Convert()

              to

              Dim wsConvert As localhost.Convert = New localhost.Convert()

              nyway thanks.....

              B Offline
              B Offline
              Brij
              wrote on last edited by
              #6

              good njoy :)

              Cheers!! Brij

              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