This section presents an in-depth overview of the client-server communication which happens in Aspose.Editor when the browser downloads the client control, when the client requests a document from the server and when the client sends a document to the server.
The Browser Requests a Page from the Web Server
This diagram shows what happens when a web page containing Aspose.Editor control is requested by the browser:
The Client Control Requests a Document from the Web Server
Aspose.Editor client and server controls communicate over HTTP protocol in the same way as browser and web server talk to each other. The controls use HttpWebRequest and HttpWebResponse classes in their work.
Note: The application may use Java Script and "Microsoft.XMLHTTP" object to transfer requests instead of calling Send and Receive methods of client EditorControl.
From the HTTP protocol standpoint, the server recognizes a request if Content-Type is equal to "application/x-aspose-editor-document". Special header "X-Aspose-Editor-Param" carries a custom Param value.
On this diagram, client EditorControl requests a document from the server:
When server EditorControl sends a document in response to the client, it specifies HTTP status code 200 to indicate that the request was processed successfully. Body of the response contains the document itself.
The Client Control Sends a Document to the Web Server
When the client wants to send a document to the server, it does a very similar request to the server as for getting a document, but this time the body of the request contains the document to be saved on the server. The server control recognizes the request by Content-Type and extracts the document from the body.
On this diagram, client EditorControl sends a document to the server:
Normally, the server will reply and the response will be empty (contain only success status). But your application can make the server reply with a new or updated document to the client. This is useful when the server validates the document content, e.g. validates addresses stored on the server, etc. If the client receives a response that contains a document, the client will render the new document in the browser.
Conclusion
The communication method used by the server and client controls is both simple and powerful. It frees the developer from several configuration and implementation tasks required when using other techniques:
- Custom firewall rule is not required.
- Setup for .NET Remoting is not required.
- Implementing a Web Service/.NET Remoting server is not required.
- Using custom channels is not required.
- Synchronizing server events to client events is not required.
Please post your questions and comments in the Aspose Forums, you are welcome!