Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Webservice error - please help

Reply
Thread Tools

Webservice error - please help

 
 
Jokke
Guest
Posts: n/a
 
      05-26-2010
Hi,

I try to set up a very simple webservice, to feed an AutoCompleteExtender a
list of locations (postal codes + places). In my test page, the textbox does
not do anything at all (no error either).
I have debugged the webservice, and it returns the dataset just fine.
What am I missing?

VS 2008, Ajax Toolkit for 3.5

TESTPAGE (= content page, the master page contains the ToolkitScriptManager
enclosed in form tags):

<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master"
AutoEventWireup="false" CodeFile="TestWebservice.aspx.vb"
Inherits="TestPages_TestWebservice" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="asp" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent"
Runat="Server">
<asp:TextBox ID="txtTestPostcode" runat="server"/>
<asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
TargetControlID="txtTestPostcode"
ServiceMethod="GetPostalCodes"
ServicePath="../WebServices/wsPostalCodes.asmx"
MinimumPrefixLength="2"
CompletionInterval="1000"
EnableCaching="true">
</asp:AutoCompleteExtender>
</asp:Content>

CODE IN "~/Webservices/wsPostalCodes.asmx:

<%@ WebService Language="VB" CodeBehind="~/App_Code/wsPostalCodes.vb"
Class="wsPostalCodes" %>

CODE IN "~/App_Code/wsPostalCodes.vb:

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
Imports System.Data.SqlClient

<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicPr ofile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.Des ignerGenerated()> _
Public Class wsPostalCodes
Inherits System.Web.Services.WebService

Private Function GetListofPlaces() As DataSet
Dim strConn As String =
System.Configuration.ConfigurationManager.Connecti onStrings("InoptecPlusConnectionString").Connectio nString
Dim strSQL As String = "SELECT BelLocation FROM vwPostalCodesBEL"
strSQL = "SELECT PostCode + N' ' + Location AS BelLocation FROM
PostcodesBEL"
Dim objConn As New SqlConnection(strConn)
Dim cmd As New SqlCommand(strSQL, objConn)
objConn.Open()
Dim da As New SqlDataAdapter()
da.SelectCommand = cmd
Dim ds As New DataSet()
da.Fill(ds)
objConn.Close()
'Return the DataSet
Return ds
End Function

<WebMethod()> _
Public Function GetPostalCodes() As DataSet
Return GetListofPlaces()
End Function
End Class

 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      05-26-2010
Hello,

AFAIK the service should return a list of strings, not a dataset... Also you
may want to double check the location
(ServicePath="~/WebServices/wsPostalCodes.asmx" against
ServicePath="../WebServices/wsPostalCodes.asmx" deepdning on where exactly
is your WebServices folder...)

If it still fails I would start with the simplest possible code (for example
a regular page and a web service that returns dummy data with the regular
ScriptManager).

--
Patrice



 
Reply With Quote
 
 
 
 
Mr. Arnold
Guest
Posts: n/a
 
      05-26-2010
Jokke wrote:
> Hi,
>
> I try to set up a very simple webservice, to feed an
> AutoCompleteExtender a list of locations (postal codes + places). In my
> test page, the textbox does not do anything at all (no error either).
> I have debugged the webservice, and it returns the dataset just fine.
> What am I missing?
>
> VS 2008, Ajax Toolkit for 3.5
>
> TESTPAGE (= content page, the master page contains the
> ToolkitScriptManager enclosed in form tags):
>
> <%@ Page Title="" Language="VB" MasterPageFile="~/Site.master"
> AutoEventWireup="false" CodeFile="TestWebservice.aspx.vb"
> Inherits="TestPages_TestWebservice" %>
> <%@ Register Assembly="AjaxControlToolkit"
> Namespace="AjaxControlToolkit" TagPrefix="asp" %>
>
> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent"
> Runat="Server">
> <asp:TextBox ID="txtTestPostcode" runat="server"/>
> <asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
> TargetControlID="txtTestPostcode"
> ServiceMethod="GetPostalCodes"
> ServicePath="../WebServices/wsPostalCodes.asmx"
> MinimumPrefixLength="2"
> CompletionInterval="1000"
> EnableCaching="true">
> </asp:AutoCompleteExtender>
> </asp:Content>
>
> CODE IN "~/Webservices/wsPostalCodes.asmx:
>
> <%@ WebService Language="VB" CodeBehind="~/App_Code/wsPostalCodes.vb"
> Class="wsPostalCodes" %>
>
> CODE IN "~/App_Code/wsPostalCodes.vb:
>
> Imports System.Web
> Imports System.Web.Services
> Imports System.Web.Services.Protocols
> Imports System.Data
> Imports System.Data.SqlClient
>
> <System.Web.Script.Services.ScriptService()> _
> <WebService(Namespace:="http://tempuri.org/")> _
> <WebServiceBinding(ConformsTo:=WsiProfiles.BasicPr ofile1_1)> _
> <Global.Microsoft.VisualBasic.CompilerServices.Des ignerGenerated()> _
> Public Class wsPostalCodes
> Inherits System.Web.Services.WebService
>
> Private Function GetListofPlaces() As DataSet
> Dim strConn As String =
> System.Configuration.ConfigurationManager.Connecti onStrings("InoptecPlusConnectionString").Connectio nString
>
> Dim strSQL As String = "SELECT BelLocation FROM vwPostalCodesBEL"
> strSQL = "SELECT PostCode + N' ' + Location AS BelLocation FROM
> PostcodesBEL"
> Dim objConn As New SqlConnection(strConn)
> Dim cmd As New SqlCommand(strSQL, objConn)
> objConn.Open()
> Dim da As New SqlDataAdapter()
> da.SelectCommand = cmd
> Dim ds As New DataSet()
> da.Fill(ds)
> objConn.Close()
> 'Return the DataSet
> Return ds
> End Function
>
> <WebMethod()> _
> Public Function GetPostalCodes() As DataSet
> Return GetListofPlaces()
> End Function
> End Class


Maybe, you need to be using a listview or grid (show multiple rows),
instead of a textbox.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error connection using webservice locally (3 webservice in balanci Roberto Giorgetti ASP .Net Web Services 0 06-13-2006 06:40 PM
Problem! webservice.htc calling nonsecure webservice from a secured ssl https webpage batista ASP .Net 1 01-26-2006 12:05 PM
HELP! HELP! PLEASE, PLEASE, PLEASE tpg comcntr Computer Support 11 02-15-2004 06:22 PM
Webservice calling a webservice.....Error Peter Nordström ASP .Net Web Services 0 10-21-2003 12:02 PM
please help... ...me learn C++ please please please :) KK C++ 2 10-14-2003 02:08 PM



Advertisments