Customizing messages that client applications send to and receive from Web services

You can customize the XML tagging of the messages that client applications send to and receive from Web services.

For each operation that you include in a Web service, the workbench generates a default XML schema that describes the input and output XML messages for that operation. If an input message for a Web service operation is in XML, messages must be tagged according to this default XML schema. All output messages that Web services generate for the operation are also tagged according to the default XML schema.

You can configure XSL transformations of the XML input messages, the output messages, or both types of message for a Web service operation. Those XSL transformations take place during the input and output message flows.

The flow of custom SOAP/HTTP and HTTP POST (text/xml) messages involves two XSL transformations: one for input messages and one for output messages. The flow of custom HTTP GET/POST (url-encoded) messages involves only one XSL transformation, which is for output messages.

The following sections describe the XSL transformations for messages that use the supported message protocols.

 

XSL transformations with the SOAP/HTTP message protocol

This section describes the default message flow for SOAP/HTTP messages and then describes the flow that incorporates XSL transformations.

The default message flow, which contains no XSL transformations, for a Web service operation follows these steps:

  1. A client application sends a SOAP/HTTP message that accesses an operation in a Web service. The body of the message is in XML and is tagged according to the default schema.

  2. The Web service receives the message and passes to the database the SQL statement or stored procedure call that is in the operation.

  3. The Web service receives the response from the database and packages the response in an XML message that is tagged according to the default XML schema for the operation.

  4. The Web service sends the response to the client application.

Figure 1. Default flow of messages

When you configure XSL transformations, the message flow for a Web service operation follows these steps:

  1. A client application sends a SOAP/HTTP message that accesses an operation in a Web service. The XML message in the SOAP body is tagged according to a custom XML schema.

  2. The message is transformed so that it is tagged according to the default XML schema.

  3. The Web service receives the message and passes to the database the SQL statement or stored procedure call that is in the operation.

  4. The Web service receives the response from the database and packages the response in an XML message that is tagged according to the default XML schema for the operation.

  5. The message is transformed so that it is tagged according to the custom XML schema.

  6. The Web service sends the response to the client application.

Figure 2. Flow of messages that incorporates XSL transformations

Table 1. Inputs to and outputs from the XSL transformations
  Input to the XSL transformation Output from the XSL transformation
First XSL transformation SOAP-wrapped, valid XML document that uses a custom XML schema SOAP-wrapped, valid XML document that uses the default XML schema
Second XSL transformation SOAP-wrapped, valid XML document that uses the default XML schema SOAP-wrapped, valid XML document that uses a custom XML schema

As described in the following table, when you create the Web service supply the following files:

Table 2. Files that provide to the Web service
XSL transformation of input message XSL transformation of output message
Custom XML schema (XSD file) XSL file Custom XML schema (XSD file) XSL file
X X X X

 

XSL transformations with the HTTP POST (text/xml) message protocol

This section describes the default message flow for HTTP POST (text/xml) messages and then describes the flow that incorporates XSL transformations.

The default message flow, which contains no XSL transformations, for a Web service operation follows these steps:

  1. A client application sends an HTTP POST (text/xml) message that accesses an operation in a Web service. The message is in XML and is tagged according to the default schema.

  2. The Web service receives the message and passes to the database the SQL statement or stored procedure call that is in the operation.

  3. The Web service receives the response from the database and packages the response in an XML message that is tagged according to the default XML schema for the operation.

  4. The Web service sends the response to the client application.

Figure 3. Default flow of messages

When you configure XSL transformations, the message flow for a Web service operation follows these steps:

  1. A client application sends an HTTP POST (text/xml) message that accesses an operation in a Web service. The message is tagged according to a custom XML schema.

  2. The message is transformed so that it is tagged according to the default XML schema.

  3. The Web service receives the message and passes to the database the SQL statement or stored procedure call that is in the operation.

  4. The Web service receives the response from the database and packages the response in an XML message that is tagged according to the default XML schema for the operation.

  5. The message is transformed so that it is either in XML and is tagged according to the custom XML schema, or is in a non-XML format, such as HTML or plain text.

  6. The Web service sends the response to the client application.

Figure 4. Flow of messages that incorporates XSL transformations

Table 3. Inputs to and outputs from the XSL transformations
  Input to the XSL transformation Output from the XSL transformation
First XSL transformation Valid XML document that uses a custom XML schema Valid XML document that uses the default XML schema
Second XSL transformation Valid XML document that uses the default XML schema Non-XML document or a valid XML document that uses a custom XML schema

As described in the following table, when you create the Web service supply the following files:

Table 4. Files that provide to the Web service
XSL transformation of input message XSL transformation of output message
Custom XML schema (XSD file) XSL file Custom XML schema (XSD file) XSL file
  X   X

 

XSL transformations with the HTTP GET/POST (url-encoded) message protocol

This section describes the default message flow for HTTP GET (url-encoded) and HTTP POST (url-encoded) messages and then describes the flow that incorporates an XSL transformation.

The default message flow, which contains no XSL transformation, for a Web service operation follows these steps:

  1. A client application sends an HTTP GET (url-encoded) or HTTP POST (url-encoded) message that accesses an operation in a Web service. The message is an encoded sequence of parameters in string of text.

  2. The Web service receives the message and passes to the database the SQL statement or stored procedure call that is in the operation.

  3. The Web service receives the response from the database and packages the response in an XML message that is tagged according to the default XML schema for the operation.

  4. The Web service sends the response to the client application.

Figure 5. Default flow of messages

When you configure an XSL transformation, the message flow for a Web service operation follows these steps:

  1. A client application sends an HTTP GET (url-encoded) or HTTP POST (url-encoded) message that accesses an operation in a Web service. The message encodes the parameters. XSL transformations are not possible on these messages.

  2. The Web service receives the message and passes to the database the SQL statement or stored procedure call that is in the operation.

  3. The Web service receives the response from the database and packages the response in an XML message that is tagged according to the default XML schema for the operation.

  4. The message is transformed so that it is either in XML and is tagged according to the custom XML schema, or is in a non-XML format, such as HTML or plain text.

  5. The Web service sends the response to the client application.

Figure 6. Flow of messages that incorporates an XSL transformation

Table 5. Inputs to and outputs from the XSL transformations
  Input to the XSL transformation Output from the XSL transformation
First XSL transformation XSL transformations are not supported for messages from client applications.
Second XSL transformation Valid XML document that uses the default XML schema Non-XML document or a valid XML document that uses a custom XML schema

As described in the following table, when you create the Web service supply the following files:

Table 6. Files that provide to the Web service
XSL transformation of input message XSL transformation of output message
Custom XML schema (XSD file) XSL file Custom XML schema (XSD file) XSL file
      X

Previous topic: Sharing Web services with members of your development team

Next topic: Configuring Web servers to run Web services