Solved

how to call function in webservice in vb.net 2010

Posted on 2011-03-20
2
874 Views
Last Modified: 2012-05-11
i have included a website in this question. inside the default.aspx.vb is how i called the web service. is this the right way to do or do i have to declare both functions in the service.asmx instead of service.vb in app_code folder? if so how do i call them from asmx file? thank you

note when you run this file please change service.txt to service.asmx. i did that because experts exchange didn't let me upload asmx file. thank you
TemperatureWebService2.zip
0
Comment
Question by:StewSupport
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 36

Accepted Solution

by:
Miguel Oz earned 250 total points
ID: 35177810
check:
http://msdn.microsoft.com/en-us/library/8wbhsy70(v=vs.80).aspx (it has a complete example on temperature conversion)
http://www.w3schools.com/webservices/ws_example.asp

You are trying to call the web service in the same web site as your page. They must be in two separate sites. (First link section: "Adding the Web Service as a Component" shows detail steps on how to consume web service.
0
 
LVL 11

Assisted Solution

by:SAMIR BHOGAYTA
SAMIR BHOGAYTA earned 250 total points
ID: 35177939
Hi, following code is useful to you

Imports System.Web.Services
<System.Web.Services.WebService(Namespace:="http://tempuri.org/ConnectToDatabase/Connect")> _
Public Class Connect
Inherits System.Web.Services.WebService
Public cAdoConn As New ADODB.Connection
Public sConnectString As String
Public gsUserId As String
Public gsPassword As String
Public gsError As String
Dim spath As String
Public Function FunG_ConnectServer(ByVal gsDataSource As String)
sConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & gsDataSource
Try
If cAdoConn.State <> 1 Then
cAdoConn.CursorLocation = ADODB.CursorLocationEnum.adUseClient
cAdoConn.ConnectionTimeout = 30
cAdoConn.Open(sConnectString)
End If
Catch ex As Exception
End Try
End Function
End Class
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

623 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