Solved

how to call function in webservice in vb.net 2010

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 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