Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple WEB service

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I am trying to make a sample in a book work
Code:
Imports System.Web.Services

<System.Web.Services.WebService( _
    Description:="Document Retreval", _
    Namespace:="[URL unfurl="true"]http://tempuri.org/DocumentWEBServ")>[/URL] _
Public Class ReturnDocInfo
    Inherits System.Web.Services.WebService


    <WebMethod(Description:="Returns Documents")> _
    Public Function GetDoc(ByVal Doc_ID As String) As String
        daDocuments.SelectCommand.Parameters("@Docid").Value = Doc_ID
        daDocuments.Fill(DsDocuments1)
        If DsDocuments1.Document.Count > 0 Then
            Return CStr(DsDocuments1.Document(0).Item("DOC_Cust_ID"))
        Else
            Return "Can't Find It !!!!"
        End If
    End Function
this is the SQL statement in the Data Adapater
SELECT DOC_ID, DOC_Cust_ID, DOC_Doc_Type, DOC_DIC_ID, DOC_Status_Date
FROM dbo.Document
WHERE (DOC_ID = @DOCID)

I get this error when testing:

The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed.
If I rem out all these lines
daDocuments.SelectCommand.Parameters("@Docid").Value = Doc_ID
'daDocuments.Fill(DsDocuments1)
'If DsDocuments1.Document.Count > 0 Then
'Return CStr(DsDocuments1.Document(0).Item("DOC_Cust_ID"))
'Else
'Return "Can't Find It !!!!"
'End If
to just have this
return "12345"

it works OK

My datasource is on another server
I can view the data in the Server Explorer just fine

TIA




DougP, MCP, A+
 
Can you view the webservice in debug mode? I.e running it from the visual studio interface or typing in the url of the webservice?

AGIMA - professional web hosting is our business.

AGIMA Computing
 
yes
I get this

The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed.

DougP, MCP, A+
 
I am adding a Try Catch to help with my troubleshooting

Try

Return msg

Catch ex As Exception
Return (ex.ToString)
End Try

I also noticed I did not have any RETURN statement in my function.

Duh !!!!

DougP, MCP, A+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top