Php learning path: WSDL (2)

Source: Internet
Author: User
Php learning path: WSDL (II) 3. define the logic message used by the service when the service operation is called, the service is defined as message exchange. In the wsdl document, these messages are defined as message elements. These messages are composed of parts called part elements. A service operation is defined by specifying logical messages. When an operation is called, logical messages are exchanged. (That is, logical messages represent service operations) these logical messages define the data transmitted over the network as the learning path of xm php: WSDL (II)

3. define the logical message used by the service

When a service operation is called, the service is defined as message exchange. In the wsdl document, these messages are defined as message elements. These messages are composed of parts called part elements.

A service operation is defined by specifying logical messages. When an operation is called, logical messages are exchanged. (That is, logical messages represent service operations) these logical messages define the data transmitted over the network as xml documents. It contains all the parameters that are part of a method call. (That is, the parameters in a logical message are a set of parameters for the method corresponding to the operation)

Message and parameter list: each operation exposed by a service can have only one input message and one output message. The input message defines all messages received by the service when the operation is called. The output message defines all messages returned by the service when the operation is complete. A fault message defines the data returned when the service returns an error.

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

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

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

Your input message corresponds to one part for each input parameter, and the output message corresponds to one part for each output parameter. Add a part to return the value. If a parameter is both input and output, it is listed as input and output messages.

The RPC-style message definition is useful when the service enables the stock of the system. It is transmitted in a mode similar to TIBCO or CORBA. These systems are designed around processes and methods. Because of this, they are the easiest way to use messages for modeling. RPC is also a clear ing between services and applications.

Design the message for the SOAP service: When the RPC style is used to model the inventory system, the service Association strongly prefers the packaging document style. In the packaging document style, each message has a part. The part of the message references a packaging element, which is defined in the types element. Packaging elements have the following features:

  • It is a composite type containing a series of elements
  • If the package is an input message, each element of the package corresponds to an input parameter. Its name is the same as the relevant operation name.
  • If the package is an output message, each element of the package corresponds to an input parameter and an output parameter. Its first element represents the return value of the method. His name will be added to the name of the action associated with the package.

Message naming: Each message has a unique name in its namespace. we recommend that you use the following naming rules:

  • Messages should be used by a single operation
  • The input message name is added after the operation name
  • The output message name is added after the operation name
  • The error message name is fault after the error cause.

Message component: a message component is the most common unit for logical messages. Each part is defined with a part element. You can also use the name attribute to specify the data type by using the type or element attribute.

The part name can be reused for a message. For an instance, if a method has a parameter: foo, which is applied or passed through in/out, it can exist as a Part in the request or response message. For example:






Example: assume that you have a server that stores personal information and provides a method for returning employee data based on employee ID .. The method is as follows:

PersonalInfo lookup (long empId)

The WSDL mapped to the RPC style is as follows:





The packaging style is 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.