Perspective and Adjust your business and business system (IV: WebService, DOTNET)
Small gas god 2001-10-15
By the other hand, we have completed the second step in the three processes mentioned in the first article (Analyzing, Requirement). This article begins we can use the DOTNET's WebService method to reconsider the previous Authors WebService. It is advisable to advise the MS, which is preferred when implementing and designing Web Services as the first choice. So this article we will mainly visit the ASP.NET WebService.
It is necessary to start from the second analysis. After I generated WebService with SOAP Toolkit, I use VS.NET's Add Web Reference ... Enter http://henrysvr/authors/authors.wsdl , Vs.net is also a WebService, but because of adoDb.recordset, it could not generate the Proxy class. At that time, I thought that WSDL generated by SOAP Toolkit is not fully compatible with soon, I will give up the experiment. After a few days later, I did another try: I re-generated the WSDL file for WebService with SOAP Toolkit. I didn't put the function of returning AdoDDB.Recordset, which is all in the second. Sign type, then I repeated the above steps in vs.net, this time OK, VS.NET successfully generated the Proxy class, I generated a small example test, the result is success. Then conclusion is: For the second class returns a special type (that is, the type of CTM in the second article) We must handle it, for the first type, we use the MS SOAP Toolkit to generate a WSDL file, then set it in IIS. Ok, you can be a WebService, we don't have to deal with it on this Webserve. Not only can VS.NET can be used directly, and other supporting WebService specification can also be used (can only be estimated. Java? Delphi? Sorry, I have not tried) The following is the copy map of the success of the success, it feels good, even Chinese No special treatment is used.
Private sub Button2_click (byvalgend, byval e as system.eventargs) Handles Button2.click
Dim Obj As Henrysvr.authors
DIM RETSTRING AS STRING
Dim Sendstr As String
Sendstr = echotxt.text
Obj = new henrysvr.authors ()
Retstring = obj.echo (sendstr)
Messagebox.show (retstring)
End Sub
Ok, the rest is the problem with adoDb.recordset, if this COM object is handled? We had already used a method, DOTNET as a client, this time I changed a way, generate an ASP.NET method WebService, then reference the bus_authors component, and make a function that returns a recordset in this Webservice. Package. such as:
DIM OBJ AS bus_authors.authors
Obj = new bus_authors.authors () Version = Obj.Version
END FUNCTION
DIM OBJ AS bus_authors.authors
DIM RST As Adodb.Recordset
Dim mydataadapter as oledb.oledbdataadapter
Dim RetdataSet As DataSet
Obj = new bus_authors.authors ()
RST = new adodb.recordset ()
MyDataAdapter = new oledb.oledbdataadapter ()
RetDataSet = new dataset ()
RST = Obj.GetAuthors ()
MyDataAdapter.Fill (RetDataSet, RST, "GetAuthors")
GetAuthors = RetDataSet
END FUNCTION
It is a simple call to the BIZ component, then convert the adoDb.recordset to DataSet.
With reference to Bus_authors, you can install our server or proxy on the current EXPORT, I can use the Server package directly for convenience. The remaining is very simple, you need to generate a test program, this is simple, referring to the video of Carl Franklin. It is also practicing HAHA.
(See http://www.9cbs.net/develop/read_article.asp?id=10816)
Below is the running code and diagram:
Private Sub Page_Load (Byvale AS System.Object, Byval E AS System.Eventargs) Handles MyBase.Load
'Put User Code to Initialize The Page Here
DIM RS AS Dataset
Dim obj as new localhost.authors ()
RS = Obj.GetAuthors ()
DataGrid1.datasource = rs
DataGrid1.databind ()
End Sub
As for the VB version of the client, you can test with the following code on another machine:
DIM RETXML AS Object
Dim SoapClient as mssoaplib.soapclient
SET SOAPCLIENT = New MSSOAPLIB.SOAPClient
Call SoapClient.msoapinit ("http://dereksvr/authors/authors.asmx? WSDL")
Set retXML = soapclient.getauthors ()
If the successful return should be an ixmldomnodelist, including the entire DataSet structure and 23 data, as for the specific display of the VB program for this result set, it will not be said to have a special article to discuss how to convert DOTNET to VB can be Identification issues, such as FillListView (LSTV AS Control, Obj As Object), which pops this XML structure into the VB6 ListView or Grid control, I will not tell us here. You can also use http://dereksvrr/authors/authors.asmx on other machines and select GetAuthors and click Call Get results, you can also click directly: http://dereksvr/authors/authors.asmx/getauthors? You On the IE window, you can see the XML document of this return result (from it you can see the most original constructor of Dataset). Master the principles of different return types, whether it is MS SOAP Toolkit or ASP.NET WebService can be used by us. It seems that using DOTNET will be simple and effortless. I want to advancing DOTNET technology, more and more people will consider implementing some new business or enterprise application systems with DOTNET technology, at least I will. Perhaps these examples want to explain that from the current Windows DNA architecture to the new DOTNET architecture, it can be controlled by you. It is not like some people who think that only VS.NET recompiles the original application, it is not like other people, it is considered to be the market's strategy, and it is very difficult to implement it. Almost 3-5 years.
especially:
The above text and pictures involve other people's privacy and personal rights, such as non-authorized or agree, please do not publish, reprint, adapt, repost, or other forms of communication. All of the above texts and images are only used for internal communication, and do not make any news publishers and commercial purposes.