Transforming input messages that use the HTTP POST (text/xml) protocol and output messages

If client applications will access an operation with messages that use the HTTP POST (text/xml) protocol, you can transform those messages to use the XML schema that the workbench generated for the operation. You can optionally transform messages that are returned by the Web service from the default XML schema to valid XML documents or into non-XML formats.

The following table describes the inputs to and outputs from the XSL transformations that are possible when input messages use the HTTP POST (text/xml) protocol:

Table 1. 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

Procedure:

To configure XSL transformations on HTTP POST (text/xml) input messages that access an operation and optionally on output messages:

  1. Open the

    Manage XSL Transformations wizard by right-clicking the operation and selecting

    Manage XSL Transformations.

  2. Click

    Generate default to generate the default XML schema for the input messages and the output messages.

  3. Create an XSL file for the transformation of input messages. Make sure that the XSL file is in a location that you can browse to from the workbench.

  4. Create an XSL file for the transformation of output messages to non-XML files or XML files that are tagged according to a custom XML schema.

    1. Optional:

      Specify the mime type for files that the XSL transformation creates. Use the media-type attribute of the <xsl:output> tag in the XSL file.

      If you do not specify a mime type, the XSL transformation uses the following algorithm to determine the mime type:

      • If the output of the transformation is an HTML file, the mime type is set to text/html.

      • If the output of the transformation is a text file, the mime type is set to text/plain.

      • If the output of the transformation is an XML file, the mime type is set to text/xml.
    When you are finished, make sure that the XSL file is in a location that you can browse to from the workbench.

  5. Open the

    Manage XSL Transformations wizard by right-clicking the operation and selecting

    Manage XSL Transformations.

  6. Select the XSL file for the transformation of input messages.

  7. If you want to transform output messages, select the XSL file for the transformation of output messages.

  8. Click Finish.

 

Example

Show me

Transcript:

This viewlet demonstrates how to use the workbench to configure two XSL transformations on the XML within messages that request an operation in a Web service.

The first transformation works on HTTP POST (text/xml) messages from client applications. The XML in those messages is converted from tags that are defined in your own XML schema to tags that are defined in the default XML schema that the workbench generates for the operation.

The second transformation works on messages that the Web service returns to client applications. The XML is converted from tags that are defined in the default XML schema to any of the following formats:

Generate the workbench's default XML schema for the operation. You need to use this schema when you create the XSL files for the two transformations. You generate the default schema in the Manage XSL Transformations window.

Create the two XSL files by using your own preferred method. Make sure that the XSL files are in a location that you can browse to from the workbench.

When you are finished, open the Manage XSL Transformations window again. Browse to and select the XSL file for the first transformation. Browse to and select the XSL file for the second transformation.

When you deploy the Web service to a J2EE Web server, the XSL files are packaged in the Web Archive (WAR) file.