Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how to call function in webservice in vb.net 2010

Posted on 2011-03-20
2
Medium Priority
?
877 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
2 Comments
 
LVL 36

Accepted Solution

by:
Miguel Oz earned 1000 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 1000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Loops Section Overview
Suggested Courses

885 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