Click to See Complete Forum and Search --> : web service reference


gabrielgv
09-11-2006, 04:34 PM
Hi:

I have programmed a web service Called "Cobranza.asmx" that I store on a remote server and it works on the browser.
I have also created the consumer class with wsdl.exe and vbc.exe (Cobranza.dll) that is on the local server in the bin folder of my asp.net.

When I try to run the asp.net that calls the web service I get an error

Compiler Error Message: BC30002: Type 'Cobranza' is not defined.

This is the code of "Cobranza.asmx"

<%@ WebService Language="VB" Class="Cobranza"%>
Imports System.Web.Services
<WebService(Namespace:="DigitalSnd.ServiciosWeb")> _
Public Class Cobranza
<WebMethod()> Public Function Hola(Palabra as String) as String
Hola=Palabra & Palabra
End Function
End Class

This is the code of my asp.net

<%@ Page Language="VB"%>
<script runat="server">
Public Sub Page_Load(sender As [Object], E As EventArgs)
Dim laCobranza As new Cobranza() '''this is the line where I get the error
End Sub 'Page_Load

</script>

<html>
<head>
<title>Documento sin t&iacute;tulo</title>
</head>
<body>
</body>
</html>

How Can I add a reference to "Cobranza.dll" or "DigitalSnd.ServiciosWeb" ?

I tried this at the first of my asp.net

<%@ Import Namespace = "DigitalSnd.ServiciosWeb" %>

but did not work

What I need to do?


Thanks!!

sirpelidor
09-11-2006, 04:45 PM
on your vs.net's Solution Explorer, right click "References", click "Add Web References..." locate your reference (open Cobranza.asmx in browser then copy and paste )

now u should be able to create your object.

gabrielgv
09-11-2006, 05:14 PM
How can I do this by code?

I wrote my asp.net in notepad.

Thanks!

sirpelidor
09-11-2006, 09:37 PM
take a look at this link. (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfp2k2/html/odc_fpwsvc.asp)

Pay attention to the following command line as it will generate web references for you:


wsdl /l:VB /o:c:\8ball\8ball.vb http://www.yourURLwebreference.asmx


If I may suggest, u should consider writing .net code with IDE such as vs.net. Not only it saves time, but also reduce typing errors. If you have to stick with notepad, you may want to consider other technology such as J2EE. I personally think codes in j2ee is very clean to read (especially when it comes with web services)