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
Solved

how to call function in webservice in vb.net 2010

Posted on 2011-03-20
2
871 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 35

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

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

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…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

808 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