CXF study notes

CXF
Apache CXF = Celtix + XFire, originally called Apache CeltiXfire, and later changed its name to Apache CXF, hereinafter referred to as CXF. CXF inherits the

essence of Celtix and XFire two open source projects, provides comprehensive support for JAX-WS, and provides a variety of Binding, DataBinding, Transport and

various Format support, and can use code according to the needs of actual projects First (Code First) or WSDL first (WSDL First) to easily achieve Web

Services publishing and consumption. Apache CXF is already an official Apache top-level project.
Use Frontend programming API to build and develop Services, like JAX-WS. These Services can support a variety of protocols, such as: SOAP, XML/HTTP,

RESTful HTTP or CORBA, and can run on a variety of transport protocols



JAX-WS
JAX-WS (Java API for XML Web Services) specification is a set of XML web services JAVA API for services, JAX-WS allows developers to choose RPC

-oriented or message-oriented to implement their own web services.
In JAX-WS, a remote call can be converted to an XML-based protocol such as SOAP. In the process of using JAX-WS, the developer does not need to write any

code . The runtime implementation of JAX-WS translates these API calls into corresponding SOAP messages.
On the server side, the user only needs to define the interface SEI (service endpoint interface) that needs to be implemented for remote invocation through Java language, and provide the relevant implementation,

which can be published as a WebService interface by calling the service publishing interface of JAX-WS.
On the client side, the user can create a proxy (replacing remote services with local objects) through the JAX-WS API to implement calls to the remote server side.
Of course, JAX-WS also provides a set of API calls that operate on the underlying messages. You can directly use SOAP messages or XML messages to send requests through Dispatch, or use

Provider to process SOAP or XML messages.
Through the interoperability environment provided by web service, we can use JAX-WS to easily realize the interoperability between the JAVA platform and other programming environments (.net, etc.).
The relationship between JAX-WS and JAX-RPC
Sun's original implementation of web services was JAX-RPC 1.1 (JSR 101). This implementation is based on Java RPC, does not fully support the schema specification, and does not

define standard implementations for Binding and Parsing.
JAX-WS2.0 (JSR 224) is Sun's new web services protocol stack and is a completely standards-based implementation. At the binding layer, the Java

Architecture for XML Binding (JAXB, JSR 222) is used, and at the parsing layer, the Streaming API for XML (StAX, JSR

173) is used, and it also fully supports the schema specification.

RPC
Excerpted from https://www.zhihu.com/question/25536695
what: RPC (Remote Procedure Call Protocol) refers to remote procedure call, that is to say, two servers A, B, an application is deployed on server A, and you want to call The functions/methods provided by the application on the B

server cannot be called directly because they are not in the same memory space. The semantics of the call and the data of the call need to be expressed through the network.
why: avoid duplication and scale horizontally to
solve problems:
protocol: transport protocol
proxy: client proxy, service referrer calls methods to send remote messages through the proxy
codec: protocol encoding, decoding, compression, etc.
transport: protocol transport
registry: registry, service registration service discovery, UDDI
cluster: load balancing, service fault tolerance strategy
Others : service degradation, service isolation, service governance


Standard development history:
ONC RPC (Remote Procedure Call for Open Network Computing), OSF RPC (Open Software Foundation's Remote Procedure Call)
CORBA (Common Object Request Broker Architecture)
DCOM (Distributed Component Object Model), COM+
Java RMI
.NET Remoting
XML-RPC, SOAP, Web Service
PHPRPC, Hessian, JSON-RPC
Microsoft WCF, WebAPI
ZeroC Ice, Thrift, GRPC
Hprose


The Internet Engineering Task Force (IETF), specifies the above ONC RPC


UDDI:
UDDI is a directory service that enterprises can use to register Web services and search. UDDI, "Universal Description, Discovery

and Integration" in English, can be translated as "Universal Description, Discovery and Integration Service".
The UDDI specification is formulated by the OASIS (Organization for the Advancement of Structured Information Standards) standardization organization.


Transmission protocol:
Each layer in the transmission protocol provides business functions for the upper layer. In order to provide this business function, the next layer incorporates the data in the previous layer into the data field of this layer, and then implements the business function of

this . This process is called data encapsulation. The user's data has to be packaged again and again, and finally converted into a signal that can be transmitted on the network and sent to the network. After reaching the target computer,

the reverse unpacking process is performed. This is similar to writing a letter in daily life. Write what you want to express on paper. If you are interested, you need to fold the paper into a special shape, then put it in an envelope and seal it. Write the address of the

recipient , Postal code and name, and then affixed with stamps, the post office staff will stamp the postmark and send it to the post office where the recipient is located

.
essential elements:
(1) Addressing. When an application wants to transfer data with another application, it must specify which application it is connected to. The addressing method generally adopts the definition transmission address. An Internet transport address consists of an

IP address and a host port number.
(2) Establish a connection. In practical network applications, the three-way handshake algorithm is used, and certain conditions are added to ensure that a reliable connection is established. The additional conditions are: the sent message must have an increasing sequence

number ; a timer is set up for each message, and a maximum delay is set. For those messages that exceed the maximum delay and still have not received acknowledgment information It is considered lost and needs to be retransmitted.
(3) Release the connection. A three-way handshake algorithm is also used.
(4) Flow control and buffer management. [2]
(5) Multiplexing.
(6) Crash recovery.


Multiplexing In a
data communication system or a computer network system, the bandwidth or capacity of the transmission medium is often greater than the requirement for transmitting a single signal

. Multiplexing technology (Multiplexing). The use of multiplexing technology can combine multiple signals to transmit on one physical channel, which can greatly

save . Frequency Division Multiplexing FDM (Frequency Division Multiplexing) and Time Division Multiplexing TDM (Time Division

Multiplexing) are the two most commonly used multiplexing techniques.
For example, the simplest example:
take the
bus It costs 20 yuan to take a taxi.
Why it cheaper to take the bus?
Here is the principle of "multiplexing".


MIME
MIME (Multipurpose Internet Mail Extensions) Multipurpose Internet Mail Extensions type. It is a way to set a file with a certain extension to be opened with an

application . When the extension file is accessed, the browser will automatically use the specified application to open.

Header field
MIME header is roughly divided into MIME information header and MIME segment header according to the position in the mail packet. (Translator: MIME header refers to the header of the entire message, while the MIME segment header is only the header of each MIME segment.)

MIME headers are:
MIME-Version:
This header provides the version number of the MIME used. This value is conventionally 1.0.

Content-Type:
It defines the type of data so that the data can be handled appropriately. In HTTP, MIME types are defined in the Content-Type header.
Each MIME type consists of two parts, the front is a large category of data, such as audio audio, image image, etc., and the specific type is defined in the back.
Hypertext Markup Language text.html text/html
xml document.xml text/xml
plain text.txt text/plain
RTF text.rtf application/rtf
PDF document.pdf application/pdf
Microsoft Word document.word application/msword
PNG image.png image/png
GIF graphics.gif image/gif
JPEG graphics.jpeg,.jpg image/jpeg
au sound file.au audio/basic
MIDI music file mid,.midi audio/midi,audio/x-midi
RealAudio music file.ra, .ram audio/x-pn-realaudio
MPEG file.mpg,.mpeg video/mpeg
AVI file.avi video/x-msvideo
GZIP file.gz application/x-gzip
TAR file.tar application/x-tar
arbitrary binary data application/octet-stream

Content-Transfer-Encoding :
This is the most important of all headers, as it describes the encoding performed on the data, and it will be used by the client/MUA to decode the attachment. For each attachment, one of 7bit, 8bit,

binary, quoted-printable, base64 and custom encodings can be used. 7bit encoding is a common encoding method used on the US ASCII character set, that is

, keep it as it is. 8bit and binary encoding are generally not used.

For standard human-readable text, quoted printable can be used if transmission is to be protected through gateways that affect formatting . Base64 is a general-purpose method that provides a no-brainer choice when it comes to deciding which encoding method to use; it's typically used on binary, non-text data. Note

Note that any non-7bit data must be encoded in a mode so it can pass through the Internet mail gateway!
7bit: 7bit here refers to the 7-bit ASCII encoding method.
8bit: 8-bit ASCII code.
binary:
quoted-printable: Because some European scripts are partially identical to some characters in the ASCII character set. If the mail message is in

these can be used as-is, and characters that do not exist in the ASCII character set are encoded using methods of the form "=??". Here "??" needs to be specified with the hexadecimal number after encoding the character. Messages encoded with

quoted-printable will not become too long in length, and most of them are characters in ASCII. Even without decoding, the content of the message can be roughly understood.
base64: base64 is an encoding method that converts binary 01 sequences into ASCII characters. Encoded text or binary messages can be sent

using . Base64 is generally considered to increase message length by an average of 33%, and the encoded message is unreadable to humans.
x-encodingname: This value is a reserved extension.

Content-ID:
This header is useful if the Content-Type is message/external-body or multipart/alternative, which is beyond the scope of this article.
Content-Description:
This is an optional header. It is a free text description of the content of any piece of information. The description must use us-ascii code.
Content-Disposition:
An experimental header that provides a hint to the client/MUA to decide whether to display attachments inline or as separate attachments.

MIME segment headers (the headers that appear in the actual MIME attachment section)
can have any of the above header fields in addition to the MIME-Version header. If a MIME header is part of a message block, it applies to the entire message body. For example, if Content

-Transfer-Encoding appears in a message (referring to the entire message) header, it applies to the entire message body, but if it appears in a MIME segment, it "only" applies to that segment.


ActiveX
now begins to describe the relationship between ActiveX, OLE and COM. First of all, let everyone have a general concept. From the perspective of time, OLE appeared first, followed by COM and ActiveX; from the perspective of

architecture , OLE and ActiveX are built on COM, so COM is the foundation; In terms of names, OLE and ActiveX are two brand names, while COM is a purely technical term

, which is why people hear more about ActiveX and OLE. Since OLE is the first to appear, let's start with OLE. Since the popularity of Windows operating system

, Clipboard" first solved the communication problem between different programs (the clipboard is used as a data exchange center for copying and pasting). operation), but the clipboard passes all "dead" data, and

application developers have to write and parse the code of the data format by themselves, so the communication protocol of Dynamic Data Exchange (DDE) came into being, which can Let

applications automatically obtain each other's latest data, but solving each other's "data format" conversion is still a heavy burden on the programmer. Object Linking and Embedding

The birth of Embedded, OLE) raised the data exchange of the original application to "object exchange", so that the programs not only obtain data but also obtain each other's application objects, and can directly

use each other's data content, in fact, OLE is Microsoft's Compound Document Technology, its initial version only targeted compound documents, but in the subsequent version OLE2, COM was imported. It can be seen that COM

was born in response to the needs of OLE, so although COM is the basis of OLE, OLE came before COM. The basic starting point of COM is to allow one piece of

software . The first user of COM was OLE2, so there is not much relationship between COM and compound documents. In fact, COM

began . In this way, Microsoft began to "meddle" with the common platform technology. But COM is not a product, it needs a brand name. At that time, Microsoft's market experts

had chosen OLE as a brand name, so those who used COM technology began to label OLE. Although the vast majority of these techniques have nothing to do with compound documents. This

approach gives rise to the misunderstanding that OLE refers only to compound documents? Or not just compound documents? In fact, OLE is the trademarked name of COM, and naturally it does not only refer to compound documents. But Microsoft

itself may not be able to explain it clearly, which takes considerable effort and time. So, with the development of the Internet, in the spring of 1996, Microsoft changed its mind and chose ActiveX as the new

brand name. ActiveX refers to a loosely defined collection of COM-based technologies, while OLE still refers only to compound documents. Of course, the core technology of ActiveX is still COM. ActiveX and OLE

The biggest difference is that OLE is aimed at the integration between application software and files on the desktop, while ActiveX is mainly to provide further network applications and user interaction.




















Method call:
int Multiply(int l, int r) {
int y = l * r;

return y;

}

int lvalue = 10;
int rvalue = 20;
int l_times_r = Multiply(lvalue, rvalue);


then on line 8 , we actually do the following:
push the values ​​of lvalue and rvalue
into the Multiply function, take the values ​​10 and 20 from the stack, assign them to l and r
, execute line 2, calculate l*r, and put the result There is y
to push the value of y to the stack, and then return from Multiply
to line 8, take the return value 200 from the stack, and assign it to l_times_r The
above 5 steps are the process of executing the local call.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326699567&siteId=291194637