Perspective and adjust your business and business systems (ⅱ:com+, ASP)

Source: Internet
Author: User
Tags exit dotnet error code functions goto iis soap wsdl

The stingy God 2001-10-11

The first step in the last three steps, the environment requires two machines, one for SQL Server, one for App and one for installing IIS. Simulates the current common Windows DNA structure and invokes the Biz component in ASP . VB client side i omitted, choose IE as the client side, the only thing to verify is that the architecture and components are OK just fine.

This article has nothing to do with dotnet , because there was no dotnet technology, and for more realistic simulations such as complex logic with transactional requirements, I decided to put SQL Server and components on two machines.

I use the Author table of the Pub database with SQL Server as the prototype. When I look at some of the original application code and components, I find that the whole code is generally divided into two categories: one is to complete a business and business logic operation, with the necessary parameters to the Biz component, theBiz component calls other Biz components or DB the component completes the various operations required, and then returns a simple data type back to the presentation layer. Like a string string (description of the error), a Long type (indicating a serial number, what number or error code, etc.); the other is a large amount of data returned after the query or some operation, so I'm glad I'm used to ADODB. Recordset to return these large amounts of data, so this class is very uniform and is generally ADODB. The return value of the Recordset type. In addition to having a very small number of variants , the type of structure you define is almost zero in the return value of the Biz layer.

for WebService , the data was unified into XML format, and I began to imagine these ADODB. what will the Recordset look like in XML ? How do clients use these XML -formatted ADO data? Almost the first response was to use the Microsoft soap Toolkit to solve the problem, so the WSDL file generated by the soap Toolkit was curious to know about the ADODB. What is the WSDL for the Recordset return value. In fact, the results of the test later are discouraging. However, the problem was exposed earlier, and that is, the question of how the data types that are customized or not SOAP -supported data are handled is currently focused on ADODB. Recorset on this data type. These issues also determine the db and Biz components to be generated.

DB Components no special,biz Components I decided to call these db components directly, without any logic, and in fact the biz could be very complex, calling many other biz or DB component, but often it ends up with only one result: success or failure, or returning a set of data, which is the two categories I have listed above. So I started using a similar update,delete feature:

Public Function Deleteauthor (ByVal au_id as String) as Long

To simulate the case of the first class that returns a single data type supported by SOAP , the actual application might be:

Public Function Changepaymenttype (Byval Ntypeid as Long, Byval Value as Integer) as long a business logic that modifies the user's method of payment.

With the Select feature

Public Function Getauthorsbyname (ByVal fName As String, ByVal LName as String) as ADODB. Recordset to simulate the return value of the second class return that is not the basic data type, the actual application might be

Public Function Getcustomerinfobyid (Byval Ncustomerid as Long) as ADODB. A Recordset a business logic that obtains customer information based on the customer ID .

I list the most of the two functions that are used later, especially when these two function names are heavily involved in the following:

Biz component:bus_authors.authors , compiled into DLL:bus_Authors.DLL

Public Function Version () as String

Version = "VB & SOAP ver 1.00"

Objctx.setcomplete

End Function

Public Function getauthors () as ADODB. Recordset

On Error GoTo ErrHandler

Dim obj as Object

Set obj = CreateObject (dbcomname)

Set getauthors = obj. GetAuthors ()

Objctx.setcomplete

Exit_err:

Exit Function

ErrHandler:

Set getauthors = Nothing

Objctx.setabort

Err.Raise Err.Number, Seterrsource (ModName, "GetAuthors"), Err.Description

Resume Exit_err

End Function

db components:db_authors.authors , compiled into DLL:db_Authors.DLL

Public Function getauthors () as ADODB. Recordset

On Error GoTo HandleError

Dim Rst as ADODB. Recordset

Dim strSQL as String

Set Rst = Newclientrstonlyread (5)

strSQL = "SELECT * FROM Authors"

Rst.open strSQL, Strconstruct, adOpenStatic, adLockReadOnly, adCmdText

If not Isrstempty (Rst) Then

Set getauthors = Rst

Else

Set getauthors = Nothing

End If

Objctx.setcomplete

Handleexit:

Exit Function

HandleError:

Objctx.setabort

Set getauthors = Nothing

Err.Raise Err.Number, Seterrsource (ModName, "GetAuthors"), Err.Description

Resume Handleexit

End Function

Version () and getauthors () are used to simulate the two types of return values of the appeal, and the remainder includes the following function:

Public Function Echo (ByVal Secho As String) as String

Public Function Getauthorsbyname (ByVal fName As String, ByVal LName as String) as ADODB. Recordset

Public Function Deleteauthor (ByVal au_id as String) as Long

Public Function updateauthorbyaddress (ByVal au_id As String, ByVal saddress as String) as Long

The difference is that the parameters are added, and the version and getauthors return values above are not different so I'll just talk about version and GetAuthors later. The two functions are only slightly different from the rest of the implementations.

windows com + , I built a lucida >authors" . Then use the component Services authors application use export ... function to pour out a server application and application proxy installation package, we will use them later. Figure:

Then set up IIS, create a virtual directory Authors write a simple ASP page call bus_authros.authors component Version and getauthors method produces an Html output (VB and ASP 's client's test code I have omitted ). Ensure Http://localhost/Authors/TestAuthors.asp or

Http://henrysvr/Authors/TestAuthors.asp The call normally produces page output in IE .

!--? xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml"/--> < /v:path>

testauthors.asp Physical directory I suppose: inC:\Inetpub\wwwroot\Authors , this directory will also cover and store our WSDL in the following chapters and other documents.

If all of the above is OK then basically completes the first step, with a simple example of Windows DNA Architecture so that the following steps can begin, the current architecture may look like this:

In addition, the firewall will not be considered in the inside, I did not simulate it. In practical application, the firewall is a factor that needs to be considered concretely.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.