On the Web Service and the actual combat
Under SOA briefed on the WebService and personal understanding. On a specific item on the implementation of some of the issues requiring attention
The article cited:
(1) http://webservices.xml.com/pub/a/ws/2003/09/30/soa.html
(2) ms-help: / / MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/cpguide/html/cpconanatomyofsoapwebservicelifetime.htm
(3) ms-help: / / MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/cpguide/html/cpconcustomizingsoapinaspnetwebserviceswebserviceclients.htm
, "Said world affairs, at a time will, or will at long." (Romance of the Three Kingdoms) - the software industry is not the same?
The software industry has a variety of technology platforms, architecture, but because different platforms area of concern is not the same, and each has their own characteristics, it is difficult to communicate between platforms, thus forming a message island. How can these be linked to the island information.? Industry put forward a lot of options, a very well-known programme is Serviced-Oriented (service-oriented). That service-oriented? This is the definition of it: "SOA is an architectural style whose goal is to achieve loose coupling among interacting software agents. A service is a unit of work done by a service provider to achieve desired end results for a service consumer. Both provider and consumer are roles played by software agents on behalf of their owners. "(1). service-oriented is a collection of a wide range of services. various services can communicate with each other (including simple data transfer and participate in a number of activities common services), through its various systems to provide some external interfaces, so as to achieve the purpose of integrating the various systems. Some industry also corresponds to the architecture, such as: DCOM.CORBA.J2EE. Achieve but not completely cross-system integration. Personally think that the reasons are as follows:
1. Interface definition language can not be received by the different systems. DCOM.COBRA J2EE or both have their own interface definition language (all binary). They can not be accepted by the other systems. Interface and it will be very difficult if it is set to change. Users and the demand is constantly change.
2. Use the binary network protocols for data communications. Difficult crossed the firewall, but their use was not widespread agreement reception, which the use of the Internet is particularly critical
Then a new architecture has arisen, it is XML Web Services, Microsoft is the definition of it: "XML Web services is to provide specific functional elements (such as application logic) programmable entities, in any amount, may be is completely different from the system can be used common Internet standards (such as XML and HTTP) access it. its core feature is the presence and use of services between the realization of the high degree of abstraction. "Web Services are rapidly being all platforms acceptable. relation to the other structure, with its advantages:
1. Interface definition language. Use it as a WSDL interface definition language, which is an XML-based Document format, and text can be all kinds of systems and platforms know.
2. Use HTTP, SOAP, SMTP, and other widely accepted protocol data communications. While HTTP is the basis of the agreement of the Internet
- Depth understanding of how the Web Services? Personally think that should be the following aspects:
I. Purpose
It is a way of achieving SOA is to connect different systems and computing equipment. Achieve system interoperability and data
In simple terms is to be able to access different systems and computing equipment in the data. Rather than concerned about these data in their respective systems and equipment is stored how. Also can be described as data is not concerned about how the package (similar in the OO black box)
2. Definition
XML Web Service by definition is the use of XML Web services to provide. In fact, strictly Web can not say that XML Service, because not all of the Web Service requires the WebServer. My service is to provide some functions to the user, that is, to provide a user interface, that is, Web Service. Therefore Web Service is not a new distributed object. While DCOM, CORBA, J2EE essentially the distributed object.
3. Component
1. Some can handle XML components.
First XML Web Service (or Web Service) to be able to deal with XML, XML for disposal of the components of the design is how. Different language, platform has different forms. May OO (object-oriented). May also be other ways. in the. Lane through the Net. Net Framework provides a number of categories achieved
2. XML documents
We have said in front of one of the advantages of Web Service with the interface definition language (IDL) is an XML-based document, as is the Web Service SOA (service-oriented) A, and the goal of SOA in the system is established between a kind of loose coupling, services and consumer services, will not be able to Object as a data communication link or about Qie (Contract), we must make use of XML documents for about Qie. In order to make the service provider and consumer side Contract can understand the meaning. WSDL Web Service to describe the use of XML documents. external interface is described. At the same time the use of XML Schema to describe the data file
3. XML documents carrier
With XML document on the need for a load of its agreement. Web Service using SOAP as a set. SOAP: Simple Object Access Protocol, strictly speaking the name is wrong, because it is not used to access the object. MS to it is defined as "SOAP is an XML-based, on the Web for the exchange of information and type of structure of the simple light of the agreement." It means envelope bearing XML documents. Envelope is divided into two parts: the first envelope (head) and an envelope of (body). First general support for the preservation of some information, such as security (data encryption and signature) and the routing information in the envelope that is used to preserve Qie about the interface description and the specific data
4. Services Address
Used to tell the consumer where services can access services, services in place, which
Microsoft offers UDDI (Universal Description, discovery and integration).
Net Web Service to achieve the way through ASP.NET. It encapsulates many of the details, allowing developers to develop WebService very convenient, but the result is more difficult to understand nature. (MS usual style).
L through the Web method call in the form of Web Service.
Said earlier the Web Service is actually exchanged between XML documents, taking into account many programmers
Not accustomed to direct operations XML (like objects and methods of operation),. Net, will receive the
XML documents into objects or as a method of parameter values, will be at the same time, or the value of
Anti-like sequence into XML documents sent back to the consumers of services, service consumers can use traditional
Calling the method of object to the form of service providers to gain hope that the request sent a few
According. From consumer applications corresponding to the outcome of the process as follows (2) -:

From this flow chart (2) can be seen. Client to First Call Web Service to send information.
And news services-through to consumers know call it. So in a sense. Web
Service is based on information architecture, but the information is based on the XML document
Acting like a l
Agency's role is to facilitate and Web services communications. In. Net, and can be automatically hand
Moving way, both under the service of the WSDL document. As mentioned earlier for the convenience of
Programmers customary usage. XML document Net-sequence will be turned into targets, the agency is also in the same category.
This will give us a false impression, as re-created in the client services side of the object. Such as: 1
Web Test Method to customers return a ObjectA
Public class ObjectA
(
Public string FieldA
Public string FieldB
)
Acting in the same category then will generate a ObjectA. Its structure and the end of the service module is a one ObjectA
Kind of. Fact this is. Net To facilitate the use of artificially generated Web Service (This is
Many people think that the WebService is used for remote objects to visit one of the reasons). Customer service on the Web
End, never received only XML documents, files, the data are described in XML Schema. Regarding
Web use is how all the characteristics of the client, right. Net complexity of the case it would take some self-definition
The types into XML Schema Object. Some other clients will not be converted into Object. Such as
Soap Tookit. Convert it into an XML node (Node) Object
Below the combination of a practical item to illustrate how to implement Web Service.
1. Project profiles
A company with existing products ProductA. (PA), it needs to carry out some data processing. These data by region and time will change, and the corresponding data from the government agencies, different government agencies in the data is different, every one needs to change in the form of letters product users, or by the companies themselves Finishing then tell users to update. This has caused different regions have different versions, users upgrade difficulties, and the Government of data between agencies to communicate and contrast
2. Solution
Use Web Service functions, all government agencies will be the data are open (of course, the competence of J). Products (PA) as a WebService client can visit different real-time data, such products and data between data and data between users and data among a seamless link

3. Specific implementation
With the two services are services participants: the provision of services and service consumers
The product (PA) it is service. Therefore it is only a Web Service Client. May be the
DR types of procedures. PA existing VB is a version of the procedure, you can visit different Agency
The Service.
The data (ABC……). Them as a service provider but also consumers. Because users
Need to be able to direct enquiries some data, the users, we have done to each data to a web site
User-friendly query (using the establishment of ASP.net)
We said before the service is to have the functions and data through open interfaces and functions without the need for care
Data in their respective systems is how to achieve, and therefore its own functions and data can be used both still
Technology. Achieve some functions and data or a three-tier structure, will be Web Service as an independent
Layer (layer Facade). Framework diagram as follows:

. Asmx Net provides document as a concrete realization of the document. In the course of implementation there are several issues to the attention of:
L SOAP format
Soap is about Qie service carrier, and it does have a certain format. For the SOAP envelope. Document format, and there are two RPC. The SOAP request and response data in two formats: Encoded and Literal.
Document refers to the pattern elements formatted for Body Body elements under one or more of continuous news segment (3). Use the XSD Schema
RPC style means the SOAP specification of the use of SOAP RPC content (that is, what is commonly known as SOAP standard, section 7) of the Body formatting elements (3), which is all the elements of an XML element in the package , does not require the use of XSD Schema
Literal style is the presence of elements of the Body and coding for the self-contained XML documents. Use XSD Schema
Encoded style norms in the use of SOAP encoding rules of format settings. Does not need XSD Schema
Asp.Net in the Document / Literal is the default settings. Literal only under Document
Can use, and can be Encoded in the Document and the use of RPC. We can customise
SOAP styles. . Net provides functional attributes to accomplish this:
SoapDocumentMethod
SoapDocumentService
SoapRpcMethod
SoapRpcService
Please refer to the use of specific MSDN
L entities (Entity) Design
I did not use in the project DataSet. Used a custom class, the major consideration is
A. operation to facilitate
B. Dataset is a coarse-grained objects. Including some we do not have the attributes and objects. Increase the time of the visit
If Web Methods entity as a parameter, we need to judge the effectiveness of entities. For example. Entities whether attribute is empty, and so on the length value. Because. Net will be automatically receive the anti-sequence information into XML objects, and object is the value of client settings, we have no control. That it is necessary at this time to determine the validity of the data. There are three general approaches.
A. in the business logic layer validation.
Such shortcomings code than more, especially when more of the attributes, inconvenient changes
B. through entities corresponding documents to verify XSD
C. by setting attributes of the entity to carry out verification Attribute
B and c are using technology to achieve a reflection advantage of the code is to reduce the amount of change it more convenient to use recommendation. I spent in the project, Attribute method.
L WebService security
Web Service security is a very important aspect.
Security includes both authorized and signature. Microsoft and other companies put forward a
A tool kit to solve this problem: Web Service Enhancment (WSE) -. Now as
Version 2.0. Realization of a number of important norms Service ..
L Exception Implementation
Web Service will be abnormal, usually in the form of mistakes to Soap release. Soap in the news in a Fault element is devoted to the preservation of these information. Asp.Net used in the creation of Web Service is the first in the sequence of anomalies and then put the elements of the Fault. General Packaging into the wrong SoapException dished out to the client, but in the case of the Soap Header part of the error will trotted out a SoapHeaderException. For SoapException, information is on the wrong attributes in Detail, containing wrong information. In the course of these practical application of detailed information on the client is unfriendly, then we need to re-package under the SoapException. Is dished out in the end to the abnormal service attributes Detail (sequence elements into Detail) to add a sub-element used to store a number of friendly error message, and then on the receiving end users to show in this sub-element under the wrong message
Tags: web








0 Comments to “On the Web Service and the actual combat”
No Comments. Send your comment.
Leave a Reply
You must be logged in to post a comment.