PHP Learning Path: WSDL detailed (ii)

Source: Internet
Author: User
Tags define contains naming convention return wrapper wsdl

3. Define the logical message used by the service

When the operation of the service is invoked, the service is defined as a message exchange. In a WSDL document, these messages are defined as message elements. These messages are made up of parts called part elements.

The operation of a service, defined by the way that a logical message is specified. When the operation is invoked, the logical message is exchanged. (That is, the logical message represents the operation of the service) these logical messages define the data that is transferred over the network as an XML document. He contains all the parameters, which are part of the method invocation. (that is, the parameters in the logical message are the set of parameters for the corresponding method)

Message and parameter list: each operation exposed by the service can and can only have one input message and one output message. The input message defines all messages that the service accepts when the operation is invoked. The output message defines all the messages that the service returns when the operation completes. The fault message defines the data when the service returns an error.

In addition, each operation can have a certain number of fault messages. This fault message defines the data that is returned when a service error occurs. These messages usually have a section that provides enough information to let consumers know what the error is.

Message design is used to integrate inherent systems: if you define an existing application as a service, you must ensure that each parameter used in the method (the method of implementing the operation) can be found in the message. You must make sure that the return value is also in the output message of the operation.

One way to define your message is: RPC style. When RPC style is used, you define a part for each parameter in the parameter list. Each message part is based on the type of the top one in the types.

Your input message corresponds to one part for each input parameter, the same output message corresponds to one part for each output parameter. Additionally a part is added to correspond to the return value. If an argument is both input and output, it is listed as input and as an output message.

RPC-style message definitions are useful when a service makes it possible to stock a system. It uses a pattern transmission similar to TIBCO or CORBA. These systems are designed around processes and methods. It is because of this that they are the easiest to model using messages. RPC style is also a clear mapping between services and applications.

Design a message for the SOAP service: When RPC style is used to model the stock system, the Service Association strongly prefers to wrap the document style. In the wrapping document style, each message has a part. The part of this message refers to a wrapper element that is defined in the types element. The wrapper element has the following characteristics:

  • He is a compound type that contains a series of elements
  • If it is an input message wrapper, then: each of its elements corresponds to an input parameter; his name, his name, is the same as the associated operation name.
  • If it is a wrapper for an output message, then: each of its elements corresponds to an input parameter and a corresponding output parameter. Its first element represents the return value of the method. His name will be increased by adding response to the name of the operation of the wrapper with which he wants to associate.

    Message naming: Each message has a unique name in its namespace, and it is recommended that you use the following naming convention:

    • Messages should be used by a single operation
    • Enter the message name to add the request after the operation name
    • The output message name is incremented after the operation name response
    • The error message name is added fault after the error reason

      Message widget: The message part is the most common unit of logical messages. Each part is defined, with the part element. and use the Type property or element property to specify the data type with the Name property.

      The message allows the part name to be reused. For an instance, if a method has a parameter: foo, which is applied or passed through in/out, he can exist as a part in the request or reply message. The following example:






      Example: Suppose you have a server that stores personal information and provides a method that changes back to the employee's data, based on the employee ID. The method is as follows:

      Personalinfo lookup (Long empId)

      The WSDL mapped to RPC style is as follows





      Map to the packaging style as follows:



      ...






















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.