Summary of XML related technical information

怪我咯
Release: 2017-04-05 17:44:26
Original
1408 people have browsed it

xmlHTTPTechnology:
--------------------------- --------------------------
1. Database remote management technology

Modern Internet-based wide area network An important part of the application is database remote monitoring. First, let’s briefly review the development process and methods of database remote management technology on the Internet:

In the early days, database remote management was carried out by writing CGI-BIN program modules. However, CGI-BIN runs slowly and is inconvenient to maintain. It has been basically abandoned now.

In recent years, there are many applications using componentObjectModel(Component Object Model, COM), and the effect is Very good too. But if a third-party server is used (the author's website is built on a third-party virtual host), the server often does not allow users to register their own components due to confidentiality or other commercial reasons. In recent years, the .NET platform launched by Microsoft and the J2EE platform of SUN are both very high-end database remote management and service platforms. Both can provide high-quality multi-tier (n-Tier) application services.
Among them, .NET's Simple Object Access Protocol (SOAP) uses Hypertext Transfer Protocol (HTTP) and Extensible Markup Language (XML) technologies to implement cross-system (such as Windows) - Linux) communication service method has been widely accepted and used by developers. Many large-scale applications, such as Enterprise Resource Planning (ERP), are built on such large-scale platforms.
But for small and medium-sized applications, such as the construction and maintenance of a website, this large-scale application platform seems a bit too big and the overhead is too huge.

Microsoft, which once lagged behind in Internet technology and Java technology, is leading the way in XML application development. The XMLHTTP protocol in her XML parser (MSXML) is a very convenient and practical client/service communication channel. The comprehensive use of XMLHTTP and ActiveX Data Objects (ActiveX Data Objects, ADO/ADOX) can easily and conveniently achieve remote database management.

This article introduces how to comprehensively use XMLHTTP and ADO/ADOX for remote database management.

2. Database remote management system

The task process of database remote management is:
1. The client sends a
query of database structure and data to the server
or Modify instructions. 2. The server accepts and executes relevant instructions and returns the results to the client. 3. The client accepts and displays the instruction execution results returned by the server.

The two main key links to realize remote database management are:
1. The data channel for uploading instructions and downloading results between the client and the server is implemented by the XMLHTTP protocol.
2. The instruction transmission and result return between the server front and the database are completed by the ADO/ADOX interface, which plays the role of the middle layer.
3. The use of XMLHTTP

As the name suggests, XMLHTTP is a hypertext transfer protocol that transmits data in XML format.

In fact, the data transmission process of XMLHTTP is more flexible:
The instructions it uploads can be XML format data, or
strings
, streams, or an unsigned Array of integers. It can also be a URL parameter. The result it delivers can be XML format data, a string, a stream, or an unsigned integer array. For details, please refer to the link at the end of the article.

The process for the client to call XMLHTTP is very simple. There are only 5 steps:
1.
Create XMLHTTP object
2. Open the connection with the server and define the instruction sending method. , service web pages (URL) and request permissions, etc. The client opens the connection with the server's service webpage through the Open command. Just like ordinary HTTP command transmission, you can use the "GET" method or the "POST" method to point to the service web page of the server.
3. Send instructions.
4. Wait for and receive the processing results returned by the server.
5. Release the XMLHTTP object

XMLHTTP method:
Open bstrMethod, bstrUrl, varAsync, bstrUser, bstrPassword
bstrMethod: Data transmission method, that is, GET or POST.
bstrUrl: URL of the service web page.
varAsync: Whether to execute synchronously. The default is True, which means synchronous execution, but synchronous execution can only be implemented in the DOM.
In applications, it is generally set to False, which means asynchronous execution.
bstrUser: User name, can be omitted.
bstrPassword: User password, can be omitted.

Send varBody
varBody: instruction set. It can be XML format data, a string, a stream, or an unsigned integer array. It can also be omitted and the directive is substituted through the URL parameters of the Open method.

setRequestHeader bstrHeader, bstrValue
bstrHeader: HTTP header (header)
bstrValue: HTTP header (header) value
If the Open method is defined as POST, you can define a form to upload:
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

XMLHTTPAttributes:
onreadystatechange: Obtain the return result in synchronous execution mode EventHandle. Can only be called in the DOM.
responseBody: The result is returned as an unsigned integer array.
responseStream: The result is returned as an IStream stream.
responseText: The result is returned as a string.
responseXML: The result is returned as XML format data.


The following is an application example in the source program attached to this article:
Function GetResult(urlStr)
Dim xmlHttp
Dim retStr

Set xmlHttp = CreateObject( "Msxml2.XMLHTTP") 'Create object
On Error Resume Next 'Error handling
xmlHttp.Open "POST", urlStr, False 'Open the connection in POST mode and execute it asynchronously.
xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 'Upload form
xmlHttp.Send 'Send command

If Err.Number = 0 Then 'If Correct connection
retStr = xmlHttp.responseText 'Wait for and obtain the result string returned by the server
Else
retStr = "Url not found" 'Otherwise return an error message
End If
Set xmlHttp = Nothing 'Release Object
Getresult = Retstr' back result
END FUNCTION
## stetresult () function brought the URL parameter of the service webpage, and the uploaded instructions were placed on the parameters behind the URL. For example:
urlStr = "server.asp?cmd=" & cmd & "&db=" & db & "table=" & table
cmd: execution method, such as query, modification, deletion, etc.
db: server database name
table: server table name

Then submit the command, wait for and receive the returned processing results. The result is returned as a string.

Finally, the function caller processes and displays the result.


The above is the detailed content of Summary of XML related technical information. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template