Forum Moderators: open

Message Too Old, No Replies

Need help with 3-tier app using XML web extensions

         

vnarod

3:15 pm on Jul 11, 2002 (gmt 0)

10+ Year Member



I need to do a simple thing: 3-tier app using XML web extensions.

Web Server should get data from database and send it to a client. I never did it before and I am stuck. On-line help doesn't make it easier.

I created a Web Service with methods such as
<WebMethod> Public Function GetData(ByVal sSQL As String) As DataSet
Dim oCmd As SqlCommand = New SqlCommand(sSQL, cn)
Dim da As SqlDataAdapter = New SqlDataAdapter(oCmd)
Dim ds As New DataSet()
Try
da.Fill(ds)
Return ds
Catch e As SqlException
MsgBox(e.Message)
cn.Close()
End Try
End Function

My questions:

1. (MOST IMPORTANT) The problem I am having with adding webreference right now is that while I use "localhost" reference is added, but when I copy files to another webserver and use that server's name, instead of reference I get Open/Save Target/Cancel dialog box. It sees the file but as something to download not as reference.
Why is that?

2. I tried Datareaders I got an error message saying that DataReader cannot be serialized so I cannot use them. Is there a way around it?

3. Does this webreference mean that in the event my server program will be moved to another server I will need to change client program and recompile it? Is there a way to specify server name in INI or registry?

4. I keep reading about SOAP in connection with all this. Do I need to do anything with it?

Please, help

Xoc

12:06 am on Aug 16, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



1. The reason why is that it is returning a DataSet serialized as XML. A Dataset is not HTML, so what it wants to do is save it to a file. To properly use a DataSet, you will need something that receives the data that understands the SOAP protocol. This can be a .NET Windows Application, a .NET Web
Application, or something like a Visual Basic program using the SOAP toolkit, or anything else that can deal with SOAP (which is XML sent over HTTP).

If you just want to test to see what the return XML looks like, try using view-source:http://url in the command line of IE or netscape.

2. A DataReader is an object that gets the data. It isn't the data itself. So you can't pass the DataReader iself, but must pass the data that the DataReader gets. This is done by filling in a DataSet and passing the DataSet. So you can use a DataReader instead of a DataAdapter in your example, but you still need to fill the DataSet.

3. You can certainly store the info somewhere, such as a constant declaration in the global.asax. Realize though, that on an ASP.NET application, any time that you change a page, it will automatically recompile the web site on the next request to a page. So you don't need to explicitly recompile the web site to get the change to propagate.

4. SOAP is going on behind the scenes. If you use .NET on both sides of the transaction, you don't really have to understand how it works.

vnarod

1:30 pm on Aug 16, 2002 (gmt 0)

10+ Year Member



Thank you for your reply.
1. I understood why it happens but did not quite understand what I need to do. Both server and client are VB.NET applications. How do I add Web Reference to a client in this case?

3. Web reference to CLIENT is added at design time. If my server address changes how can I change the reference in client (local workstation) without recompiling it?